This commit is contained in:
CortexCore
2025-03-09 13:38:23 +08:00
parent 8261a458e2
commit 18239a5ae4
67 changed files with 8573 additions and 831 deletions

View File

@@ -20,12 +20,11 @@ namespace BITKit.Scene
if (draw is false || AllowGizmos is false) return;
var position = transform.position;
Gizmos.color = color;
Gizmos.DrawWireSphere(position, size);
if (bounds.Allow)
{
var rotation = transform.rotation;
Gizmos.DrawWireCube(position+rotation*bounds.Value/2, rotation*bounds.Value);
Gizmos.DrawCube(position, rotation*bounds.Value);
}
}
}

View File

@@ -22,6 +22,7 @@ namespace BITKit.GameEditor
protected ListView listView { get; private set; }
protected VisualElement container { get; private set; }
protected VisualElement _actionContainer { get; private set; }
protected TextField _newNameField { get; private set; }
private Button _createButton;
protected virtual void OnEnable()
@@ -94,11 +95,37 @@ namespace BITKit.GameEditor
{
var newNameContainer = scroll.Create<GroupBox>();
newNameContainer.style.flexDirection = FlexDirection.Row;
var newNameField = newNameContainer.Create<TextField>();
var newNameField =_newNameField = newNameContainer.Create<TextField>();
newNameField.style.flexGrow = 1;
var confirmButton = newNameContainer.Create<Button>();
confirmButton.text = "重命名";
confirmButton.clicked += () =>
{
var newName = newNameField.value;
if (string.IsNullOrEmpty(newName))
{
EditorUtility.DisplayDialog("警告", "文件名不能为空", "OK");
return;
}
var selected = listView.selectedItem as Object;
if(!selected)return;
var path = AssetDatabase.GetAssetPath(selected);
if (EditorUtility.DisplayDialog("询问", $"确定要重命名{Path.GetFileName(path)}为{newName}", "确定", "取消") is false)
{
return;
}
AssetDatabase.RenameAsset(path, newName);
RebuildList();
};
}
@@ -148,9 +175,12 @@ namespace BITKit.GameEditor
{
var selected = obj.FirstOrDefault() as Object;
var serializedObject = new SerializedObject(selected);
BITInspectorExtensions.FillDefaultInspector(container,serializedObject, true);
BITInspectorExtensions.FillDefaultInspector(container, serializedObject, true);
container.Bind(serializedObject);
if (selected)
_newNameField.SetValueWithoutNotify(selected.name);
}
protected virtual VisualElement MakeItem()
{
var container = new VisualElement();
@@ -187,6 +217,8 @@ namespace BITKit.GameEditor
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
RebuildList();
Debug.Log($"复制成功:{path}");
}
}