fix: 修复自定义基建界面及文档的一些小问题

This commit is contained in:
MistEO
2022-09-19 00:59:06 +08:00
parent 9342ce8fc4
commit dd1cab7641
7 changed files with 27 additions and 14 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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": [

View File

@@ -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());

View File

@@ -226,7 +226,7 @@
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="2" Orientation="Vertical">
<Grid Height="42">
<TextBlock
<TextBlock Visibility="{c:Binding CustomInfrastEnabled}"
Margin="10,6"
HorizontalAlignment="Center"
VerticalAlignment="Center"

View File

@@ -610,7 +610,7 @@ namespace MeoAsstGui
SetAndNotify(ref _customInfrastEnabled, value);
ViewStatusStorage.Set("Infrast.CustomInfrastEnabled", value.ToString());
var mainModel = _container.Get<TaskQueueViewModel>();
mainModel.CustomInfrastEnabled = true;
mainModel.CustomInfrastEnabled = value;
}
}

View File

@@ -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<GenericCombData<int>>();
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<int> { Display = display, Value = i });
CustomInfrastPlanList.Add(new GenericCombData<int> { 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<GenericCombData<int>>(temp_list);
}
catch (Exception)
{