From f46aa42023bfffad6209e7015d45ec334369e2a0 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期一, 08 四月 2019 21:08:01 +0800
Subject: [PATCH] 382 地图编辑器json存储逻辑
---
Core/MapEditor/Editor/MapEditor.cs | 47 +++++++++--------------------------------------
1 files changed, 9 insertions(+), 38 deletions(-)
diff --git a/Core/MapEditor/Editor/MapEditor.cs b/Core/MapEditor/Editor/MapEditor.cs
index 94e5b7e..965aa2b 100644
--- a/Core/MapEditor/Editor/MapEditor.cs
+++ b/Core/MapEditor/Editor/MapEditor.cs
@@ -328,47 +328,18 @@
private void SaveJson()
{
var _mapData = target as Bhv_MapData;
- // string _defaultPath = EditorPrefs.GetString(LS_KEY_SAVEPATH, System.Environment.CurrentDirectory);
- // string _path = EditorUtility.SaveFilePanel("淇濆瓨鏁版嵁", _defaultPath, "map_" + _mapData.id, "ed");
- // if (string.IsNullOrEmpty(_path))
- // {
- // return;
- // }
-
- // LitJson.JsonMapper.RegisterExporter<System.Type>((v, w) =>
- // {
- // w.Write(v.FullName);
- // });
-
- // LitJson.JsonMapper.RegisterImporter<string, System.Type>((s) =>
- // {
- // return System.Type.GetType(s);
- // });
-
- // System.Action<Vector3, LitJson.JsonWriter> writeVector3 = (v, w) =>
- // {
- // w.WriteObjectStart();
- // w.WritePropertyName("x");
- // w.Write((float)v.x);
- // w.WritePropertyName("y");
- // w.Write((float)v.y);
- // w.WritePropertyName("z");
- // w.Write((float)v.z);
- // w.WriteObjectEnd();
- // };
-
- // LitJson.JsonMapper.RegisterExporter<Vector3>((v, w) =>
- // {
- // writeVector3(v, w);
- // });
- // LitJson.UnityTypeBindings.Register();
-
- // var _json = LitJson.JsonMapper.ToJson(_mapData);
- Debug.Log(_mapData.SaveJson());
+ string _defaultPath = EditorPrefs.GetString(LS_KEY_SAVEPATH, System.Environment.CurrentDirectory);
+ string _path = EditorUtility.SaveFilePanel("淇濆瓨鏁版嵁", _defaultPath, "map_" + _mapData.id, "json");
+ if (string.IsNullOrEmpty(_path))
+ {
+ return;
+ }
+ File.WriteAllText(_path, _mapData.SaveJson());
}
- private class _JsonWritter : LitJson.JsonWriter
+ private void LoadJson()
{
+ var _mapData = target as Bhv_MapData;
}
--
Gitblit v1.8.0