| | |
| | | { |
| | | MapData.LoadFormFile(10010); |
| | | } |
| | | // if (GUILayout.Button("保存1", gUISkin.button, GUILayout.Width(60), GUILayout.Height(22))) |
| | | // { |
| | | // SaveJson(); |
| | | // } |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | /// -------------------------------------------------------------------------------- |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | // } |
| | | var _jsonData = JsonUtility.ToJson(_mapData); |
| | | Debug.Log(_jsonData); |
| | | } |
| | | |
| | | private void Export() |
| | | { |
| | | var _mapData = target as Bhv_MapData; |
| | |
| | | } |
| | | using (var _fileStream = File.OpenWrite(_path)) |
| | | { |
| | | using (var _binaryWriter = new BinaryWriter(_fileStream)) |
| | | using (var _binaryWriter = new BinaryWriter(_fileStream, System.Text.Encoding.UTF8)) |
| | | { |
| | | _mapData.Export(_binaryWriter); |
| | | EditorPrefs.SetString(LS_KEY_EXPORTPATH, Directory.GetParent(_path).FullName); |
| | |
| | | |
| | | using (var _fileStream = File.OpenRead(_path)) |
| | | { |
| | | using (var _binaryReader = new BinaryReader(_fileStream)) |
| | | using (var _binaryReader = new BinaryReader(_fileStream, System.Text.Encoding.UTF8)) |
| | | { |
| | | _mapData.Load(_binaryReader); |
| | | EditorPrefs.SetString(LS_KEY_SAVEPATH, Directory.GetParent(_path).FullName); |
| | | |
| | | |
| | | foreach (var _event in _mapData.eventList) |
| | | { |