feat(map): add single panel display logic and barbtn prefab
1. 新增closeAllPanels方法,实现打开面板前自动关闭其他所有面板 2. 为英雄池、技能池、装备商店、商品商店的切换逻辑添加单面板显示校验 3. 新增barbtn按钮预制体及其元数据文件
This commit is contained in:
1130
assets/resources/gui/element/barbtn.prefab
Normal file
1130
assets/resources/gui/element/barbtn.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/resources/gui/element/barbtn.prefab.meta
Normal file
13
assets/resources/gui/element/barbtn.prefab.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "99b1fd19-5e71-4e63-9682-d82b23244510",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "barbtn"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -519,12 +519,20 @@ export class MissionCardComp extends CCComp {
|
||||
* 技能卡池显隐切换按钮回调:
|
||||
* - 仅切换 skill_card_node 的 active 状态,不执行抽卡。
|
||||
* - 后续刷新需通过技能刷新按钮(skill_refresh)触发。
|
||||
* - 打开前关闭其他面板,确保同时只显示一个。
|
||||
*/
|
||||
private onShowSkillsClick() {
|
||||
if (!this.skill_card_node || !this.skill_card_node.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
const visible = !this.skill_card_node.active;
|
||||
if (visible) {
|
||||
this.closeAllPanels();
|
||||
}
|
||||
this.skill_card_node.active = visible;
|
||||
const activeChild = this.showSkills?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
activeChild.active = visible;
|
||||
}
|
||||
}
|
||||
|
||||
/** 关闭技能卡池按钮回调 */
|
||||
@@ -532,6 +540,10 @@ export class MissionCardComp extends CCComp {
|
||||
if (!this.skill_card_node || !this.skill_card_node.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
this.skill_card_node.active = false;
|
||||
const activeChild = this.showSkills?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
activeChild.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ======================== 商店面板 ========================
|
||||
@@ -539,11 +551,20 @@ export class MissionCardComp extends CCComp {
|
||||
/**
|
||||
* 商店显隐切换按钮回调:
|
||||
* 切换 shopPanNode 的 active 状态。
|
||||
* 打开前关闭其他面板,确保同时只显示一个。
|
||||
*/
|
||||
private onShowShopClick() {
|
||||
if (!this.shopPanNode || !this.shopPanNode.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
this.shopPanNode.active = !this.shopPanNode.active;
|
||||
const visible = !this.shopPanNode.active;
|
||||
if (visible) {
|
||||
this.closeAllPanels();
|
||||
}
|
||||
this.shopPanNode.active = visible;
|
||||
const activeChild = this.showShop?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
activeChild.active = visible;
|
||||
}
|
||||
}
|
||||
|
||||
/** 关闭商店按钮回调 */
|
||||
@@ -551,6 +572,10 @@ export class MissionCardComp extends CCComp {
|
||||
if (!this.shopPanNode || !this.shopPanNode.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
this.shopPanNode.active = false;
|
||||
const activeChild = this.showShop?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
activeChild.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -832,15 +857,59 @@ export class MissionCardComp extends CCComp {
|
||||
this.playButtonResetAnim(this.cards_chou);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭所有面板(英雄卡池、技能卡池、装备商店、商品商店)。
|
||||
* 用于打开新面板前确保同时只显示一个面板。
|
||||
* 同时关闭所有按钮的 active 子节点状态。
|
||||
*/
|
||||
private closeAllPanels() {
|
||||
// 关闭英雄卡池
|
||||
if (this.cards_node && this.cards_node.isValid) {
|
||||
this.cards_node.active = false;
|
||||
}
|
||||
if (this.showHeros && this.showHeros.isValid) {
|
||||
const activeChild = this.showHeros.getChildByName("active");
|
||||
if (activeChild) activeChild.active = false;
|
||||
}
|
||||
// 关闭技能卡池
|
||||
if (this.skill_card_node && this.skill_card_node.isValid) {
|
||||
this.skill_card_node.active = false;
|
||||
}
|
||||
if (this.showSkills && this.showSkills.isValid) {
|
||||
const activeChild = this.showSkills.getChildByName("active");
|
||||
if (activeChild) activeChild.active = false;
|
||||
}
|
||||
// 关闭装备商店
|
||||
if (this.equipsPanNode && this.equipsPanNode.isValid) {
|
||||
this.equipsPanNode.active = false;
|
||||
}
|
||||
if (this.showEquips && this.showEquips.isValid) {
|
||||
const activeChild = this.showEquips.getChildByName("active");
|
||||
if (activeChild) activeChild.active = false;
|
||||
}
|
||||
// 关闭商品商店
|
||||
if (this.shopPanNode && this.shopPanNode.isValid) {
|
||||
this.shopPanNode.active = false;
|
||||
}
|
||||
if (this.showShop && this.showShop.isValid) {
|
||||
const activeChild = this.showShop.getChildByName("active");
|
||||
if (activeChild) activeChild.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 英雄卡池显隐切换按钮回调:
|
||||
* - 切换 cards_node 的 active 状态。
|
||||
* - 显示时激活 showHeros 下的 "active" 子节点,隐藏时关闭该子节点。
|
||||
* - 打开前关闭其他面板,确保同时只显示一个。
|
||||
*/
|
||||
private onShowHerosClick() {
|
||||
if (!this.cards_node || !this.cards_node.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
const visible = !this.cards_node.active;
|
||||
if (visible) {
|
||||
this.closeAllPanels();
|
||||
}
|
||||
this.cards_node.active = visible;
|
||||
const activeChild = this.showHeros?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
@@ -871,11 +940,20 @@ export class MissionCardComp extends CCComp {
|
||||
/**
|
||||
* 装备商店显隐切换按钮回调:
|
||||
* 切换 equipsPanNode 的 active 状态。
|
||||
* 打开前关闭其他面板,确保同时只显示一个。
|
||||
*/
|
||||
private onShowEquipsClick() {
|
||||
if (!this.equipsPanNode || !this.equipsPanNode.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
this.equipsPanNode.active = !this.equipsPanNode.active;
|
||||
const visible = !this.equipsPanNode.active;
|
||||
if (visible) {
|
||||
this.closeAllPanels();
|
||||
}
|
||||
this.equipsPanNode.active = visible;
|
||||
const activeChild = this.showEquips?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
activeChild.active = visible;
|
||||
}
|
||||
}
|
||||
|
||||
/** 关闭装备商店按钮回调 */
|
||||
@@ -883,6 +961,10 @@ export class MissionCardComp extends CCComp {
|
||||
if (!this.equipsPanNode || !this.equipsPanNode.isValid) return;
|
||||
oops.audio.playEffect("music/button");
|
||||
this.equipsPanNode.active = false;
|
||||
const activeChild = this.showEquips?.getChildByName("active");
|
||||
if (activeChild) {
|
||||
activeChild.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user