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.
118 lines
3.2 KiB
118 lines
3.2 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 UiBase from "../GameBase/UiBase";
|
|
import LevelUpManager from "../Manager/LevelUpManager";
|
|
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 UiBase {
|
|
@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("sound/按键点击")
|
|
|
|
this.node.removeFromParent();
|
|
this.node.destroy()
|
|
}
|
|
|
|
btnJinRuCeBianLan() {
|
|
//Common5.playEffect("sound/按键点击")
|
|
//检测侧边栏是否可用
|
|
|
|
//EventMgr.emitEvent_custom(ryw_Event.CheckCeBianLan,false);
|
|
TTAPI.navigateToScene(() => {
|
|
console.log('加入侧边栏成功')
|
|
}, () => {
|
|
console.log('加入侧边栏失败')
|
|
})
|
|
}
|
|
|
|
onBtnClickGetAward() {
|
|
//Common5.playEffect("sound/按键点击")
|
|
console.log('领取奖励')
|
|
Common5.isCeBianLanEnter = false
|
|
User.setFinishCeBianLanAward(true)
|
|
|
|
// let earnMoney = LevelUpManager.levelUpSpned()
|
|
// if(earnMoney*3>=500000){
|
|
// earnMoney = earnMoney*3
|
|
// }else{
|
|
// earnMoney = 500000
|
|
// }
|
|
|
|
|
|
// UserManager.addMoney(earnMoney)
|
|
// //EventMgr.emitEvent_custom(ryw_Event.CheckCeBianLan,false);
|
|
// let str = Common5.getNumberChangeHanzi(earnMoney,'1',1)
|
|
// PrefabManage.showTextTips('成功获得'+str+'金币!')
|
|
|
|
//自动点击*1
|
|
let time = User.getAutoClickTime()
|
|
User.setAutoClickTime(5 * 60 + time)
|
|
User.addAutoLevel()
|
|
EventMgr.emitEvent_custom(ryw_Event.RefreshLevelLab)
|
|
|
|
EventMgr.emitEvent_custom(ryw_Event.updateHideBtn);
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|