public ToolViewModel(MaterialChartPlugin plugin) { this.plugin = plugin; this.materialManager = new MaterialManager(plugin); this.DisplayedPeriods = new List <DisplayViewModel <DisplayedPeriod> >() { DisplayViewModel.Create(DisplayedPeriod.OneDay, "1日"), DisplayViewModel.Create(DisplayedPeriod.OneWeek, "1週間"), DisplayViewModel.Create(DisplayedPeriod.OneMonth, "1ヶ月"), DisplayViewModel.Create(DisplayedPeriod.ThreeMonths, "3ヶ月"), DisplayViewModel.Create(DisplayedPeriod.OneYear, "1年"), DisplayViewModel.Create(DisplayedPeriod.ThreeYears, "3年") }; }
public MaterialManager(MaterialChartPlugin plugin) { this.plugin = plugin; this.Log = new MaterialLog(plugin); KanColleClient.Current // KanColleClientのIsStartedがtrueに変更されたら資材データの購読を開始 .Subscribe(nameof(KanColleClient.IsStarted), () => { var materials = KanColleClient.Current.Homeport.Materials; var adomiral = KanColleClient.Current.Homeport.Admiral; listener = new PropertyChangedEventListener(materials) { { nameof(materials.Fuel), (_,__) => RaisePropertyChanged(nameof(Fuel)) }, { nameof(materials.Ammunition), (_,__) => RaisePropertyChanged(nameof(Ammunition)) }, { nameof(materials.Steel), (_,__) => RaisePropertyChanged(nameof(Steel)) }, { nameof(materials.Bauxite), (_,__) => RaisePropertyChanged(nameof(Bauxite)) }, { nameof(materials.InstantRepairMaterials), (_,__) => RaisePropertyChanged(nameof(RepairTool)) }, { nameof(adomiral.Level), (_, __) => RaisePropertyChanged(nameof(StorableMaterialLimit)) } }; // 資材のロギング Observable.FromEvent<PropertyChangedEventHandler, PropertyChangedEventArgs>( h => (sender, e) => h(e), h => materials.PropertyChanged += h, h => materials.PropertyChanged -= h) // プロパティ名が一致しているか調べて .Where(e => IsObservedPropertyName(e.PropertyName)) // まとめて通知が来るので10ms待機して .Throttle(TimeSpan.FromMilliseconds(10)) // 処理 .Subscribe(async _ => { if (Log.HasLoaded) { Log.History.Add(new TimeMaterialsPair(DateTime.Now, Fuel, Ammunition, Steel, Bauxite, RepairTool, materials.DevelopmentMaterials, materials.InstantBuildMaterials, materials.ImprovementMaterials)); await Log.SaveAsync(); } }); this.IsAvailable = true; }, false); }
public MaterialManager(MaterialChartPlugin plugin) { this.plugin = plugin; this.Log = new MaterialLog(plugin); KanColleClient.Current // KanColleClientのIsStartedがtrueに変更されたら資材データの購読を開始 .Subscribe(nameof(KanColleClient.IsStarted), () => { var materials = KanColleClient.Current.Homeport.Materials; var adomiral = KanColleClient.Current.Homeport.Admiral; listener = new PropertyChangedEventListener(materials) { { nameof(materials.Fuel), (_, __) => RaisePropertyChanged(nameof(Fuel)) }, { nameof(materials.Ammunition), (_, __) => RaisePropertyChanged(nameof(Ammunition)) }, { nameof(materials.Steel), (_, __) => RaisePropertyChanged(nameof(Steel)) }, { nameof(materials.Bauxite), (_, __) => RaisePropertyChanged(nameof(Bauxite)) }, { nameof(materials.InstantRepairMaterials), (_, __) => RaisePropertyChanged(nameof(RepairTool)) }, { nameof(adomiral.Level), (_, __) => RaisePropertyChanged(nameof(StorableMaterialLimit)) } }; // 資材のロギング Observable.FromEvent <PropertyChangedEventHandler, PropertyChangedEventArgs>( h => (sender, e) => h(e), h => materials.PropertyChanged += h, h => materials.PropertyChanged -= h) // プロパティ名が一致しているか調べて .Where(e => IsObservedPropertyName(e.PropertyName)) // まとめて通知が来るので10ms待機して .Throttle(TimeSpan.FromMilliseconds(10)) // 処理 .Subscribe(async _ => { if (Log.HasLoaded) { Log.History.Add(new TimeMaterialsPair(DateTime.Now, Fuel, Ammunition, Steel, Bauxite, RepairTool, materials.DevelopmentMaterials, materials.InstantBuildMaterials, materials.ImprovementMaterials)); await Log.SaveAsync(); } }); this.IsAvailable = true; }, false); }
public ToolViewModel(MaterialChartPlugin plugin) { this.plugin = plugin; this.materialManager = new MaterialManager(plugin); this.DisplayedPeriods = new List<DisplayViewModel<DisplayedPeriod>>() { DisplayViewModel.Create(DisplayedPeriod.OneDay, "1日"), DisplayViewModel.Create(DisplayedPeriod.OneWeek, "1週間"), DisplayViewModel.Create(DisplayedPeriod.OneMonth, "1ヶ月"), DisplayViewModel.Create(DisplayedPeriod.ThreeMonths, "3ヶ月"), DisplayViewModel.Create(DisplayedPeriod.OneYear, "1年"), DisplayViewModel.Create(DisplayedPeriod.ThreeYears, "3年") }; }
public MaterialLog(MaterialChartPlugin plugin) { this.plugin = plugin; }