blob: b9609a54f708d79f8a080f84f4f4f21d71f9f217 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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);
}
}
}
|