ui: simplify helper copy and center page loading feedback

This commit is contained in:
AttilaNet
2026-11-11 21:08:48 +08:00
parent d1e7f3c717
commit e23e7586c4
25 changed files with 747 additions and 141 deletions
+12 -12
View File
@@ -295,7 +295,7 @@ def _bag(dto, engine, config, query):
"rule_defaults": {"enabled": False, "reserve": 0}, "rule_path": ["policy", "gift_items", key],
"edits": {field: _edit(["policy", "gift_items", key, field], kind, disabled=not eligible,
reason="此类物品不进入自动赠礼" if not eligible else "") for field, kind in (("enabled", "boolean"), ("reserve", "integer"))}})
dto["summary"] = f"{len(groups)} 类物品 / {sum(row['count'] for row in groups.values())} 件;同种库存合并显示"
dto["summary"] = f"{len(groups)} 类物品 / {sum(row['count'] for row in groups.values())} 件"
def _ranch(dto, engine, config, query):
@@ -360,7 +360,7 @@ def _ranch(dto, engine, config, query):
if row["group"] not in known:
known.add(row["group"])
dto["groups"].append({"id": row["group"], "label": "培育室" if row["group"] == "incubator" else "未归属牧场", "count": counts[row["group"]], "collapsed": False})
dto["summary"] = f"{len(snapshot.raw['rooms'])} 座牧场;显示 {len(dto['rows'])} 只魔物;勾选目标按较小优先级先执行"
dto["summary"] = f"{len(snapshot.raw['rooms'])} 座牧场;显示 {len(dto['rows'])} 只魔物"
targets = [{"value": int(mon["id"]), "label": f"{catalog.monster_label(mon)} Lv.{mon.get('level', 1)}/{catalog.max_level(mon)}"}
for mon in snapshot.raw["monsters"] if mon.get("process") == 3 and catalog.max_level(mon) is not None and int(mon.get("level", 1)) < catalog.max_level(mon)]
dto["feed_targets"] = targets
@@ -376,7 +376,7 @@ def _daily(dto, engine, config, query):
dto["columns"] = [_column(k, label) for k, label in (("name", "项目 / 邮件"), ("status", "状态"), ("reward", "奖励 / 附件"))]
for row in entries(engine.catalog, engine.snapshot, engine.daily_ledger):
dto["rows"].append({"id": row.key, "name": row.name, "status": row.status, "reward": row.reward, "claimable": row.action is not None})
dto["summary"] = "刷新只更新状态;领取勾选项目立即处理可领奖励;自动领取需要开启顶部策略"
dto["summary"] = ""
dto["actions"].append({"operation": "claim_daily", "label": "领取勾选项目", "payload": {}})
@@ -388,7 +388,7 @@ def _hatching(dto, engine, config, query):
dto["columns"] = [_column("kind", "类型"), _column("description", "下一步 / 等待条件")]
dto["rows"] = _plans(engine)
policy = engine.policy
dto["summary"] = "先在背包魔物蛋配置规则,再开启顶部策略;空坑按优先级随机1~2秒装填"
dto["summary"] = ""
dto["details"] = {"feed_status": engine.planner.feed_status(engine.snapshot, policy),
"last_draw": engine.last_draw or "尚无记录", "notes": list(dict.fromkeys(engine.planner.notes)),
"preset": {"label": "绿色史莱姆金币预设(仅孵此蛋)", "patch": {
@@ -414,7 +414,7 @@ def _gifts(dto, engine, config, query):
"quality": catalog.quality_text(mon), "likes": catalog.likes_text(mon["typeId"]), "remaining": remaining,
"cooldown": duration(remaining) if remaining else "可赠礼"})
engine.gift_planner.plan(snapshot, engine.policy, engine.quest_policy)
dto["summary"] = "自动代表按等级 → 好感 → 综合成长资质选择并记住;满好感或冷却时不换喂同种另一只"
dto["summary"] = ""
dto["details"] = {"notes": list(engine.gift_planner.notes), "next_ready_at": engine.gift_planner.next_ready_at,
"inventory_page": "bag", "targets_page": "ranch"}
@@ -475,7 +475,7 @@ def _mainline(dto, engine, config, query):
continue
dto["rows"].append(row)
dto["details"][row["id"]] = detail
dto["summary"] = f"显示 {len(dto['rows'])} / {len(sources)} 条任务;未支持的步骤显示原因" if sources else "尚未读取任务,请刷新任务 / 预览"
dto["summary"] = f"显示 {len(dto['rows'])} / {len(sources)} 条任务" if sources else "尚未读取任务"
dto["tabs"] = [{"key": "status", "title": "任务状态"}, {"key": "policy", "title": "推进策略"}]
dto["actions"] = [{"operation": "refresh_tasks", "label": "刷新任务 / 预览", "payload": {}}]
dto["battle_mode"] = {"mode": "experimental", "label": "实验模拟(近似,未完整验证)", "damage_rule": "保持原始属性;我方对敌最终伤害10倍,单次最高50000"}
@@ -528,7 +528,7 @@ def _battles(dto, engine, config, query):
dto["details"][row["id"]] = {"时间(北京时间)": row["time"], "上下文": row["kind_label"], "任务 / 地图": row["name"],
"战斗模式": "实验模拟(近似,未完整验证)" if mode == "experimental" else "原版运行时" if mode == "original" else "记录未标明",
"队伍": row["team"], "结果": row["outcome_label"], "详情 / 阻塞原因": row["message"], "奖励": shown_reward, "伤害规则": damage}
dto["summary"] = f"已读取 {len(records)} 条记录,显示 {len(dto['rows'])} 条" if records else "尚无已读取的战斗记录;未记录结果不代表战斗成功"
dto["summary"] = f"已读取 {len(records)} 条记录,显示 {len(dto['rows'])} 条" if records else "尚无已读取的战斗记录"
dto["actions"] = [{"operation": "refresh_tasks", "label": "刷新战斗记录", "payload": {}}]
@@ -559,7 +559,7 @@ def _commissions(dto, engine, config, query):
"交付限制": {"允许物品": engine.quest_policy.allow_items, "允许魔物": engine.quest_policy.allow_monsters,
"单次金币上限": engine.quest_policy.max_money, "允许已支持战斗": engine.quest_policy.battle_tasks},
"接取优先级": "氪金奖励较高的委托优先;仅接取原规划器确认可支持的委托"}
dto["summary"] = f"今日剩余可接次数:{snapshot.raw.get('history', {}).get('loopTaskNum', '未知')};当前委托:{len(engine.tasks.current(snapshot))};按氪金奖励优先"
dto["summary"] = f"今日剩余可接次数:{snapshot.raw.get('history', {}).get('loopTaskNum', '未知')};当前委托:{len(engine.tasks.current(snapshot))}"
def _exploration(dto, engine, config, query):
@@ -602,7 +602,7 @@ def _exploration(dto, engine, config, query):
"edits": {"enabled": _edit(["explore_policy", "teams", key, "enabled"], "boolean", disabled=disabled),
"area": _edit(["explore_policy", "teams", key, "area"], "select", options=_options([("", "请选择地区")]) + area_options, disabled=disabled),
"monsters": members_edit}})
dto["summary"] = f"已有 {len(rows)} 支探险队;配置 {len(policy.teams)} 支;启用 {sum(rule.enabled for rule in policy.teams.values())} 支。完成时自动领奖,再次出发由开关控制。"
dto["summary"] = f"已有 {len(rows)} 支探险队;配置 {len(policy.teams)} 支;启用 {sum(rule.enabled for rule in policy.teams.values())} 支"
dto["details"] = {"help": "留空任一槽位恢复自动选人;手动队员必须三只不同魔物,队员等级不可高于队长;不自动花钱开队或召回"}
@@ -717,7 +717,7 @@ def _statistics(dto, engine, config, query):
"unit": "ratio" if metric == "rate" else "个 / 体力", "empty_reason": "请选择关卡和难度"}
dto["charts"] = [dto["chart"]]
if not stage_id:
dto["summary"] = "请选择关卡和难度;关卡来自本地配置,统计按当前账号读取"
dto["summary"] = "尚未选择关卡和难度"
return
if stage is None or level not in stage.get("level", {}):
raise ValueError("数据分析的关卡或难度无效")
@@ -742,7 +742,7 @@ def _statistics(dto, engine, config, query):
def _execution_plans(dto, engine, config, query):
dto["columns"] = [_column("kind", "类型"), _column("description", "计划动作")]
dto["rows"] = _plans(engine)
dto["summary"] = f"{len(dto['rows'])} 项计划;仅预览,开启顶部策略后由原引擎执行"
dto["summary"] = f"{len(dto['rows'])} 项计划"
dto["details"] = {"notes": list(dict.fromkeys(engine.planner.notes))}
@@ -763,7 +763,7 @@ def _yields(dto, engine, config, query):
dto["rows"].append({"id": type_id, "type_id": int(type_id), "name": info.get("name", "未知"), "star": info.get("star", "?"), "time_total": total, "time_text": duration(total),
"sell_money": money, "sell_exp": exp, "gold_per_hour": round(money * 3600 / total, 2), "exp_per_hour": round(exp * 3600 / total, 2),
"ratio": round(ratio, 3) if ratio is not None else "无经验", "recommendation": "适合喂养" if ratio is not None and ratio < threshold else "适合派遣"})
dto["summary"] = f"本地资料共 {len(engine.catalog.monsters)} 种魔物,当前显示 {len(dto['rows'])} 种;CSV/XLSX覆盖值仅影响收益计算"
dto["summary"] = f"本地资料共 {len(engine.catalog.monsters)} 种魔物,当前显示 {len(dto['rows'])} 种"
dto["actions"].append({"operation": "import_yields", "label": "导入CSV / XLSX收益资料", "accept": ".csv,.xlsx"})
dto["details"] = {"import_columns": ["typeId / 编号 / 魔物ID", "sell_money / 派遣金币", "sell_exp / 强化经验", "time_total / 孵化秒数"]}