Browse Source

添加编辑器

lzx 2 days ago
parent
commit
e3d46224a4

+ 2 - 2
Assets/Res/UI/DivineSence/DivineSenceInfoPanel.prefab

@@ -613,7 +613,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!224 &2896655462721008753
 RectTransform:
   m_ObjectHideFlags: 0
@@ -654,7 +654,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   m_Material: {fileID: 0}
-  m_Color: {r: 0, g: 0, b: 0, a: 0.69411767}
+  m_Color: {r: 0, g: 0, b: 0, a: 0.003921569}
   m_RaycastTarget: 1
   m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
   m_Maskable: 1

+ 40 - 18
Assets/Scripts/GameLogic/PlayerDataEditorWindow.cs → Assets/Scripts/GameUI/Editor/PlayerDataEditorWindow.cs

@@ -18,22 +18,23 @@ public class PlayerDataEditorWindow : EditorWindow
     [MenuItem("Tools/PlayerData 编辑器")]
     public static void ShowWindow()
     {
-        GetWindow<PlayerDataEditorWindow>(true,"PlayerData 编辑器");
+        GetWindow<PlayerDataEditorWindow>(true, "PlayerData 编辑器");
     }
 
     private void OnEnable()
     {
-    
         LoadPlayerData();
     }
 
+
+    private string targetFolder = "";
     private void OnGUI()
     {
         GUIStyle headerStyle = new GUIStyle(EditorStyles.boldLabel) { fontSize = 14, padding = new RectOffset(5, 5, 5, 5) };
         GUIStyle sectionStyle = new GUIStyle(EditorStyles.helpBox) { margin = new RectOffset(5, 5, 5, 5), padding = new RectOffset(10, 10, 10, 10) };
-    
+
         scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
-      
+
         if (playerData == null)
         {
             EditorGUILayout.HelpBox("未加载 PlayerData!点击下方创建新数据。", MessageType.Warning);
@@ -41,15 +42,34 @@ public class PlayerDataEditorWindow : EditorWindow
             {
                 playerData = new AccountFileInfo.PlayerData();
             }
-    
+
             EditorGUILayout.EndScrollView();
             return;
         }
-    
+
         EditorGUILayout.LabelField("PlayerData 编辑器", headerStyle);
         EditorGUILayout.Space();
-    
+
         EditorGUILayout.BeginVertical(sectionStyle);
+
+        if (Application.isPlaying)
+        {
+            targetFolder = EditorGUILayout.TextField(targetFolder);
+            if (GUILayout.Button("添加事件", GUILayout.Height(30)))
+            {
+                if (int.TryParse(targetFolder, out int eventid))
+                {
+                    var eventList = EventSystemManager.Instance.AddEvent(eventid);
+                
+                    if (eventList != null)
+                    {
+                        AccountFileInfo.Instance.playerData.eventList.Add(eventList);
+                        AccountFileInfo.Instance.SavePlayerData();
+                    }
+                }
+            }
+        }
+
         try
         {
             DrawFields(playerData, playerData.GetType(), "PlayerData.");
@@ -58,19 +78,22 @@ public class PlayerDataEditorWindow : EditorWindow
         {
             EditorGUILayout.HelpBox($"绘制字段时出错: {ex.Message}", MessageType.Error);
         }
-    
+
         EditorGUILayout.EndVertical();
-    
+
         EditorGUILayout.Space();
         EditorGUILayout.BeginHorizontal();
-        if (GUILayout.Button("保存 PlayerData", GUILayout.Height(30)))
+        if (!Application.isPlaying)
         {
-            if (EditorUtility.DisplayDialog("保存确认", $"确定要保存到 {Application.persistentDataPath + DataFilePath}?\n现有文件将被覆盖。", "确定", "取消"))
+            if (GUILayout.Button("保存 PlayerData", GUILayout.Height(30)))
             {
-                SavePlayerData();
+                if (EditorUtility.DisplayDialog("保存确认", $"确定要保存到 {Application.persistentDataPath + DataFilePath}?\n现有文件将被覆盖。", "确定", "取消"))
+                {
+                    SavePlayerData();
+                }
             }
         }
-    
+
         if (GUILayout.Button("加载 PlayerData", GUILayout.Height(30)))
         {
             if (EditorUtility.DisplayDialog("加载确认", $"确定要从 {Application.persistentDataPath + DataFilePath} 加载数据?\n当前编辑的数据将被覆盖。", "确定", "取消"))
@@ -78,9 +101,9 @@ public class PlayerDataEditorWindow : EditorWindow
                 LoadPlayerData();
             }
         }
-    
+
         EditorGUILayout.EndHorizontal();
-    
+
         EditorGUILayout.EndScrollView();
     }
 
@@ -289,9 +312,9 @@ public class PlayerDataEditorWindow : EditorWindow
     {
         if (!Application.isPlaying)
         {
-            if(playerData == null)
+            if (playerData == null)
                 playerData = new AccountFileInfo.PlayerData();
-            
+
             try
             {
                 string path = Application.persistentDataPath + DataFilePath;
@@ -316,7 +339,6 @@ public class PlayerDataEditorWindow : EditorWindow
         {
             playerData = AccountFileInfo.Instance.playerData;
         }
-       
     }
 }
 #endif

+ 0 - 0
Assets/Scripts/GameLogic/PlayerDataEditorWindow.cs.meta → Assets/Scripts/GameUI/Editor/PlayerDataEditorWindow.cs.meta


+ 1 - 1
Assets/Scripts/GameUI/UI/AppBarPanel/AppBarPanel.cs

@@ -120,7 +120,7 @@ namespace Fort23.Mono
                 TipMessagePanel.OpenTipMessagePanel("神识值不够!");
                 return;
             }
-
+            EventSystemManager.Instance.CancelEvent();
             if (EventSystemManager.Instance.isTriggerEvent)
                 return;
 

+ 10 - 5
Assets/Scripts/GameUI/UI/DivineSence/DivineSenceEventPreviewPanel.cs

@@ -16,7 +16,7 @@ namespace Fort23.Mono
         private ShengShiEventWidgetType2 mainShengShiEventWidgetType2;
 
         private int saixuanType = 1;
-        
+
         bool isTriggerEvent = false;
 
 
@@ -93,11 +93,16 @@ namespace Fort23.Mono
                 UIManager.Instance.DormancyGComponent(shengShiEventWidgetType2);
             }
 
-            if (mainShengShiEventWidgetType2 == null)
-                mainShengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType2>(null, ShengShiEventWidgetType2Root);
+
             AccountFileInfo.EventList eventList = EventSystemManager.Instance.GetMainEventDta();
-            mainShengShiEventWidgetType2.CustomInit(eventList, GoOnClick);
-            mainShengShiEventWidgetType2.OnClick = OnClick;
+            if (eventList != null)
+            {
+                if (mainShengShiEventWidgetType2 == null)
+                    mainShengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType2>(null, ShengShiEventWidgetType2Root);
+                mainShengShiEventWidgetType2.CustomInit(eventList, GoOnClick);
+                mainShengShiEventWidgetType2.OnClick = OnClick;
+            }
+
 
             shengShiEventWidgetTypeList.Clear();
 

+ 1 - 0
XiuXianGame.sln.DotSettings.user

@@ -13,6 +13,7 @@
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AComponent_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5c4a01f363eb46748231fc41bd9bdd8517e000_003F23_003Fdf7b38e0_003FComponent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADictionary_00602_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9c2967a135e648bdb993c5397a44991b573620_003Fad_003Fcb4b4f1f_003FDictionary_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADictionary_00602_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe4df6db7850b4c40b72002ff5da8188846ac00_003Fc8_003F6520f62d_003FDictionary_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
+	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEditorGUILayout_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1f63769030ae497a94b35af8517071579d5a00_003F36_003F62e71429_003FEditorGUILayout_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEditor_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1f63769030ae497a94b35af8517071579d5a00_003F3c_003F2c949974_003FEditor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5004a53079e04c2991f89460a5186cf010fc00_003Fd5_003F42d076c8_003FEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5004a53079e04c2991f89460a5186cf010fc00_003Fd5_003F42d076c8_003FEnumerable_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String>