1
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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}");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user