diff --git a/NotifyEx/Models/HpNotifier.cs b/NotifyEx/Models/HpNotifier.cs index b29bc71..33e1e2a 100644 --- a/NotifyEx/Models/HpNotifier.cs +++ b/NotifyEx/Models/HpNotifier.cs @@ -9,82 +9,71 @@ using NotifyEx.Properties; using System.Reactive.Linq; using Grabacr07.KanColleWrapper.Models; +using NotifyEx.Models.NotifyType; namespace NotifyEx.Models { - /// - /// 大破通知 - /// - class HpNotifier : NotificationObject - { - private static readonly Settings Settings = Settings.Default; + /// + /// 大破通知 + /// + internal class HpNotifier + { + private static readonly Settings Settings = Settings.Default; - private readonly Plugin _plugin; + public bool Enabled + { + get { return Settings.EnabledLowHpNotifier; } + set + { + if (Settings.EnabledLowHpNotifier != value) + { + Settings.EnabledLowHpNotifier = value; + Settings.Save(); + } + } + } - public bool Enabled - { - get { return Settings.EnabledLowHpNotifier; } - set - { - if (Settings.EnabledLowHpNotifier != value) - { - Settings.EnabledLowHpNotifier = value; - Settings.Save(); - RaisePropertyChanged(); - } - } - } + /// + /// 是否显示装备损管的舰娘 + /// + public bool EnabledShowDamageControl + { + get { return Settings.EnabledShowDamageControl; } + set + { + if (Settings.EnabledShowDamageControl != value) + { + Settings.EnabledShowDamageControl = value; + Settings.Save(); + } + } + } - /// - /// 是否显示装备损管的舰娘 - /// - public bool EnabledShowDamageControl - { - get { return Settings.EnabledShowDamageControl; } - set - { - if (Settings.EnabledShowDamageControl != value) - { - Settings.EnabledShowDamageControl = value; - Settings.Save(); - RaisePropertyChanged(); - } - } - } + public HpNotifier() + { + var host = NotifyHost.Current; + host.Register("/kcsapi/api_req_map/start", WarningType.Instance, s => this.CheckSituation()); + host.Register("/kcsapi/api_req_map/next", WarningType.Instance, s => this.CheckSituation()); + } - public HpNotifier(Plugin plugin) - { - _plugin = plugin; + private string CheckSituation() + { + if (!Enabled) return null; - var proxy = KanColleClient.Current.Proxy; + var fleets = KanColleClient.Current.Homeport.Organization.Fleets.Values.Where(fleet => fleet.IsInSortie); - proxy.api_req_map_start - .Subscribe(x => CheckSituation()); + var lowHpList = (from fleet in fleets + let ships = fleet.Ships + from ship in ships + where !(ship.Situation.HasFlag(ShipSituation.Tow) || ship.Situation.HasFlag(ShipSituation.Evacuation)) + && ship.Situation.HasFlag(ShipSituation.HeavilyDamaged) + && (EnabledShowDamageControl || !ship.Situation.HasFlag(ShipSituation.DamageControlled)) + group ship.Info.Name + (ship.Situation.HasFlag(ShipSituation.DamageControlled) ? "(损管)" : "") by fleet.Name + ).ToArray(); - proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_map/next") - .Subscribe(x => CheckSituation()); - } + if (lowHpList.Length == 0) return null; - private void CheckSituation() - { - if (!Enabled) return; - - var fleets = KanColleClient.Current.Homeport.Organization.Fleets.Values.Where(fleet => fleet.IsInSortie); - - var lowHpList = (from fleet in fleets - let ships = fleet.Ships - from ship in ships - where !(ship.Situation.HasFlag(ShipSituation.Tow) || ship.Situation.HasFlag(ShipSituation.Evacuation)) - && ship.Situation.HasFlag(ShipSituation.HeavilyDamaged) - && (EnabledShowDamageControl || !ship.Situation.HasFlag(ShipSituation.DamageControlled)) - group ship.Info.Name + (ship.Situation.HasFlag(ShipSituation.DamageControlled) ? "(损管)" : "") by fleet.Name - ).ToArray(); - - if (lowHpList.Any()) - { - var info = string.Join(", ", lowHpList.Select(fleet => $"{fleet.Key} {string.Join(" ", fleet)}")) + " 大破!"; - _plugin.Notify("HpNotify", "大破警告", info); - } - } - } + return string.Join(", ", lowHpList.Select(fleet => $"{fleet.Key} {string.Join(" ", fleet)}")) + " 大破!"; + } + } } diff --git a/NotifyEx/Models/NotifyHost.cs b/NotifyEx/Models/NotifyHost.cs new file mode 100644 index 0000000..bb040fb --- /dev/null +++ b/NotifyEx/Models/NotifyHost.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Linq; +using System.Text; +using System.Threading.Tasks; +using Grabacr07.KanColleWrapper; +using Nekoxy; +using NotifyEx.Models.NotifyType; + +namespace NotifyEx.Models +{ + public class NotifyHost + { + public static NotifyHost Current { get; internal set; } + + internal static void TryInitialize(Plugin notifier) + { + if (Current == null) Current = new NotifyHost(notifier); + } + + + private readonly Plugin _notifier; + + private NotifyHost(Plugin notifier) + { + this._notifier = notifier; + } + + + #region kcapi Notify + + #region NotifyTypeKey + + private class NotifyTypeKey : IEquatable + { + internal string Uri { get; } + internal INotifyType Type { get; } + + internal NotifyTypeKey(string uri, INotifyType type) + { + this.Uri = uri; + this.Type = type; + } + + public bool Equals(NotifyTypeKey other) + { + return this.Uri == other.Uri && this.Type.Equals(other.Type); + } + + public override bool Equals(object obj) + { + var nk = obj as NotifyTypeKey; + return nk?.Equals(this) ?? false; + } + + public override int GetHashCode() + { + unchecked + { + return ((Uri?.GetHashCode() ?? 0) * 397) ^ (Type?.GetHashCode() ?? 0); + } + } + } + + #endregion + + private readonly Dictionary> _notifyProviders = new Dictionary>(); + + /// + /// 注册通知操作 + /// + /// 监视的API + /// 通知类型 + /// return null => 不进行通知 + public void Register(string kcapi, INotifyType type, Func notifyProvider) + { + var key = new NotifyTypeKey(kcapi, type); + + Func action; + if (this._notifyProviders.TryGetValue(key, out action)) + { + action += notifyProvider; + this._notifyProviders[key] = action; + } + else + { + this._notifyProviders.Add(key, notifyProvider); + + KanColleClient.Current.Proxy.ApiSessionSource + .Where(s => s.Request.PathAndQuery == kcapi) + .Subscribe(s => this.Notify(s, key)); + } + } + + private void Notify(Session session, NotifyTypeKey key) + { + var action = this._notifyProviders[key]; + var notifications = action.GetInvocationList() + .Select(f => ((Func)f)(session)) + .Where(x => !string.IsNullOrEmpty(x)); + + this._notifier.Notify(key.Uri, key.Type.Name, string.Join(Environment.NewLine, notifications)); + } + + #endregion + + + public void Notify(string type, string header, string body) + { + this._notifier.Notify(type, header, body); + } + } +} diff --git a/NotifyEx/Models/NotifyType/INotifyType.cs b/NotifyEx/Models/NotifyType/INotifyType.cs new file mode 100644 index 0000000..3951caa --- /dev/null +++ b/NotifyEx/Models/NotifyType/INotifyType.cs @@ -0,0 +1,7 @@ +namespace NotifyEx.Models.NotifyType +{ + public interface INotifyType + { + string Name { get; } + } +} diff --git a/NotifyEx/Models/NotifyType/WarningType.cs b/NotifyEx/Models/NotifyType/WarningType.cs new file mode 100644 index 0000000..13335e8 --- /dev/null +++ b/NotifyEx/Models/NotifyType/WarningType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NotifyEx.Models.NotifyType +{ + public sealed class WarningType : INotifyType + { + public static WarningType Instance { get; } = new WarningType(); + + private WarningType() {} + + public string Name { get; } = "警告"; + } +} diff --git a/NotifyEx/Models/ShipNotifier.cs b/NotifyEx/Models/ShipNotifier.cs index 30c0c05..64b5814 100644 --- a/NotifyEx/Models/ShipNotifier.cs +++ b/NotifyEx/Models/ShipNotifier.cs @@ -6,66 +6,61 @@ using System.Threading.Tasks; using Grabacr07.KanColleWrapper; using Livet; +using NotifyEx.Models.NotifyType; using NotifyEx.Properties; namespace NotifyEx.Models { - /// - /// 船位不足通知 - /// - class ShipNotifier : NotificationObject - { - private static readonly Settings Settings = Settings.Default; + /// + /// 船位不足通知 + /// + internal class ShipNotifier + { + private static readonly Settings Settings = Settings.Default; - private readonly Plugin _plugin; + public bool Enabled + { + get { return Settings.EnabledShipNotifier; } + set + { + if (Settings.EnabledShipNotifier != value) + { + Settings.EnabledShipNotifier = value; + Settings.Save(); + } + } + } - public bool Enabled - { - get { return Settings.EnabledShipNotifier; } - set - { - if (Settings.EnabledShipNotifier != value) - { - Settings.EnabledShipNotifier = value; - Settings.Save(); - RaisePropertyChanged(); - } - } - } + public uint WarningCount + { + get { return Settings.WarningShipCount; } + set + { + if (Settings.WarningShipCount != value) + { + Settings.WarningShipCount = value; + Settings.Save(); + } + } + } - public uint WarningCount - { - get { return Settings.WarningShipCount; } - set - { - if (Settings.WarningShipCount != value) - { - Settings.WarningShipCount = value; - Settings.Save(); - RaisePropertyChanged(); - } - } - } + public ShipNotifier() + { + NotifyHost.Current.Register("/kcsapi/api_get_member/mapinfo", WarningType.Instance, s => CheckReminding()); + } - public ShipNotifier(Plugin plugin) - { - _plugin = plugin; + private string CheckReminding() + { + if (!Enabled) return null; - var proxy = KanColleClient.Current.Proxy; - proxy.ApiSessionSource.Where(s => s.Request.PathAndQuery.StartsWith("/kcsapi/api_get_member/mapinfo")) - .Subscribe(x => CheckReminding()); - } + var port = KanColleClient.Current.Homeport; + var maxShipCount = port.Admiral.MaxShipCount; + var currentShipCount = port.Organization.Ships.Count; + var reminding = maxShipCount - currentShipCount; - private void CheckReminding() - { - if (!Enabled) return; - - var port = KanColleClient.Current.Homeport; - var maxShipCount = port.Admiral.MaxShipCount; - var currentShipCount = port.Organization.Ships.Count; - var reminding = maxShipCount - currentShipCount; - if (reminding <= WarningCount) - _plugin.Notify("ShipNotify", "母港空位警告", $"母港仅剩余 {reminding} 空位"); - } - } + if (reminding > WarningCount) return null; + + return $"母港仅剩余 {reminding} 空位"; + } + } } diff --git a/NotifyEx/Models/SlotNotifier.cs b/NotifyEx/Models/SlotNotifier.cs index 1bf04ae..23210be 100644 --- a/NotifyEx/Models/SlotNotifier.cs +++ b/NotifyEx/Models/SlotNotifier.cs @@ -6,65 +6,58 @@ using System.Threading.Tasks; using Grabacr07.KanColleWrapper; using Livet; +using NotifyEx.Models.NotifyType; using NotifyEx.Properties; namespace NotifyEx.Models { - public class SlotNotifier : NotificationObject - { - private static readonly Settings Settings = Settings.Default; - - private readonly Plugin _plugin; - - public bool Enabled - { - get { return Settings.EnabledSlotNotifier; } - set - { - if (Settings.EnabledSlotNotifier != value) - { - Settings.EnabledSlotNotifier = value; - Settings.Save(); - RaisePropertyChanged(); - } - } - } - - public uint WarningCount - { - get { return Settings.WarningSlotCount; } - set - { - if (Settings.WarningSlotCount != value) - { - Settings.WarningSlotCount = value; - Settings.Save(); - RaisePropertyChanged(); - } - } - } - - public SlotNotifier(Plugin plugin) - { - _plugin = plugin; - - var proxy = KanColleClient.Current.Proxy; - proxy.ApiSessionSource.Where(s => s.Request.PathAndQuery.StartsWith("/kcsapi/api_get_member/mapinfo")) - .Subscribe(x => CheckReminding()); - } - - private void CheckReminding() - { - if (!Enabled) return; - - var port = KanColleClient.Current.Homeport; - var max = port.Admiral.MaxSlotItemCount; - var current = port.Itemyard.SlotItemsCount; - var reminding = max - current; - if (reminding <= WarningCount) - { - _plugin.Notify("SlotNotify", "装备空位警告", $"装备仅剩余 {reminding} 空位"); - } - } - } + internal class SlotNotifier + { + private static readonly Settings Settings = Settings.Default; + + public bool Enabled + { + get { return Settings.EnabledSlotNotifier; } + set + { + if (Settings.EnabledSlotNotifier != value) + { + Settings.EnabledSlotNotifier = value; + Settings.Save(); + } + } + } + + public uint WarningCount + { + get { return Settings.WarningSlotCount; } + set + { + if (Settings.WarningSlotCount != value) + { + Settings.WarningSlotCount = value; + Settings.Save(); + } + } + } + + public SlotNotifier() + { + NotifyHost.Current.Register("/kcsapi/api_get_member/mapinfo", WarningType.Instance, s => this.CheckReminding()); + } + + private string CheckReminding() + { + if (!Enabled) return null; + + var port = KanColleClient.Current.Homeport; + var max = port.Admiral.MaxSlotItemCount; + var current = port.Itemyard.SlotItemsCount; + var reminding = max - current; + + if (reminding > WarningCount) return null; + + return $"装备仅剩余 {reminding} 空位"; + } + } } diff --git a/NotifyEx/Models/SupplyNotifier.cs b/NotifyEx/Models/SupplyNotifier.cs index 90d6d97..7507536 100644 --- a/NotifyEx/Models/SupplyNotifier.cs +++ b/NotifyEx/Models/SupplyNotifier.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Grabacr07.KanColleWrapper; using Grabacr07.KanColleWrapper.Models; +using NotifyEx.Models.NotifyType; using NotifyEx.Properties; namespace NotifyEx.Models @@ -13,12 +14,10 @@ namespace NotifyEx.Models /// /// 补给通知 /// - public class SupplyNotifier + internal class SupplyNotifier { private static readonly Settings Settings = Settings.Default; - private readonly Plugin _plugin; - public bool Enabled { get { return Settings.EnabledSupplyNotifier; } @@ -72,47 +71,44 @@ public bool EnabledExpendition } - internal SupplyNotifier(Plugin plugin) + internal SupplyNotifier() { - _plugin = plugin; - - var proxy = KanColleClient.Current.Proxy; - - proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_get_member/mapinfo") - .Subscribe(x => CheckSortie()); + var host = NotifyHost.Current; + var type = WarningType.Instance; + host.Register("/kcsapi/api_get_member/mapinfo", type, s => this.CheckSortie()); + host.Register("/kcsapi/api_get_member/practice", type, s => this.CheckExercise()); + host.Register("/kcsapi/api_get_member/get_practice_enemyinfo", type, s => this.CheckExercise()); + host.Register("/kcsapi/api_get_member/mission", type, s => this.CheckExpendition()); + } - proxy.ApiSessionSource.Where( - x => - x.Request.PathAndQuery == "/kcsapi/api_get_member/practice" || - x.Request.PathAndQuery == "/kcsapi/api_get_member/get_practice_enemyinfo") - .Subscribe(x => CheckExercise()); + private string CheckSortie() + { + if (!(Enabled && EnabledSortie)) return null; - proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_get_member/mission") - .Subscribe(x => CheckExpendition()); + return this.GetNotificationMsg(false); } - private void CheckSortie() + private string CheckExercise() { - if (!(Enabled && EnabledSortie)) return; + if (!(Enabled && EnabledExercise)) return null; - var lackSupplyFleets = GetLackSupplyFleets(false); - Notify(lackSupplyFleets); + return this.GetNotificationMsg(false); } - private void CheckExercise() + private string CheckExpendition() { - if (!(Enabled && EnabledExercise)) return; + if (!(Enabled && EnabledExpendition)) return null; - var lackSupplyFleets = GetLackSupplyFleets(false); - Notify(lackSupplyFleets); + return this.GetNotificationMsg(true); } - private void CheckExpendition() + + private string GetNotificationMsg(bool isExpendition) { - if (!(Enabled && EnabledExpendition)) return; + var fleets = this.GetLackSupplyFleets(isExpendition); - var lackSupplyFleets = GetLackSupplyFleets(true); - Notify(lackSupplyFleets); + if (fleets.Length == 0) return null; + return string.Join(", ", fleets.Select(f => f.Name)) + " 补给不足!"; } private Fleet[] GetLackSupplyFleets(bool isExpendition) @@ -120,15 +116,9 @@ private Fleet[] GetLackSupplyFleets(bool isExpendition) var fleets = KanColleClient.Current.Homeport.Organization.Fleets.Values; if (isExpendition) fleets = fleets.Skip(1); - return fleets.Where(f => f.State.Situation != FleetSituation.Expedition && !f.State.IsReady).ToArray(); - } - - private void Notify(Fleet[] lackSupplyFleets) - { - if (lackSupplyFleets.Length == 0) return; - - var info = string.Join(", ", lackSupplyFleets.Select(f => f.Name)) + " 补给不足!"; - _plugin.Notify("SupplyNotify", "补给不足", info); + return fleets.Where(f => f.State.Situation != FleetSituation.Expedition && + f.Ships.Any(s => s.Fuel.Current < s.Fuel.Maximum || s.Bull.Current < s.Bull.Maximum)) + .ToArray(); } } } diff --git a/NotifyEx/NotifyEx.csproj b/NotifyEx/NotifyEx.csproj index dfc1240..5f5e20d 100644 --- a/NotifyEx/NotifyEx.csproj +++ b/NotifyEx/NotifyEx.csproj @@ -143,6 +143,9 @@ + + + diff --git a/NotifyEx/Plugin.cs b/NotifyEx/Plugin.cs index 41f89d1..2906df3 100644 --- a/NotifyEx/Plugin.cs +++ b/NotifyEx/Plugin.cs @@ -20,7 +20,7 @@ namespace NotifyEx [ExportMetadata("Guid", "3190E362-3833-4953-87C3-B2C22C058EE8")] [ExportMetadata("Title", "NotifyEx")] [ExportMetadata("Description", "通知内容扩展")] - [ExportMetadata("Version", "0.4.0")] + [ExportMetadata("Version", "0.5.0")] [ExportMetadata("Author", "@Yoctillion")] public class Plugin : IPlugin, ISettings, IRequestNotify { @@ -28,8 +28,10 @@ public class Plugin : IPlugin, ISettings, IRequestNotify public void Initialize() { + NotifyHost.TryInitialize(this); + Settings.Default.Reload(); - _viewModel = new ToolViewModel(this); + _viewModel = new ToolViewModel(); } public string Name => "NotifyEx"; diff --git a/NotifyEx/Properties/AssemblyInfo.cs b/NotifyEx/Properties/AssemblyInfo.cs index b329a31..6708a96 100644 --- a/NotifyEx/Properties/AssemblyInfo.cs +++ b/NotifyEx/Properties/AssemblyInfo.cs @@ -51,4 +51,4 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.4.0")] +[assembly: AssemblyVersion("0.5.0")] diff --git a/NotifyEx/ViewModels/ToolViewModel.cs b/NotifyEx/ViewModels/ToolViewModel.cs index e784de4..27beb11 100644 --- a/NotifyEx/ViewModels/ToolViewModel.cs +++ b/NotifyEx/ViewModels/ToolViewModel.cs @@ -8,103 +8,103 @@ namespace NotifyEx.ViewModels { - public class ToolViewModel : ViewModel - { - private readonly ShipNotifier _shipNotifier; - private readonly SlotNotifier _slotNotifier; - private readonly HpNotifier _hpNotifier; - private readonly SupplyNotifier _supplyNotifier; + public class ToolViewModel : ViewModel + { + private readonly ShipNotifier _shipNotifier; + private readonly SlotNotifier _slotNotifier; + private readonly HpNotifier _hpNotifier; + private readonly SupplyNotifier _supplyNotifier; - public bool EnabledShipNotifier - { - get { return _shipNotifier.Enabled; } - set - { - if (_shipNotifier.Enabled != value) - { - _shipNotifier.Enabled = value; - RaisePropertyChanged(); - } - } - } + public bool EnabledShipNotifier + { + get { return _shipNotifier.Enabled; } + set + { + if (_shipNotifier.Enabled != value) + { + _shipNotifier.Enabled = value; + RaisePropertyChanged(); + } + } + } - public uint ShipWarningCount - { - get { return _shipNotifier.WarningCount; } - set - { - if (_shipNotifier.WarningCount != value) - { - _shipNotifier.WarningCount = value; - RaisePropertyChanged(); - } - } - } + public uint ShipWarningCount + { + get { return _shipNotifier.WarningCount; } + set + { + if (_shipNotifier.WarningCount != value) + { + _shipNotifier.WarningCount = value; + RaisePropertyChanged(); + } + } + } - public bool EnabledSlotNotifier - { - get { return _slotNotifier.Enabled; } - set - { - if (_slotNotifier.Enabled != value) - { - _slotNotifier.Enabled = value; - RaisePropertyChanged(); - } - } - } + public bool EnabledSlotNotifier + { + get { return _slotNotifier.Enabled; } + set + { + if (_slotNotifier.Enabled != value) + { + _slotNotifier.Enabled = value; + RaisePropertyChanged(); + } + } + } - public uint SlotWarningCount - { - get { return _slotNotifier.WarningCount; } - set - { - if (_slotNotifier.WarningCount != value) - { - _slotNotifier.WarningCount = value; - RaisePropertyChanged(); - } - } - } + public uint SlotWarningCount + { + get { return _slotNotifier.WarningCount; } + set + { + if (_slotNotifier.WarningCount != value) + { + _slotNotifier.WarningCount = value; + RaisePropertyChanged(); + } + } + } - public bool EnabledHpNotifier - { - get { return _hpNotifier.Enabled; } - set - { - if (_hpNotifier.Enabled != value) - { - _hpNotifier.Enabled = value; - RaisePropertyChanged(); - } - } - } + public bool EnabledHpNotifier + { + get { return _hpNotifier.Enabled; } + set + { + if (_hpNotifier.Enabled != value) + { + _hpNotifier.Enabled = value; + RaisePropertyChanged(); + } + } + } - public bool EnabledShowDamageControl - { - get { return _hpNotifier.EnabledShowDamageControl; } - set - { - if (_hpNotifier.EnabledShowDamageControl != value) - { - _hpNotifier.EnabledShowDamageControl = value; - RaisePropertyChanged(); - } - } - } + public bool EnabledShowDamageControl + { + get { return _hpNotifier.EnabledShowDamageControl; } + set + { + if (_hpNotifier.EnabledShowDamageControl != value) + { + _hpNotifier.EnabledShowDamageControl = value; + RaisePropertyChanged(); + } + } + } - public bool EnabledSupplyNotifier - { + public bool EnabledSupplyNotifier + { get { return _supplyNotifier.Enabled; } - set - { - if (_supplyNotifier.Enabled != value) - { - _supplyNotifier.Enabled = value; + set + { + if (_supplyNotifier.Enabled != value) + { + _supplyNotifier.Enabled = value; RaisePropertyChanged(); - } - } - } + } + } + } public bool EnabledSortieSupplyNotifier { @@ -133,25 +133,25 @@ public bool EnabledExerciseSupplyNotifier } public bool EnabledExpenditionSupplyNotifier - { + { get { return _supplyNotifier.EnabledExpendition; } - set - { - if (_supplyNotifier.EnabledExpendition != value) - { - _supplyNotifier.EnabledExpendition = value; + set + { + if (_supplyNotifier.EnabledExpendition != value) + { + _supplyNotifier.EnabledExpendition = value; RaisePropertyChanged(); - } - } - } + } + } + } - public ToolViewModel(Plugin plugin) - { - _shipNotifier = new ShipNotifier(plugin); - _slotNotifier = new SlotNotifier(plugin); - _hpNotifier = new HpNotifier(plugin); - _supplyNotifier = new SupplyNotifier(plugin); - } - } + public ToolViewModel() + { + _shipNotifier = new ShipNotifier(); + _slotNotifier = new SlotNotifier(); + _hpNotifier = new HpNotifier(); + _supplyNotifier = new SupplyNotifier(); + } + } }