From 915d2c70f3b24fedd1a6cadc1dbb185ae88980f5 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期日, 05 五月 2019 22:00:35 +0800
Subject: [PATCH] 382 地图编辑器相关逻辑
---
Core/MapEditor/Editor/MapEditor.cs | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/Core/MapEditor/Editor/MapEditor.cs b/Core/MapEditor/Editor/MapEditor.cs
index 88f21d3..ebb4dab 100644
--- a/Core/MapEditor/Editor/MapEditor.cs
+++ b/Core/MapEditor/Editor/MapEditor.cs
@@ -121,6 +121,10 @@
{
SaveJson();
}
+ if (GUILayout.Button("鍔犺浇1", gUISkin.button, GUILayout.Width(60), GUILayout.Height(22)))
+ {
+ LoadJson();
+ }
EditorGUILayout.EndHorizontal();
/// --------------------------------------------------------------------------------
@@ -344,13 +348,31 @@
{
return;
}
+ EditorPrefs.SetString(LS_KEY_SAVEPATH, Path.GetDirectoryName(_path));
File.WriteAllText(_path, _mapData.SaveJson());
}
private void LoadJson()
{
- var _mapData = target as Bhv_MapData;
+ var _defaultPath = EditorPrefs.GetString(LS_KEY_SAVEPATH);
+ if (string.IsNullOrEmpty(_defaultPath))
+ {
+ _defaultPath = System.Environment.CurrentDirectory;
+ }
+ var _loadPath = EditorUtility.OpenFilePanel("璇诲彇Json鏁版嵁", _defaultPath, "json");
+ if (string.IsNullOrEmpty(_loadPath))
+ {
+ return;
+ }
+
+ var _mapData = target as Bhv_MapData;
+ _mapData.Clear();
+
+ var _strJson = File.ReadAllText(_loadPath);
+ var _jsonData = LitJson.JsonMapper.ToObject(_strJson);
+
+ _mapData.LoadJson(_jsonData);
}
private void Export()
--
Gitblit v1.8.0