// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html import GameM, { AUDIO_TYPE } from "../manager/GameM"; import LogUtil from "../utils/LogUtil"; import { Utils } from "../utils/Utils"; const { ccclass, property } = cc._decorator; @ccclass export default class ClubMain extends cc.Component { // LIFE-CYCLE CALLBACKS: private clubActivePrefab: cc.Prefab = null private clubInvitePrefab: cc.Prefab = null private clubMinePrefab: cc.Prefab = null @property(cc.Toggle) activeToggle: cc.Toggle = null @property(cc.Toggle) inviteToggle: cc.Toggle = null @property(cc.Toggle) mineToggle: cc.Toggle = null @property(cc.Node) topNode: cc.Node = null @property(cc.Node) bottomNode: cc.Node = null @property(cc.Node) centerNode: cc.Node = null @property(cc.Node) alertNode: cc.Node = null private addY = 0 async onLoad() { LogUtil.logV("ClubMain", "start") this.node.height = cc.winSize.height this.addY = cc.winSize.height - 1334 // this.topNode.y += this.addY // this.bottomNode.y -= this.addY this.clubActivePrefab = await Utils.loadResPromise("prefabs/club/clubActiveNode") this.clubInvitePrefab = await Utils.loadResPromise("prefabs/club/clubInviteNode") this.clubMinePrefab = await Utils.loadResPromise("prefabs/club/clubMineNode") // this.scheduleOnce(()=>{ GameM.ClubData.requestClubGetBaseInfo() //暂时不用 // GameM.ClubData.autoCollectBubbles() // },1) this.checkPage(null, 1) } /**招募 */ inviteNode: cc.Node = null /**我的 */ mineNode: cc.Node = null /**活跃 */ activeNode: cc.Node = null // } /** * * @param index 显示页签 */ checkPage(event, type) { GameM.audioM.playEffect(AUDIO_TYPE.button) let index: number = Number(type) if (index == 1) { this.topNode.active = false this.centerNode.active = true if (cc.isValid(this.inviteNode)) { this.inviteNode.active = true } else { this.inviteNode = cc.instantiate(this.clubInvitePrefab) this.inviteNode.parent = this.centerNode // this.inviteNode.position = cc.v3(0, 752, 0) } if (cc.isValid(this.mineNode)) { this.mineNode.active = false } if (cc.isValid(this.activeNode)) { this.activeNode.active = false } } else if (index == 2) { this.topNode.active = true this.centerNode.active = true if (cc.isValid(this.mineNode)) { this.mineNode.active = false } if (cc.isValid(this.activeNode)) { this.activeNode.active = true } else { this.activeNode = cc.instantiate(this.clubActivePrefab) this.activeNode.parent = this.centerNode // this.activeNode.position = cc.v3(0, -40, 0) } if (cc.isValid(this.inviteNode)) { this.inviteNode.active = false } } else if (index == 3) { this.topNode.active = true this.centerNode.active = true if (cc.isValid(this.mineNode)) { this.mineNode.active = true } else { this.mineNode = cc.instantiate(this.clubMinePrefab) this.mineNode.parent = this.centerNode // this.mineNode.position = cc.v3(0, -40, 0) } if (cc.isValid(this.activeNode)) { this.activeNode.active = false } if (cc.isValid(this.inviteNode)) { this.inviteNode.active = false } } } clickBack() { GameM.audioM.playEffect(AUDIO_TYPE.button) this.node.destroy() } // update (dt) {} }