From aab2f69f67b3b2d094eebbedff46100fddf393d9 Mon Sep 17 00:00:00 2001 From: haven1433 Date: Wed, 13 Dec 2023 10:03:10 -0600 Subject: [PATCH] add a "graphics as text" option for Overworld Objects useful for dealing with dynamic sprites, like the old man or the pokemon icon feature --- .../ViewModels/Map/IEventViewModel.cs | 26 +++++++++++++++++ src/HexManiac.WPF/Controls/MapTab.xaml | 29 ++++++++++++++----- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/HexManiac.Core/ViewModels/Map/IEventViewModel.cs b/src/HexManiac.Core/ViewModels/Map/IEventViewModel.cs index 52cd4166..4f77a9a8 100644 --- a/src/HexManiac.Core/ViewModels/Map/IEventViewModel.cs +++ b/src/HexManiac.Core/ViewModels/Map/IEventViewModel.cs @@ -444,6 +444,31 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Map { } } + private string graphicsText; + public string GraphicsText { + get { + if (graphicsText != null) return graphicsText; + graphicsText = Graphics.ToString(); + return graphicsText; + } + set { + graphicsText = value; + if (!graphicsText.TryParseInt(out var result)) return; + Graphics = result; + } + } + + private bool showGraphicsAsText; + public bool ShowGraphicsAsText { + get => showGraphicsAsText; + set { + Set(ref showGraphicsAsText, value, old => { + graphicsText = null; + NotifyPropertyChanged(nameof(GraphicsText)); + }); + } + } + /// /// FireRed Only. /// Kind is either 0 or 255. @@ -1188,6 +1213,7 @@ show: this.berries = berries; for (int i = 0; i < sprites.Count; i++) Options.Add(VisualComboOption.CreateFromSprite(i.ToString(), sprites[i].PixelData, sprites[i].PixelWidth, i, 2, true)); DefaultOW = defaultSprite; + ShowGraphicsAsText = Graphics >= Options.Count; objectEvent.Model.TryGetList("FacingOptions", out var list); FacingOptions.Update(ComboOption.Convert(list), MoveType); FacingOptions.Bind(nameof(FacingOptions.SelectedIndex), (sender, e) => MoveType = FacingOptions.ModelValue); diff --git a/src/HexManiac.WPF/Controls/MapTab.xaml b/src/HexManiac.WPF/Controls/MapTab.xaml index 27a1ea79..9fec40a0 100644 --- a/src/HexManiac.WPF/Controls/MapTab.xaml +++ b/src/HexManiac.WPF/Controls/MapTab.xaml @@ -307,15 +307,30 @@ + - - - - - - - + + + + + + + + + + + + + +