咸鱼的反击
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.
 
 
 
xianyudefanji/assets/Scripts/Challenge/ChallengeFail.ts

138 lines
4.6 KiB

// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
import User from "../../FrameWork/User/User";
import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
import qipao from "../CommonRes/qipao";
import UiBase from "../GameBase/UiBase";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import LevelUpManager from "../Manager/LevelUpManager";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
const { ccclass, property } = cc._decorator;
@ccclass
export default class ChallengeFail extends UiBase {
@property(cc.Label)
lianLabel: cc.Label = null;
@property(cc.Label)
lianLabel2: cc.Label = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start() {
Common5.showInterstitialAd()
this.refreshView()
}
refreshView() {
let num = User.getClickIncomeNum()
if (num == 0) {
num = 1
}
if (num >= 9999) {
let numLab = Common5.getNumberChangeHanzi(num, '1', 1)
this.lianLabel.string = '玩家攻击力x' + numLab
this.lianLabel2.string = 'x' + numLab
} else {
this.lianLabel.string = '玩家攻击力x' + num
this.lianLabel2.string = 'x' + num
}
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_506 && !User.getStatistics("挑战失败引导秘书")) {
User.setStatistics("挑战失败引导秘书", 1)
this.node.getChildByName("mishu").getChildByName("手指箭头").active = true
let mishubtn = this.node.getChildByName("mishu").getChildByName("videoBtn")
PrefabManage.loadPrefabByType(GameType.qipao, this.node, (node) => {
let worldpos = mishubtn.parent.convertToWorldSpaceAR(mishubtn.getPosition())
let position = this.node.convertToNodeSpaceAR(worldpos)
position.y += mishubtn.getContentSize().height / 2
node.getComponent(qipao).init(1, false, position)
})
}
}
backBtnClick() {
//Common5.playEffect("sound/按键点击")
this.node.removeFromParent()
this.node.destroy()
EventMgr.emitEvent_custom(ryw_Event.challengeQuit)
}
restartBtnClick() {
//Common5.playEffect("sound/按键点击")
this.node.removeFromParent()
this.node.destroy()
EventMgr.emitEvent_custom(ryw_Event.challengeRestart)
}
aotuBtnClick(event) {
//Common5.playEffect("sound/按键点击")
let tab = {
onClose: (finish) => {
if (finish) {
let num = LevelUpManager.getShouyi()
User.setClickIncomeNum(num)
this.refreshView()
User.setShowAdNum(User.getShowAdNum() + 1)
Common5.ReportDY("inLevel", `任务${TaskManager.getCurUnLockMainTaskId()}-AD-挑战失败点击收益`)
// Common5.ReportDY("inLevel", "挑战失败-AD-点击收益");
EventMgr.emitEvent_custom(ryw_Event.levelUpChange)
}
else {
Common5.showTips_custom("广告未观看完");
}
}, onFailed: () => {
}
}
AppPlatform.playVideo_custom(tab)
}
openMishuBtnClick() {
//Common5.playEffect("sound/按键点击")
this.node.removeFromParent()
this.node.destroy()
EventMgr.emitEvent_custom(ryw_Event.challengeAllQuit)
PrefabManage.loadPrefabByType(GameType.MishuGame)
}
opneLevelBtnClick() {
//Common5.playEffect("sound/按键点击")
this.node.removeFromParent()
this.node.destroy()
EventMgr.emitEvent_custom(ryw_Event.challengeAllQuit)
// PrefabManage.loadPrefabByType(GameType.PeopleLevelUp)
}
opneTanWeiBtnClick() {
//Common5.playEffect("sound/按键点击")
this.node.removeFromParent()
this.node.destroy()
EventMgr.emitEvent_custom(ryw_Event.challengeAllQuit)
PrefabManage.loadPrefabByType(GameType.TanWei)
}
// update (dt) {}
}