diff options
Diffstat (limited to 'WorldlineKeepers/Assets/Tools/LevelEditor/LevelEditor.cs')
-rw-r--r-- | WorldlineKeepers/Assets/Tools/LevelEditor/LevelEditor.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/WorldlineKeepers/Assets/Tools/LevelEditor/LevelEditor.cs b/WorldlineKeepers/Assets/Tools/LevelEditor/LevelEditor.cs new file mode 100644 index 0000000..b9609a5 --- /dev/null +++ b/WorldlineKeepers/Assets/Tools/LevelEditor/LevelEditor.cs @@ -0,0 +1,54 @@ +using LitJson; +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using WK; +using WK.Data; + +public class LevelEditor : EditorWindow +{ + + private static LevelEditor s_LevelEditorWindow; + + private string m_StageOutFile = "Assets/Bundle/stages/"; + + [MenuItem("Tools/¹Ø¿¨±à¼Æ÷/Open")] + public static void OpenLevelEditor() + { + s_LevelEditorWindow = GetWindow<LevelEditor>(); + } + + private void OnGUI() + { + m_StageOutFile = GUILayout.TextField(m_StageOutFile); + + if(GUILayout.Button("ÐòÁл¯")) + { + StageMetadata stageMetadata = new StageMetadata(); + + StageEntityBase[] entites = GameObject.FindObjectsOfType<StageEntityBase>(); + if(entites != null && entites.Length > 0) + { + for(int i = 0; i < entites.Length; ++i) + { + StageEntityBase entity = entites[i]; + if (entity == null) + continue; + GameObject go = entity.gameObject; + if (go.name.StartsWith("~")) + continue; + var meta = entity.OnSerialize(); + if(meta != null) + { + stageMetadata.Write(meta); + } + } + } + + string json = JsonMapper.ToJson(stageMetadata); + CommonFunction.WriteFile(json, m_StageOutFile); + } + } + +} |