From c90d2b1e468e24872d2d9661f055ec0599221d0f Mon Sep 17 00:00:00 2001 From: LastBattle Date: Thu, 10 Dec 2020 18:57:38 +0800 Subject: [PATCH] [HaRepacker] Use text editor for WzStringProperty ending with '.json' --- HaCreator/MapEditor/Board.cs | 2 +- HaCreator/MapEditor/MultiBoard.xaml.cs | 4 ++-- HaRepacker/GUI/Panels/MainPanel.xaml.cs | 14 ++++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/HaCreator/MapEditor/Board.cs b/HaCreator/MapEditor/Board.cs index 8d92e2f2..54914fd3 100644 --- a/HaCreator/MapEditor/Board.cs +++ b/HaCreator/MapEditor/Board.cs @@ -218,7 +218,7 @@ public void RenderBoard(SpriteBatch sprite) } } - public void CreateLayers() + public void CreateMapLayers() { for (int i = 0; i <= MapConstants.MaxMapLayers; i++) { diff --git a/HaCreator/MapEditor/MultiBoard.xaml.cs b/HaCreator/MapEditor/MultiBoard.xaml.cs index 4760654b..4d5740af 100644 --- a/HaCreator/MapEditor/MultiBoard.xaml.cs +++ b/HaCreator/MapEditor/MultiBoard.xaml.cs @@ -244,7 +244,7 @@ public Board CreateBoard(Microsoft.Xna.Framework.Point mapSize, Point centerPoin { Board newBoard = new Board(mapSize, centerPoint, this, menu, ApplicationSettings.theoreticalVisibleTypes, ApplicationSettings.theoreticalEditedTypes); boards.Add(newBoard); - newBoard.CreateLayers(); + newBoard.CreateMapLayers(); return newBoard; } } @@ -254,7 +254,7 @@ public Board CreateHiddenBoard(Point mapSize, Point centerPoint) lock (this) { Board newBoard = new Board(mapSize, centerPoint, this, null, ItemTypes.None, ItemTypes.None); - newBoard.CreateLayers(); + newBoard.CreateMapLayers(); return newBoard; } } diff --git a/HaRepacker/GUI/Panels/MainPanel.xaml.cs b/HaRepacker/GUI/Panels/MainPanel.xaml.cs index e85605b9..9ce9dc14 100644 --- a/HaRepacker/GUI/Panels/MainPanel.xaml.cs +++ b/HaRepacker/GUI/Panels/MainPanel.xaml.cs @@ -814,16 +814,16 @@ private void TextEditor_SaveButtonClicked(object sender, EventArgs e) } else if (obj is WzStringProperty stringProp) { - if (stringProp.IsSpineAtlasResources) - { + //if (stringProp.IsSpineAtlasResources) + // { string setText = textEditor.textEditor.Text; stringProp.Value = setText; - } + /* } else { throw new NotSupportedException("Usage of TextEditor for non-spine WzStringProperty."); - } + }*/ } } @@ -1460,6 +1460,12 @@ private void ShowObjectValue(WzObject obj) thread.Start(); thread.Join(); } + else if (stringObj.Name.EndsWith(".json")) // Map001.wz/Back/BM3_3.img/spine/skeleton.json + { + textEditor.Visibility = Visibility.Visible; + textEditor.SetHighlightingDefinitionIndex(20); // json + textEditor.textEditor.Text = obj.ToString(); + } else { // Value