Complete room UI and protocol integration, move game definitions and resources behind bundle entries, publish authoritative version XML, and document single-game builds. Include all current resource changes and experiment artifacts.
2.5 KiB
Layer606_Apply 解散投票
PlatformStartup 的 applyPrefab 引用 Layer606_Apply,playerVoteItemPrefab 引用 PlayerVoteItem。这些引用和界面资源由 Cocos 编辑器维护。
group-29/PlayerVotes:纵向 ScrollView,Viewport/Content使用纵向 Layout。运行时按服务器参与投票的座位创建PlayerVoteItem,没有固定人数上限;发起者显示在上方说明中,其余参与者显示为列表行。PlayerVoteItem/Spirit166:投票状态;Spirit264:对应玩家昵称。Prefab 中的样例行在运行时由真实数据替换。Spirit191:发起者/结果说明;Spirit201、Spirit202:同意、拒绝;group-32/Spirit223:结果确认。Spirit222:使用现有00046.fnt的 Label。倒计时只显示服务器给定时间的剩余秒数;归零不会代替服务器投票或判定结果。
数据与触发
权威协议见 room 路由 和 数据结构,历史界面行为参照 Game_Surface_3 的 GameUI.OpenApply/OpenApplyResult。
PlatformStore 的 dissolution 是唯一投票状态来源。申请、同意、拒绝、结果广播和重连的 agreefree 均更新这里;ApplyVotePanel 订阅平台状态,只负责显示和按钮事件。点击后等待服务器回包,不乐观更新投票结果。
子游戏使用 GameHost.execute({type:'room.apply-dissolution'}) 发起,平台提供 applyDissolution/agreeDissolution/refuseDissolution/acknowledgeDissolution。现有模板/二七王房间的退出入口在开局且非无限房时显示“申请解散”并调用该命令;未开局和无限房仍使用原退出流程。
跨服解散仅在服务器明确要求 free_room 时保留当前游戏会话,接收大厅服结果后再完成确认。无 deskfree 的通过结果清房回大厅;有 deskfree 时将原始数据通过 room.dissolution-confirmed 交给子游戏。
当前边界
模板与二七王目前只有房间进入界面,尚无解散结算画面;收到需要处理 deskfree 的事件会明确报告“解散结算界面尚未接入”,不把数据忽略后伪装为结算完成。该部分由后续子游戏结算接入实现,服务器无需修改。
验证覆盖协议回包、动态人数、重连快照、跨服与确认,以及 Cocos 预览中的列表滚动、按钮防重、结果面板、BitmapFont 倒计时及释放。预览采用测试快照,不能替代多客户端真实服务器投票联调。