Repository: babalae/better-genshin-impact
Pull request #1615: 任务列表自动保存，尘歌壶购买优化
Author: login: kaedelcb
Created: 2025-05-19T10:02:43Z | Merged: 2025-05-19T13:05:21Z

任务列表自动保存，删除排序按钮
尘歌壶购买优化，增加购买间隔等待动画结束后再进行下一轮


Diff:
diff --git a/BetterGenshinImpact/GameTask/Common/Element/Assets/ElementAssets.cs b/BetterGenshinImpact/GameTask/Common/Element/Assets/ElementAssets.cs
index f6ce8db214..9e9080e7fe 100644
--- a/BetterGenshinImpact/GameTask/Common/Element/Assets/ElementAssets.cs
+++ b/BetterGenshinImpact/GameTask/Common/Element/Assets/ElementAssets.cs
@@ -360,7 +360,7 @@ private ElementAssets()
         }.InitTemplate();
         AYuanExpBottleBigRo = new RecognitionObject
         {
-            Name = "AYuanExpBottleBigRo",
+            Name = "祝圣精华",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "exp_bottle_big.png"),
             RegionOfInterest = new Rect( 0, 0, CaptureRect.Width*7/10 , CaptureRect.Height),
@@ -368,7 +368,7 @@ private ElementAssets()
         }.InitTemplate();
         AYuanExpBottleSmallRo = new RecognitionObject
         {
-            Name = "AYuanExpBottleSmallRo",
+            Name = "祝圣油膏",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "exp_bottle_small.png"),
             RegionOfInterest = new Rect(0, 0, CaptureRect.Width*7/10, CaptureRect.Height),
@@ -392,7 +392,7 @@ private ElementAssets()
         }.InitTemplate();
         SereniteapotExpBookRo = new RecognitionObject
         {
-            Name = "SereniteapotExpBookRo",
+            Name = "大英雄的经验",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "exp_book.png"),
             RegionOfInterest = new Rect(0, 0, CaptureRect.Width*7/10, CaptureRect.Height),
@@ -400,7 +400,7 @@ private ElementAssets()
         }.InitTemplate();
         SereniteapotExpBookSmallRo = new RecognitionObject
         {
-            Name = "SereniteapotExpBookSmallRo",
+            Name = "流浪者的经验",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "exp_book_small.png"),
             RegionOfInterest = new Rect(0, 0, CaptureRect.Width*7/10, CaptureRect.Height),
@@ -408,7 +408,7 @@ private ElementAssets()
         }.InitTemplate();
         AYuanClothRo = new RecognitionObject
         {
-            Name = "AYuanClothRo",
+            Name = "布匹",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "ayuan_cloth.png"),
             RegionOfInterest = new Rect(0, 0, CaptureRect.Width*7/10, CaptureRect.Height),
@@ -416,7 +416,7 @@ private ElementAssets()
         }.InitTemplate();
         AYuanresinRo = new RecognitionObject
         {
-            Name = "AYuanresinRo",
+            Name = "须臾树脂",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "ayuan_resin.png"),
             RegionOfInterest = new Rect(0, 0, CaptureRect.Width*7/10, CaptureRect.Height),
@@ -424,7 +424,7 @@ private ElementAssets()
         }.InitTemplate();
         AYuanMagicmineralprecisionRo = new RecognitionObject
         {
-            Name = "AYuanMagicmineralprecisionRo",
+            Name = "精锻用魔矿",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "ayuan_magicmineralprecision.png"),
             RegionOfInterest = new Rect(0, 0, CaptureRect.Width*7/10, CaptureRect.Height),
@@ -432,7 +432,7 @@ private ElementAssets()
         }.InitTemplate();
         AYuanMOlaRo = new RecognitionObject
         {
-            Name = "AYuanMOlaRo",
+            Name = "摩拉",
             RecognitionType = RecognitionTypes.TemplateMatch,
             TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "ayuan_mola.png"),
             RegionOfInterest = new Rect(0, 0, CaptureRect.Width*7/10, CaptureRect.Height),
diff --git a/BetterGenshinImpact/GameTask/Common/Job/GoToSereniteaPotTask.cs b/BetterGenshinImpact/GameTask/Common/Job/GoToSereniteaPotTask.cs
index a595e74fec..e06f2464f5 100644
--- a/BetterGenshinImpact/GameTask/Common/Job/GoToSereniteaPotTask.cs
+++ b/BetterGenshinImpact/GameTask/Common/Job/GoToSereniteaPotTask.cs
@@ -417,10 +417,11 @@ private async Task GetReward(CancellationToken ct)
                         var itemRo = CaptureToRectArea().Find(item);
                         if (itemRo.IsExist())
                         {
+                            Logger.LogInformation("领取尘歌壶奖励:购买 {text} ", item.Name);
                             itemRo.Click();
-                            await Delay(500, ct);
+                            await Delay(600, ct);
                             await BuyMaxNumber(ct);
-                            await Delay(500, ct);
+                            await Delay(1200, ct);//等待购买动画结束
                         }
                     }
                     await Delay(900, ct);
diff --git a/BetterGenshinImpact/View/Pages/OneDragonFlowPage.xaml b/BetterGenshinImpact/View/Pages/OneDragonFlowPage.xaml
index 27b22766cd..97c549b969 100644
--- a/BetterGenshinImpact/View/Pages/OneDragonFlowPage.xaml
+++ b/BetterGenshinImpact/View/Pages/OneDragonFlowPage.xaml
@@ -55,7 +55,7 @@
             VerticalAlignment="Center"
             FontSize="16"
             FontWeight="Bold"
-            Text="任务" />
+            Text="任务列表" />
         <ui:Button
             Grid.Column="1"
             Grid.Row="0"
@@ -69,12 +69,6 @@
             Margin="0,0,10,0"
             Icon="{ui:SymbolIcon Add24}"
             Command="{Binding AddTaskGroupCommand}" />
-        <ui:Button Grid.Column="3"
-                   Grid.Row="0"
-                   Margin="1,0,15,0"
-                   Icon="{ui:SymbolIcon Save24}"
-                   Command="{Binding SaveActionConfigCommand}"
-                   Content="排序" />
     </Grid>
     <Grid DockPanel.Dock="Top"
         Margin="0,0,0,10">
diff --git a/BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs
index 99bc90cf1f..08332dcc6d 100644
--- a/BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs
+++ b/BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs
@@ -32,6 +32,7 @@
 using BetterGenshinImpact.Core.Script.Project;
 using BetterGenshinImpact.Service.Interface;
 using TextBlock = Wpf.Ui.Controls.TextBlock;
+using System.Collections.Specialized;
 
 namespace BetterGenshinImpact.ViewModel.Pages;
 
@@ -429,28 +430,11 @@ public OneDragonFlowViewModel()
                     oldItem.PropertyChanged -= TaskPropertyChanged;
                 }
             }
-        };
-        
-        TaskList.CollectionChanged += (sender, e) =>
-        {
-            if (e.NewItems != null)
+            if (e.Action == NotifyCollectionChangedAction.Move)
             {
-                foreach (OneDragonTaskItem newItem in e.NewItems)
-                {
-                    newItem.PropertyChanged += TaskPropertyChanged;
-                }
-            }
-
-            if (e.OldItems != null)
-            {
-                foreach (OneDragonTaskItem oldItem in e.OldItems)
-                {
-                    oldItem.PropertyChanged -= TaskPropertyChanged;
-                }
+                SaveConfig();
             }
         };
-        SaveConfig();
-        InitConfigList();
     }
 
     public override void OnNavigatedTo()


Reviews:
user: login: huiyadanli
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-19T10:24:18Z
user: login: kaedelcb
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-19T10:25:15Z
user: login: kaedelcb
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-19T10:38:06Z
user: login: kaedelcb
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-19T10:40:13Z

Review comments:
diff_hunk: @@ -429,28 +430,11 @@ public OneDragonFlowViewModel()
                     oldItem.PropertyChanged -= TaskPropertyChanged;
                 }
             }
-        };
-        
-        TaskList.CollectionChanged += (sender, e) =>
-        {
-            if (e.NewItems != null)
+            if (e.Action == NotifyCollectionChangedAction.Move)
             {
-                foreach (OneDragonTaskItem newItem in e.NewItems)
-                {
-                    newItem.PropertyChanged += TaskPropertyChanged;
-                }
-            }
-
-            if (e.OldItems != null)
-            {
-                foreach (OneDragonTaskItem oldItem in e.OldItems)
-                {
-                    oldItem.PropertyChanged -= TaskPropertyChanged;
-                }
+                SaveConfig();
             }
         };
-        SaveConfig();
-        InitConfigList();
path: BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs
user: login: huiyadanli
body: 这两段代码删除无影响吗
created_at: 2025-05-19T10:24:13Z
author_association: MEMBER
diff_hunk: @@ -429,28 +430,11 @@ public OneDragonFlowViewModel()
                     oldItem.PropertyChanged -= TaskPropertyChanged;
                 }
             }
-        };
-        
-        TaskList.CollectionChanged += (sender, e) =>
-        {
-            if (e.NewItems != null)
+            if (e.Action == NotifyCollectionChangedAction.Move)
             {
-                foreach (OneDragonTaskItem newItem in e.NewItems)
-                {
-                    newItem.PropertyChanged += TaskPropertyChanged;
-                }
-            }
-
-            if (e.OldItems != null)
-            {
-                foreach (OneDragonTaskItem oldItem in e.OldItems)
-                {
-                    oldItem.PropertyChanged -= TaskPropertyChanged;
-                }
+                SaveConfig();
             }
         };
-        SaveConfig();
-        InitConfigList();
path: BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs
user: login: kaedelcb
body: > 这两段代码删除无影响吗

执行不到这里，触发后直接跳转执行了
created_at: 2025-05-19T10:25:15Z
author_association: CONTRIBUTOR
diff_hunk: @@ -429,28 +430,11 @@ public OneDragonFlowViewModel()
                     oldItem.PropertyChanged -= TaskPropertyChanged;
                 }
             }
-        };
-        
-        TaskList.CollectionChanged += (sender, e) =>
-        {
-            if (e.NewItems != null)
+            if (e.Action == NotifyCollectionChangedAction.Move)
             {
-                foreach (OneDragonTaskItem newItem in e.NewItems)
-                {
-                    newItem.PropertyChanged += TaskPropertyChanged;
-                }
-            }
-
-            if (e.OldItems != null)
-            {
-                foreach (OneDragonTaskItem oldItem in e.OldItems)
-                {
-                    oldItem.PropertyChanged -= TaskPropertyChanged;
-                }
+                SaveConfig();
             }
         };
-        SaveConfig();
-        InitConfigList();
path: BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs
user: login: kaedelcb
body: 加了log，只有第一期打开软件执行了一遍，其他设置变动，都没有执行下面的代码，都直接跳转去外面的函数保存了。


created_at: 2025-05-19T10:38:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -429,28 +430,11 @@ public OneDragonFlowViewModel()
                     oldItem.PropertyChanged -= TaskPropertyChanged;
                 }
             }
-        };
-        
-        TaskList.CollectionChanged += (sender, e) =>
-        {
-            if (e.NewItems != null)
+            if (e.Action == NotifyCollectionChangedAction.Move)
             {
-                foreach (OneDragonTaskItem newItem in e.NewItems)
-                {
-                    newItem.PropertyChanged += TaskPropertyChanged;
-                }
-            }
-
-            if (e.OldItems != null)
-            {
-                foreach (OneDragonTaskItem oldItem in e.OldItems)
-                {
-                    oldItem.PropertyChanged -= TaskPropertyChanged;
-                }
+                SaveConfig();
             }
         };
-        SaveConfig();
-        InitConfigList();
path: BetterGenshinImpact/ViewModel/Pages/OneDragonFlowViewModel.cs
user: login: kaedelcb
body: 如果要保留，只建议保留 InitConfigList();
 SaveConfig();可以删除，
created_at: 2025-05-19T10:40:13Z
author_association: CONTRIBUTOR

PR comments:
user: login: huiyadanli
created_at: 2025-05-19T10:22:30Z
body: 原来是这样解决的吗
author_association: MEMBER
user: login: kaedelcb
created_at: 2025-05-19T10:27:10Z
body: > 原来是这样解决的吗

AI大人是这样说的。ρ(・ω・、)
author_association: CONTRIBUTOR