feat: Add WorldStateFlagAttribute and custom property drawer for enhanced dialogue management
- Implemented WorldStateFlagAttribute to mark string fields as world state flags. - Created NarrativeNPCEditor for custom inspector to visualize dialogue version activation states. - Developed WorldStateFlagDrawer to provide dropdown menu for known flags in the inspector. - Introduced ActorModule for managing DialogueActorSO assets, including viewing, creating, and deleting actors. - Added DialogueModule for managing DialogueSequenceSO assets with detailed previews and action bars. - Established QuestModule for managing QuestSO assets, including objectives and branches. - Implemented QuestManagerPostprocessor to automatically refresh QuestManager's quest list on asset changes.
This commit is contained in:
@@ -55,20 +55,14 @@ namespace BaseGames.Editor
|
||||
string path = AssetDatabase.GetAssetPath(asset);
|
||||
if (string.IsNullOrEmpty(path)) return (false, "资产不在 AssetDatabase 中");
|
||||
|
||||
// 先更新序列化内部名称
|
||||
string oldName = asset.name;
|
||||
Undo.RecordObject(asset, "Rename " + oldName);
|
||||
asset.name = newName;
|
||||
EditorUtility.SetDirty(asset);
|
||||
|
||||
// 再重命名磁盘文件
|
||||
// 先重命名磁盘文件,成功后再修改内部名称,避免 Undo 状态被失败操作污染
|
||||
string err = AssetDatabase.RenameAsset(path, newName);
|
||||
if (!string.IsNullOrEmpty(err))
|
||||
{
|
||||
asset.name = oldName;
|
||||
EditorUtility.SetDirty(asset);
|
||||
return (false, err);
|
||||
}
|
||||
|
||||
Undo.RecordObject(asset, "Rename " + asset.name);
|
||||
asset.name = newName;
|
||||
EditorUtility.SetDirty(asset);
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
Reference in New Issue
Block a user