You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.6 KiB
99 lines
2.6 KiB
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import TTAPI from "../../Platform/tt/TTAPI";
|
|
import UserManager from "../Manager/UserManager";
|
|
import PrefabManage from "../PrefabManager/PrefabManage";
|
|
import GameBase from "./GameBase";
|
|
|
|
// import DayUnlock from "../../ttFrame/manager/DayUnlock";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class CeBianLan extends GameBase {
|
|
@property(cc.Node)
|
|
btnEnter: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
btnGetAward: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
getRewardBtn: cc.Node = null;
|
|
|
|
|
|
|
|
|
|
|
|
onDestroy() {
|
|
super.onDestroy()
|
|
}
|
|
|
|
onLoad(): void {
|
|
super.onLoad()
|
|
this.checkIsShowJiangLiBtn()
|
|
EventMgr.onEvent_custom(ryw_Event.CheckIsEnterFromCeBianLan, () => {
|
|
this.checkIsShowJiangLiBtn()
|
|
}, this);
|
|
}
|
|
|
|
btnCloseFunc() {
|
|
|
|
// Common5.playEffect("GameRes/sound/UI按钮")
|
|
|
|
this.node.removeFromParent();
|
|
this.node.destroy()
|
|
}
|
|
|
|
btnJinRuCeBianLan() {
|
|
// Common5.playEffect("GameRes/sound/UI按钮")
|
|
//检测侧边栏是否可用
|
|
|
|
//EventMgr.emitEvent_custom(ryw_Event.CheckCeBianLan,false);
|
|
TTAPI.navigateToScene(() => {
|
|
console.log('加入侧边栏成功')
|
|
}, () => {
|
|
console.log('加入侧边栏失败')
|
|
})
|
|
}
|
|
|
|
onBtnClickGetAward() {
|
|
// Common5.playEffect("GameRes/sound/UI按钮")
|
|
console.log('领取奖励')
|
|
Common5.isCeBianLanEnter = false
|
|
User.setFinishCeBianLanAward(true)
|
|
UserManager.addMoney(20000)
|
|
//EventMgr.emitEvent_custom(ryw_Event.CheckCeBianLan,false);
|
|
PrefabManage.showTextTips('成功获得20000金币!')
|
|
this.node.removeFromParent();
|
|
this.node.destroy()
|
|
}
|
|
|
|
checkIsShowJiangLiBtn() {
|
|
//是否已经领取过奖励
|
|
|
|
let isGetAward = User.getFinishCeBianLanAward()
|
|
|
|
console.log(isGetAward, 'isGetAward')
|
|
console.log(Common5.isCeBianLanEnter, 'isCeBianLanEnter')
|
|
|
|
if (Common5.isCeBianLanEnter && !isGetAward) {
|
|
this.btnEnter.active = false
|
|
this.btnGetAward.active = true
|
|
} else {
|
|
|
|
if (isGetAward) {
|
|
this.getRewardBtn.active = true
|
|
this.btnEnter.active = false
|
|
} else {
|
|
this.btnEnter.active = true
|
|
this.getRewardBtn.active = false
|
|
}
|
|
|
|
|
|
|
|
this.btnGetAward.active = false
|
|
}
|
|
}
|
|
}
|
|
|