From dd1cab7641b5fec104b265de90cddef7a809dd44 Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 19 Sep 2022 00:59:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=9F=BA=E5=BB=BA=E7=95=8C=E9=9D=A2=E5=8F=8A=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=9A=84=E4=B8=80=E4=BA=9B=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- docs/3.6-基建排班协议.md | 8 +++++++- .../243_layout_3_times_pre_day.json | 6 +++--- src/MeoAssistant/InfrastTask.cpp | 2 +- .../UserControl/FightSettingsUserControl.xaml | 2 +- src/MeoAsstGui/ViewModels/SettingsViewModel.cs | 2 +- .../ViewModels/TaskQueueViewModel.cs | 18 ++++++++++++------ 7 files changed, 27 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8376b93739..774d72c935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ -- 新增 基建 自定义排班选项,请参考 [文档](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/master/docs/3.6-%E5%9F%BA%E5%BB%BA%E6%8E%92%E7%8F%AD%E5%8D%8F%E8%AE%AE.md) 编写配置使用 @MistEO @公孙长乐 +- 新增 基建 自定义排班选项,请参考 [文档](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/master/docs/3.6-%E5%9F%BA%E5%BB%BA%E6%8E%92%E7%8F%AD%E5%8D%8F%E8%AE%AE.md) 编写配置使用 @MistEO [@公孙长乐](https://space.bilibili.com/22606843) _内置了一套顶配 243 作业,在 `resource/custom_infrast/` 中,可参考修改_ - 新增 刷理智 `OF-F3`, `GT-5` 关卡导航 @ABA2396 - 重构 连接、截图 部分代码 @zzyyyl - 修复 自动公招 加急券的使用问题 @horror-proton - 修复 界面 指定材料选择的错误 @ABA2396 - 修复 界面 备选关卡被重置的问题 @ABA2396 +- 修复 界面 选择基建自定义排班文件时的一些问题 @MistEO - 修复 编译问题,整理 项目代码 @horror-proton @zzyyyl - 更新 项目文档 @MistEO @zzyyyl - Update Japanese translation and documentation. @wallsman @Tastror diff --git a/docs/3.6-基建排班协议.md b/docs/3.6-基建排班协议.md index 8363fb9d31..66bcd0e87b 100644 --- a/docs/3.6-基建排班协议.md +++ b/docs/3.6-基建排班协议.md @@ -1,5 +1,7 @@ # 基建排班协议 +`resource/custom_infrast/*.json` 的使用方法及各字段说明 + ## 完整字段一览 ```jsonc @@ -28,7 +30,7 @@ }, "drones": { // 无人机使用,可选,不填写则不使用无人机 "room": "trading", // 为哪个类型房间使用,取值范围 "trading" / "manufacture" - "index": 0, // 为第几个该类型房间使用 + "index": 1, // 为第几个该类型房间使用,对应左边 tab 栏序号,取值范围 [1, 5] "rule": "all", // 使用规则,保留字段,目前无作用。以后可能拿来支持插拔等操作 "order": "pre" // 在换干员前使用还是在换完才用,取值范围 "pre" / "post" }, @@ -96,3 +98,7 @@ ] } ``` + +## 举例 + +[243 极限效率,一天三换](../resource/custom_infrast/243_layout_3_times_pre_day.json) diff --git a/resource/custom_infrast/243_layout_3_times_pre_day.json b/resource/custom_infrast/243_layout_3_times_pre_day.json index 06c1286489..50332e3889 100644 --- a/resource/custom_infrast/243_layout_3_times_pre_day.json +++ b/resource/custom_infrast/243_layout_3_times_pre_day.json @@ -10,7 +10,7 @@ }, "drones": { "room": "manufacture", - "index": 0 + "index": 1 }, "rooms": { "control": [ @@ -133,7 +133,7 @@ }, "drones": { "room": "manufacture", - "index": 0 + "index": 1 }, "rooms": { "control": [ @@ -256,7 +256,7 @@ }, "drones": { "room": "manufacture", - "index": 0 + "index": 1 }, "rooms": { "control": [ diff --git a/src/MeoAssistant/InfrastTask.cpp b/src/MeoAssistant/InfrastTask.cpp index 3e4dd0c6d7..6f2f3e118b 100644 --- a/src/MeoAssistant/InfrastTask.cpp +++ b/src/MeoAssistant/InfrastTask.cpp @@ -219,7 +219,7 @@ bool asst::InfrastTask::parse_and_set_custom_config(const std::filesystem::path& const auto& drones_json = drones_opt.value(); infrast::CustomDronesConfig drones_config; - drones_config.index = drones_json.get("index", 0); + drones_config.index = drones_json.get("index", 1) - 1; drones_config.order = drones_json.get("order", "pre") == "post" ? infrast::CustomDronesConfig::Order::Post : infrast::CustomDronesConfig::Order::Pre; std::string room = drones_json.get("room", std::string()); diff --git a/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml b/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml index ae7bb469b9..89e7466373 100644 --- a/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml +++ b/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml @@ -226,7 +226,7 @@ - (); - mainModel.CustomInfrastEnabled = true; + mainModel.CustomInfrastEnabled = value; } } diff --git a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs index 49533c0a80..ec36fede0f 100644 --- a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs +++ b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs @@ -1497,7 +1497,7 @@ namespace MeoAsstGui { if (value != _customInfrastPlanIndex) { - AddLog(CustomInfrastPlanInfoList[value].Name); + AddLog(CustomInfrastPlanInfoList[value].Name, LogColor.Message); if (CustomInfrastPlanInfoList[value].Description != string.Empty) { AddLog(CustomInfrastPlanInfoList[value].Description); @@ -1522,6 +1522,9 @@ namespace MeoAsstGui public void RefreshCustonInfrastPlan() { + CustomInfrastPlanInfoList.Clear(); + CustomInfrastPlanList.Clear(); + if (!CustomInfrastEnabled) { return; @@ -1548,22 +1551,25 @@ namespace MeoAsstGui } } - var temp_list = new List>(); var plan_list = (JArray)root["plans"]; for (int i = 0; i < plan_list.Count; ++i) { var plan = (JObject)plan_list[i]; string display = plan.ContainsKey("name") ? plan["name"].ToString() : ("Plan " + ((char)('A' + i)).ToString()); - temp_list.Add(new GenericCombData { Display = display, Value = i }); + CustomInfrastPlanList.Add(new GenericCombData { Display = display, Value = i }); + string desc = plan.ContainsKey("description") ? plan["description"].ToString() : string.Empty; CustomInfrastPlanInfoList.Add(new CustomInfrastPlanInfo { Index = i, Name = display, - Description = plan.ContainsKey("description") ? plan["description"].ToString() : string.Empty, + Description = desc, }); + AddLog(display, LogColor.Message); + if (desc != string.Empty) + { + AddLog(desc); + } } - - CustomInfrastPlanList = new ObservableCollection>(temp_list); } catch (Exception) {