Skip to content
This repository was archived by the owner on Sep 20, 2026. It is now read-only.

feat(collection): copy template IDs in staging - #216

Merged
cauyxy merged 1 commit into
masterfrom
codex/staging-collection-template-id
Aug 6, 2026
Merged

cauyxy merged 1 commit into
masterfrom
codex/staging-collection-template-id

Conversation

@pengx17

@pengx17 pengx17 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Context

staging 验收时经常需要从 Collection 快速拿到稳定的 template ID,用于查数据、复现问题或配置测试。这个工具最初随录制 PR 209 的本地验收改动出现,但与战斗录制无关,因此从最新 master 拆成独立 PR。

改动重点

  • 环境门禁:仅当原始游戏版本包含 -staging 时启用;Online 与 PTR 不展示也不响应。
  • 复制交互:在 Collection 悬停物品或技能卡牌后按 Ctrl+C,复制该卡牌的 GUID template ID。
  • 输入保护:搜索框等文本输入获得焦点时不拦截 Ctrl+C
  • 状态反馈:staging 面板显示操作提示,复制后短暂显示卡牌名与已复制 ID。
  • 回归覆盖:增加 staging / Online / PTR 环境门禁测试。

协作过程

sequenceDiagram
    participant U as staging 验收者
    participant C as Collection
    participant B as 剪贴板
    U->>C: 悬停卡牌并按 Ctrl+C
    C->>C: 校验 staging、输入焦点和悬停卡牌
    C->>B: 写入 template GUID
    C-->>U: 显示复制成功反馈
Loading

方案讨论

环境判断直接使用原始版本字符串中的 -staging 标记,而不复用当前会合并渠道语义的 build channel,避免工具误入 Online 或 PTR。交互复用 Collection 已有的悬停状态,不增加每张卡牌的常驻按钮和布局负担。

最终方案

Collection 初始化时计算一次 staging 门禁;每帧完成悬停更新后,仅在门禁开启、无文本输入焦点且检测到 Ctrl+C 时,将当前悬停卡牌的 template GUID 写入系统剪贴板。非 staging 环境不创建提示 UI,也不执行复制逻辑。

验证情况

  • CollectionGridLayout.Tests:通过。
  • Architecture.Tests:153/153 通过。
  • Debug 插件完整编译:0 warning / 0 error,输出到隔离目录,未替换本地游戏 DLL。
  • git diff --check:通过。

已知局限 / 后续工作

  • 仅支持 staging 环境的 Collection 面板;不扩展到战斗、商店等其他卡牌入口。
  • 本 PR 不包含 PR 209 的录制、tooltip、持久化或 profiling 改动。

@pengx17
pengx17 marked this pull request as ready for review August 5, 2026 14:50
Copilot AI lite review requested due to automatic review settings August 5, 2026 14:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a staging-only Collection panel helper that lets testers copy the hovered card’s stable template GUID via Ctrl+C, including UI hint/feedback and regression coverage to ensure it never activates on Online/PTR builds.

Changes:

  • Introduce a -staging raw-version gate (CollectionStagingTools) and wire it into CollectionPanel initialization.
  • Add Ctrl+C handling to copy the currently hovered CollectionCardVm.Id to the system clipboard, with a short-lived UI confirmation message.
  • Extend CollectionGridLayout.Tests to validate the staging/Online/PTR gating behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/CollectionGridLayout.Tests/Program.cs Adds assertions covering staging vs Online/PTR enablement behavior.
tests/CollectionGridLayout.Tests/CollectionGridLayout.Tests.csproj Links CollectionStagingTools.cs into the test project for gating tests.
src/BazaarPlusPlus/Game/CollectionPanel/Ui/CollectionPanelView.Tree.cs Conditionally adds the staging hint/feedback label to the operation rail.
src/BazaarPlusPlus/Game/CollectionPanel/Ui/CollectionPanelView.cs Stores staging flag state, implements “copied” feedback with scheduled reset, and threads the flag through the constructor.
src/BazaarPlusPlus/Game/CollectionPanel/Grid/CollectionGridVirtualizer.cs Exposes the currently hovered card VM via TryGetHoveredCard.
src/BazaarPlusPlus/Game/CollectionPanel/CollectionStagingTools.cs Implements raw-version -staging detection helper.
src/BazaarPlusPlus/Game/CollectionPanel/CollectionPanel.cs Computes staging gate once, polls Ctrl+C to copy hovered template GUID to clipboard, and triggers view feedback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +478 to +483
var keyboard = Keyboard.current;
if (
keyboard?.cKey.wasPressedThisFrame != true
|| (keyboard.leftCtrlKey.isPressed || keyboard.rightCtrlKey.isPressed) != true
)
return;
@timelic

timelic commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

狠狠点赞!

@cauyxy
cauyxy merged commit 0679123 into master Aug 6, 2026
1 check passed
@cauyxy
cauyxy deleted the codex/staging-collection-template-id branch August 6, 2026 11:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants