From fca7e4d94ae48f858cee6dc1cbdd72c04e77a889 Mon Sep 17 00:00:00 2001 From: lastbattle <4586194+lastbattle@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:36:18 +0800 Subject: [PATCH] [HaCreator] quest editor: exclude chaos update related items from quest act and checks (disabled in UI) --- HaCreator/GUI/Quest/QuestEditor.xaml | 107 +++++++++++++++--- .../GUI/Quest/QuestEditorActInfoModel.cs | 19 ++++ .../Quest/QuestEditorActInfoRewardModel.cs | 19 ++++ .../MultiBooleanToVisibility2Converter.cs | 41 +++++++ .../MultiBooleanToVisibilityConverter.cs | 41 +++++++ 5 files changed, 213 insertions(+), 14 deletions(-) create mode 100644 HaSharedLibrary/Converter/MultiBooleanToVisibility2Converter.cs create mode 100644 HaSharedLibrary/Converter/MultiBooleanToVisibilityConverter.cs diff --git a/HaCreator/GUI/Quest/QuestEditor.xaml b/HaCreator/GUI/Quest/QuestEditor.xaml index 69c7283c..a7fa48aa 100644 --- a/HaCreator/GUI/Quest/QuestEditor.xaml +++ b/HaCreator/GUI/Quest/QuestEditor.xaml @@ -18,6 +18,7 @@ + @@ -417,57 +418,93 @@ - + + + - + + + - + + + - + + + - + + + - + + + @@ -1126,8 +1163,13 @@ - + + + + + + + - + + + - + + + - + + + - + + + - + + + - + + + @@ -2814,6 +2892,7 @@ diff --git a/HaCreator/GUI/Quest/QuestEditorActInfoModel.cs b/HaCreator/GUI/Quest/QuestEditorActInfoModel.cs index 19639d37..ba7c5cc6 100644 --- a/HaCreator/GUI/Quest/QuestEditorActInfoModel.cs +++ b/HaCreator/GUI/Quest/QuestEditorActInfoModel.cs @@ -243,6 +243,25 @@ private set } } + #region Misc + /// + /// Before big-bang update + /// + public bool IsPreBBDataWzFormat + { + get { return Program.WzManager.IsPreBBDataWzFormat; } + private set { } + } + /// + /// After big-bang update + /// + public bool IsPostBBDataWzFormat + { + get { return !Program.WzManager.IsPreBBDataWzFormat; } + private set { } + } + #endregion + #region Events /// /// On act conversation collection changed diff --git a/HaCreator/GUI/Quest/QuestEditorActInfoRewardModel.cs b/HaCreator/GUI/Quest/QuestEditorActInfoRewardModel.cs index 9c3abd7a..3d56a52a 100644 --- a/HaCreator/GUI/Quest/QuestEditorActInfoRewardModel.cs +++ b/HaCreator/GUI/Quest/QuestEditorActInfoRewardModel.cs @@ -184,6 +184,25 @@ public bool IsEquip private set { } } + #region Misc + /// + /// Before big-bang update + /// + public bool IsPreBBDataWzFormat + { + get { return Program.WzManager.IsPreBBDataWzFormat; } + private set { } + } + /// + /// After big-bang update + /// + public bool IsPostBBDataWzFormat + { + get { return !Program.WzManager.IsPreBBDataWzFormat; } + private set { } + } + #endregion + #region Property Changed Event public event PropertyChangedEventHandler PropertyChanged; diff --git a/HaSharedLibrary/Converter/MultiBooleanToVisibility2Converter.cs b/HaSharedLibrary/Converter/MultiBooleanToVisibility2Converter.cs new file mode 100644 index 00000000..28256f8c --- /dev/null +++ b/HaSharedLibrary/Converter/MultiBooleanToVisibility2Converter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows; + +namespace HaSharedLibrary.Converter +{ + /// + /// All must be true to be visible. + /// + public class MultiBooleanToVisibility2Converter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (values == null || values.Any(v => v == DependencyProperty.UnsetValue)) + return Visibility.Collapsed; + + // Check if all values are boolean and true + bool visible = values.All(v => v is bool && (bool)v); + + // Invert logic if parameter is provided and true + if (parameter is bool invertLogic && invertLogic) + { + /* + true + */ + visible = !visible; + } + + return visible ? Visibility.Visible : Visibility.Collapsed; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/HaSharedLibrary/Converter/MultiBooleanToVisibilityConverter.cs b/HaSharedLibrary/Converter/MultiBooleanToVisibilityConverter.cs new file mode 100644 index 00000000..fef95c00 --- /dev/null +++ b/HaSharedLibrary/Converter/MultiBooleanToVisibilityConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows; + +namespace HaSharedLibrary.Converter +{ + /// + /// All must be false to be visible. + /// + public class MultiBooleanToVisibilityConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (values == null || values.Any(v => v == DependencyProperty.UnsetValue)) + return Visibility.Collapsed; + + // Check if all values are boolean and true + bool visible = values.All(v => v is bool && (bool)v); + + // Invert logic if parameter is provided and true + if (parameter is bool invertLogic && invertLogic) + { + /* + * true + * */ + visible = !visible; + } + + return visible ? Visibility.Collapsed : Visibility.Visible; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file