summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Tools/LevelEditor/TestLevel.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-06-27 18:43:09 +0800
committerchai <215380520@qq.com>2023-06-27 18:43:09 +0800
commit411470e66bcfd9631c7b6f82b0a00e5e1e1b0004 (patch)
tree9a3d3b453702834eb4ad6a4b7eabb6a7b5422880 /WorldlineKeepers/Assets/Tools/LevelEditor/TestLevel.cs
parent3d1e930feed19641f0f386463f4de33385f24c51 (diff)
+ stage serialize
Diffstat (limited to 'WorldlineKeepers/Assets/Tools/LevelEditor/TestLevel.cs')
-rw-r--r--WorldlineKeepers/Assets/Tools/LevelEditor/TestLevel.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/WorldlineKeepers/Assets/Tools/LevelEditor/TestLevel.cs b/WorldlineKeepers/Assets/Tools/LevelEditor/TestLevel.cs
new file mode 100644
index 0000000..fd93704
--- /dev/null
+++ b/WorldlineKeepers/Assets/Tools/LevelEditor/TestLevel.cs
@@ -0,0 +1,34 @@
+using LitJson;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using UnityEngine;
+using UnityEngine.UI;
+using WK.Data;
+
+public class TestLevel : MonoBehaviour
+{
+ public InputField m_StageFile;
+ public UnityEngine.UI.Button m_BtnStage;
+
+ public Transform m_RootStage;
+
+ private void Awake()
+ {
+ DataManager.Instance.AsyncLoadAll();
+
+ m_StageFile.text = "Assets/Bundle/stages/stage0/stage.json";
+
+ m_BtnStage.onClick.AddListener(OnClickStage);
+
+ }
+
+ void OnClickStage()
+ {
+ string file = m_StageFile.text;
+ string content = File.ReadAllText(file);
+ StageMetadata metadata = JsonMapper.ToObject<StageMetadata>(content);
+ StageBuilder.Instance.AsyncBuildStage(metadata, m_RootStage);
+ }
+}