import { HTTP_TYPE } from "../datas/CommonData"; import Main from "../Main"; import GameM, { AUDIO_TYPE } from "../manager/GameM"; import GuideMng from "../manager/GuideMng"; import UiM from "../manager/UiM"; import MyExtends from "../tools/MyExtends"; import BasePanel from "../uiFrames/BasePanel"; const { ccclass, property } = cc._decorator; @ccclass export default class MateUnlockPanel extends BasePanel { @property(cc.Node) panelNode: cc.Node = null; @property(cc.Label) txtName: cc.Label = null; @property(cc.Sprite) img: cc.Sprite = null; private mateBtnPos: cc.Vec2 = null; private mateLv: number = -1; onLoad() { this.mateBtnPos = MyExtends.convetOtherNodeSpaceAR(cc.find("Canvas/HallNode/downPart/btnMate"), cc.find("Canvas")); console.log("MateBtnPos:", this.mateBtnPos); } OnEnter(param?) { this.mateLv = param.lv; this.txtName.string = GameM.commonData.fightRoleCfg[param.lv.toString()].name; cc.loader.loadRes('carPic/side/side_' + param.lv, cc.SpriteFrame, (err, asset) => { this.img.spriteFrame = asset; }); this.img.node.setPosition(0, 112); this.img.node.scale = 1; this.node.setPosition(0, 0); this.node.scale = 1; this.panelNode.scale = 0; this.node.active = true; cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" }).start(); this.node.setSiblingIndex(this.node.parent.childrenCount - 1); } OnExit() { cc.tween(this.img.node) .to(0.3, { position: this.mateBtnPos, scale: 0 }) .call(() => { this.node.active = false; this.img.spriteFrame = null; //伙伴引导 孙悟空 if (this.mateLv == 10) { // GuideMng.Ins.CheckMateGuide3(); } else if (this.mateLv == 17) { //解锁伙伴猪八戒 解锁探索 //UiM.Instance.hallNode.getComponent(Main).checkMateLockBtn(3,0); //GuideMng.Ins.CheckInvestGuide5(); } else if (this.mateLv == 23) { //开通富翁银行请求 //GameM.httpM.sendDatas(HTTP_TYPE.backIsOpenRichBank, {}); //GameM.commonData.isopenrichbank = 1; //UiM.Instance.hallNode.getComponent(Main).checkMateLockBtn(4,0); //解锁伙伴猪沙僧 解锁钱庄 富翁银行 // GuideMng.Ins.CheckBankGuide7(); } }) .start(); //cc.tween(this.node) // .to(0.3, { position: this.mateBtnPos, scale: 0 }) // .call(() => { // this.node.active = false; // this.img.spriteFrame = null; // }) // .start(); //this.node.active = false; } Click_GetBtn() { this.OnExit(); GameM.audioM.playEffect(AUDIO_TYPE.button); } Click_CloseBtn() { this.OnExit(); GameM.audioM.playEffect(AUDIO_TYPE.button); } }