diff --git a/Editor/Editor.csproj b/Editor/Editor.csproj index 8d7f6304..cfaca424 100644 --- a/Editor/Editor.csproj +++ b/Editor/Editor.csproj @@ -270,6 +270,10 @@ + + + EnemyDropMinitorWindow.xaml + InputMinitorWindow.xaml @@ -857,6 +861,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Editor/Editor/Minitors/EnemyDropMinitor.cs b/Editor/Editor/Minitors/EnemyDropMinitor.cs new file mode 100644 index 00000000..3ec0352e --- /dev/null +++ b/Editor/Editor/Minitors/EnemyDropMinitor.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using WindEditor.ViewModel; +using WindEditor.Minitors.EnemyDrop; + +namespace WindEditor.Minitors +{ + public class EnemyDropMinitor : IMinitor, INotifyPropertyChanged + { + #region IMinitor Interface + public MenuItem GetMenuItem() + { + return new MenuItem() + { + Header = "Enemy Drop Editor", + ToolTip = "Editor for the items that enemies can drop upon defeat.", + Command = OpenMinitorCommand, + }; + } + + public void InitModule(WDetailsViewViewModel details_view_model) + { + + } + + public bool RequestCloseModule() + { + if (!m_IsDataDirty) + return true; + + MessageBoxResult result = MessageBox.Show("You have unsaved changes to the enemy item drop data. Save them?", "Unsaved Enemy Drop Changes", MessageBoxButton.YesNoCancel); + + switch (result) + { + case MessageBoxResult.Yes: + //OnRequestSaveMessageData(); + return true; + case MessageBoxResult.No: + return true; + case MessageBoxResult.Cancel: + return false; + default: + return true; + } + } + #endregion + + #region INotifyPropertyChanged Interface + public event PropertyChangedEventHandler PropertyChanged; + + protected void OnPropertyChanged(string propertyName) + { + if (PropertyChanged != null) + PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + #endregion + + public ICommand OpenMinitorCommand + { + get { return new RelayCommand(x => OnRequestOpenEnemyDropEditor(), x => !string.IsNullOrEmpty(WSettingsManager.GetSettings().RootDirectoryPath)); } + } + + public string WindowTitle + { + get { return m_IsDataDirty ? m_WindowTitle + "*" : m_WindowTitle; } + set + { + if (value != m_WindowTitle) + { + m_WindowTitle = value; + OnPropertyChanged("WindowTitle"); + } + } + } + + private EnemyDropMinitorWindow m_MinitorWindow; + + private string m_WindowTitle; + private bool m_IsDataDirty; + + private void OnRequestOpenEnemyDropEditor() + { + if (m_MinitorWindow != null) + { + m_MinitorWindow.Show(); + m_MinitorWindow.Focus(); + return; + } + + WindowTitle = "Enemy Item Drop Editor - " + Path.Combine(WSettingsManager.GetSettings().RootDirectoryPath, "files", "res", "ActorDat", "ActorDat.bin"); + + m_MinitorWindow = new EnemyDropMinitorWindow(); + m_MinitorWindow.DataContext = this; + m_MinitorWindow.Closing += M_MinitorWindow_Closing; + + m_MinitorWindow.Show(); + } + private void M_MinitorWindow_Closing(object sender, CancelEventArgs e) + { + e.Cancel = true; + m_MinitorWindow.Hide(); + } + + } +} diff --git a/Editor/Editor/Minitors/EnemyDropMinitor/EnemyDropMinitorWindow.xaml b/Editor/Editor/Minitors/EnemyDropMinitor/EnemyDropMinitorWindow.xaml new file mode 100644 index 00000000..d8ac8d20 --- /dev/null +++ b/Editor/Editor/Minitors/EnemyDropMinitor/EnemyDropMinitorWindow.xaml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Editor/Editor/Minitors/EnemyDropMinitor/EnemyDropMinitorWindow.xaml.cs b/Editor/Editor/Minitors/EnemyDropMinitor/EnemyDropMinitorWindow.xaml.cs new file mode 100644 index 00000000..da141487 --- /dev/null +++ b/Editor/Editor/Minitors/EnemyDropMinitor/EnemyDropMinitorWindow.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace WindEditor.Minitors.EnemyDrop +{ + /// + /// Interaction logic for EnemyDropMinitorWindow.xaml + /// + public partial class EnemyDropMinitorWindow : Window + { + public EnemyDropMinitorWindow() + { + InitializeComponent(); + } + } +}