消消方块阵换皮表情
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.
 
 
 

87 lines
2.8 KiB

import { _decorator, Component, find, Node, sys } from 'cc';
import { GEvent } from 'db://assets/mx/module/event/GEvent';
import { UIBase } from 'db://assets/mx/module/ui/UIBase';
import { ItemNumType, StatisticsType } from '../../game/GameData';
const { ccclass, property } = _decorator;
@ccclass('atGameSuccess')
export class atGameSuccess extends UIBase {
start() {
}
isCanGetReward = false
rewardNum = 100 //金币数量100
rewardcishuMax = 5
onInit(): void {
let data = this.prema
let layDesc = find('ui_center/layDesc', this.node)
let labDesc = find('ui_center/labDesc', this.node)
if(data && data == 'nextGame'){
find('ui_center/fanhuiBtn', this.node).active = true
find('ui_center/nextBtn', this.node).active = true
find('ui_center/sureBtn', this.node).active = false
let rewardCishu = gg.data.getStatistics(StatisticsType.AtGameRewardCount)
console.log('rewardCishu22', rewardCishu)
if(rewardCishu < this.rewardcishuMax){
this.isCanGetReward = true
layDesc.active = true
labDesc.active = false
gg.data.setStatistics(StatisticsType.AtGameRewardCount, rewardCishu+1)
}else{
this.isCanGetReward = false
layDesc.active = false
labDesc.active = true
}
}else{
find('ui_center/fanhuiBtn', this.node).active = false
find('ui_center/nextBtn', this.node).active = false
find('ui_center/sureBtn', this.node).active = true
let rewardCishu = gg.data.getStatistics(StatisticsType.GaoyaguoRewardCount)
console.log('rewardCishu11', rewardCishu)
if(rewardCishu <= this.rewardcishuMax){
this.isCanGetReward = true
layDesc.active = true
labDesc.active = false
gg.data.setStatistics(StatisticsType.GaoyaguoRewardCount, rewardCishu+1)
}else{
this.isCanGetReward = false
layDesc.active = false
labDesc.active = true
}
}
}
onLoad(): void {
super.onLoad();
}
sureBtnClick(){
//发消息退出
if(this.isCanGetReward){
gg.ui.showToast('领取成功')
gg.data.addItemNum(ItemNumType.money, this.rewardNum)
}
GEvent.Ins.emit(GEvent.ExitAtTrafficGame)
this.close(1)
}
nextGameBtnClick(){
if(this.isCanGetReward){
gg.ui.showToast('领取成功')
gg.data.addItemNum(ItemNumType.money, this.rewardNum)
}
GEvent.Ins.emit(GEvent.nextAtTrafficGame)
this.close(1)
}
}