From ec4d7183116ac653c5bbf1480af22cd5ed8dbfb5 Mon Sep 17 00:00:00 2001 From: uduki Date: Tue, 20 Oct 2026 10:54:53 +0900 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E5=8F=B3=E5=81=B4=E8=A9=B3?= =?UTF-8?q?=E7=B4=B0=E3=83=91=E3=83=8D=E3=83=AB=E3=81=AE=E3=82=B7=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AB=E5=8C=96=E3=81=A8=E3=82=B9=E3=82=AF=E3=83=AA?= =?UTF-8?q?=E3=83=97=E3=83=88=E6=94=B9=E9=80=A0=E4=B8=8D=E5=8F=AF=E6=99=82?= =?UTF-8?q?=E3=81=AE=E9=A0=85=E7=9B=AE=E9=9D=9E=E8=A1=A8=E7=A4=BA=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engines/Tkool/TkoolGameItem.cs | 53 ++++++++++++++++++++++++++++++++-- Helpers/Converters.cs | 18 ++++++++++++ MainWindow.xaml | 35 ++++------------------ Models/GameItemBase.cs | 6 ++++ 4 files changed, 81 insertions(+), 31 deletions(-) diff --git a/Engines/Tkool/TkoolGameItem.cs b/Engines/Tkool/TkoolGameItem.cs index e518366..07a5597 100644 --- a/Engines/Tkool/TkoolGameItem.cs +++ b/Engines/Tkool/TkoolGameItem.cs @@ -148,6 +148,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.EvbExtractedVisibility)); this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText)); this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); this.OnPropertyChanged(nameof(this.IsEvbToolMissing)); } } @@ -170,6 +171,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.EvbExtractedVisibility)); this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText)); this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } @@ -192,7 +194,8 @@ namespace GameLauncher.Engines.Tkool public string EvbUnderlyingEngine { get => this._evbUnderlyingEngine; - set { if (this._evbUnderlyingEngine != value) { this._evbUnderlyingEngine = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); } } + set { if (this._evbUnderlyingEngine != value) { this._evbUnderlyingEngine = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } /// EVB として扱うか(UI バッジ判定用) @@ -310,7 +313,7 @@ namespace GameLauncher.Engines.Tkool public string PluginsJsPath { get => this._pluginsJsPath; - set { if (this._pluginsJsPath != value) { this._pluginsJsPath = value; this.OnPropertyChanged(); } } + set { if (this._pluginsJsPath != value) { this._pluginsJsPath = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } public string PluginsDirPath @@ -330,6 +333,46 @@ namespace GameLauncher.Engines.Tkool public override bool IsNwjs => this.EngineType == TkoolEngineType.Nwjs; public override bool IsOther => this.EngineType == TkoolEngineType.Other; + /// + /// スクリプト改造(プラグイン注入など)が適用可能な状態かどうか。 + /// 該当ゲームが改造非対応(ウディタ・SRPG・NW.js・その他・未解凍状態など)の場合は false を返します。 + /// + public override bool CanApplyScriptMod + { + get + { + if (this.IsWolf || this.IsNwjs || this.IsSrpgStudio || this.IsOther) + { + return false; + } + if (this.IsEvbPacked && !this.IsEvbExtracted) + { + return false; + } + if (this.IsAsar && !this.IsAsarExtracted) + { + return false; + } + if (this.IsStandaloneExePackage && (string.IsNullOrEmpty(this.PluginsJsPath) || !File.Exists(this.PluginsJsPath))) + { + return false; + } + if (this.IsRgss) + { + if (this.HasRgssArchive && !this.IsRgssExtracted) + { + return false; + } + return !string.IsNullOrEmpty(this.PluginsJsPath) && File.Exists(this.PluginsJsPath); + } + if (this.IsMV || this.IsMZ || this.IsTyrano) + { + return !string.IsNullOrEmpty(this.PluginsJsPath) && File.Exists(this.PluginsJsPath); + } + return false; + } + } + /// /// エンジン種別ラベルの表示文字列。該当エンジンが無い場合は空文字を返し、ラベル自体を非表示にします。 /// @@ -454,6 +497,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.RgssBadgeText)); this.OnPropertyChanged(nameof(this.RgssBadgeBackground)); this.OnPropertyChanged(nameof(this.RgssDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } @@ -470,6 +514,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.RgssBadgeText)); this.OnPropertyChanged(nameof(this.RgssBadgeBackground)); this.OnPropertyChanged(nameof(this.RgssDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } @@ -507,6 +552,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.EngineDisplayName)); this.OnPropertyChanged(nameof(this.EngineLabelText)); this.OnPropertyChanged(nameof(this.EngineLabelBackground)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); this.OnPropertyChanged(nameof(this.IsMV)); this.OnPropertyChanged(nameof(this.IsMZ)); this.OnPropertyChanged(nameof(this.IsTyrano)); @@ -532,6 +578,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.RgssBadgeText)); this.OnPropertyChanged(nameof(this.RgssBadgeBackground)); this.OnPropertyChanged(nameof(this.RgssDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } @@ -679,6 +726,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.AsarBadgeText)); this.OnPropertyChanged(nameof(this.AsarBadgeBackground)); this.OnPropertyChanged(nameof(this.AsarDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } @@ -695,6 +743,7 @@ namespace GameLauncher.Engines.Tkool this.OnPropertyChanged(nameof(this.AsarBadgeText)); this.OnPropertyChanged(nameof(this.AsarBadgeBackground)); this.OnPropertyChanged(nameof(this.AsarDetailStatusText)); + this.OnPropertyChanged(nameof(this.CanApplyScriptMod)); } } } diff --git a/Helpers/Converters.cs b/Helpers/Converters.cs index ad34342..a8696a5 100644 --- a/Helpers/Converters.cs +++ b/Helpers/Converters.cs @@ -130,4 +130,22 @@ namespace GameLauncher.Helpers throw new NotImplementedException(); } } + + /// + /// bool値が true の場合に Visible、false または null の場合に Collapsed を返すコンバーター + /// + public class BooleanToVisibilityConverter : IValueConverter + { + public static readonly BooleanToVisibilityConverter Instance = new(); + + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + return value is true ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + return value is Visibility v && v == Visibility.Visible; + } + } } diff --git a/MainWindow.xaml b/MainWindow.xaml index ec93cd1..5988a23 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -869,20 +869,8 @@ +