mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
fix: 切换刷理智时, 候选掉落物反复添加到下拉列表
仍然存在: 输入文本修改掉落物名称后切换到另一个掉落物为 `未选择` 的刷理智, 会导致切换后掉落物框显示为 ""
This commit is contained in:
@@ -63,6 +63,7 @@ public class FightSettingsUserControlModel : TaskSettingsViewModel
|
||||
var item = new StagePlanItem();
|
||||
item.PropertyChanged += (_, __) => SaveStagePlan();
|
||||
StagePlan.Add(item);
|
||||
InitDrops();
|
||||
}
|
||||
|
||||
public static FightSettingsUserControlModel Instance { get; }
|
||||
@@ -385,18 +386,15 @@ public class FightSettingsUserControlModel : TaskSettingsViewModel
|
||||
|
||||
AllDrops.Sort((a, b) => string.Compare(a.Value, b.Value, StringComparison.Ordinal));
|
||||
DropsList = [.. AllDrops];
|
||||
if (AllDrops.FirstOrDefault(i => i.Value == DropsItemId) is { } item)
|
||||
|
||||
foreach (var task in ConfigFactory.CurrentConfig.TaskQueue.OfType<FightTask>())
|
||||
{
|
||||
DropsItemName = item.Display;
|
||||
NotifyOfPropertyChange(nameof(DropsItemName));
|
||||
}
|
||||
else
|
||||
if (AllDrops.FirstOrDefault(i => i.Value == task.DropId) is not { } item)
|
||||
{
|
||||
DropsItemId = string.Empty;
|
||||
DropsItemName = string.Empty;
|
||||
NotifyOfPropertyChange(nameof(DropsItemName));
|
||||
task.DropId = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or private sets the list of drops.
|
||||
@@ -418,7 +416,7 @@ public class FightSettingsUserControlModel : TaskSettingsViewModel
|
||||
/// <summary>
|
||||
/// Gets or sets the item Name of drops.
|
||||
/// </summary>
|
||||
public string DropsItemName { get; set; } = string.Empty;
|
||||
public string DropsItemName { get => field; set => SetAndNotify(ref field, value); } = string.Empty;
|
||||
|
||||
// UI 绑定的方法
|
||||
[UsedImplicitly]
|
||||
@@ -641,10 +639,10 @@ public class FightSettingsUserControlModel : TaskSettingsViewModel
|
||||
{
|
||||
fight.StagePlan.Add(string.Empty);
|
||||
}
|
||||
InitDrops();
|
||||
UpdateStageList(); // 临时修复, 应为同步
|
||||
RefreshCurrentStagePlan();
|
||||
RefreshWeeklySchedule();
|
||||
RefreshDropName();
|
||||
Refresh();
|
||||
IsRefreshingUI = false;
|
||||
}
|
||||
@@ -849,6 +847,20 @@ public class FightSettingsUserControlModel : TaskSettingsViewModel
|
||||
SetTaskConfig<FightTask>(t => t.WeeklySchedule.SequenceEqual(dict), t => t.WeeklySchedule = dict);
|
||||
}
|
||||
|
||||
private void RefreshDropName()
|
||||
{
|
||||
var id = GetTaskConfig<FightTask>().DropId;
|
||||
if (AllDrops.FirstOrDefault(i => i.Value == id) is { } item)
|
||||
{
|
||||
DropsItemName = item.Display;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTaskConfig<FightTask>(t => t.DropId == string.Empty, t => t.DropId = string.Empty);
|
||||
DropsItemName = AllDrops.FirstOrDefault(i => i.Value == string.Empty)?.Display ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 关卡列表更新
|
||||
|
||||
public class SanityInfo
|
||||
|
||||
Reference in New Issue
Block a user