咸鱼的反击
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/LixianGame/LixianGameScript.ts

92 lines
2.8 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 User from "../../FrameWork/User/User";
import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
import UiBase from "../GameBase/UiBase";
import TaskManager from "../JuQingChat/TaskManager";
import InterfaceManager from "../Manager/InterfaceManager";
import LevelUpManager from "../Manager/LevelUpManager";
import UserManager from "../Manager/UserManager";
const { ccclass, property } = cc._decorator;
@ccclass
export default class LixianGameScript extends UiBase {
@property(cc.Label)
moneyLab: cc.Label = null;
@property(cc.Label)
timeLab: cc.Label = null;
moneyNum = 0
start() {
let time0 = Common5.lixianTime / 1000
let time1 = time0 / 60
console.log(time1, 'fen+++++++++++===')
let earnMoney = LevelUpManager.levelUpSpned()
console.log(earnMoney, 'earnMoney+++++++++++===')
let maxTime = 4.5 * 60 //最大累计离线时间
if (time1 < 10) {
earnMoney = earnMoney * time1 * 0.002
} else if (time1 >= 10 && time1 <= maxTime) {
earnMoney = earnMoney * time1 * 0.002
} else if (time1 > maxTime) {
earnMoney = earnMoney * maxTime * 0.002
}
if (earnMoney < 50000) {
earnMoney = 50000
}
this.moneyNum = earnMoney
this.moneyLab.string = Common5.getNumberChangeHanzi(earnMoney) + ''
this.timeLab.string = `${time0}`
}
lingquBtnClick(event) {
let target = event.target
UserManager.addMoney(this.moneyNum, target)
this.node.removeFromParent()
this.node.destroy()
}
lingquADBtnClick(event) {
//Common5.playEffect("sound/按键点击")
let target = event.target
let tab = {
onClose: (finish) => {
if (finish) {
User.setShowAdNum(User.getShowAdNum() + 1)
Common5.ReportDY("inLevel", `任务${TaskManager.getCurUnLockMainTaskId()}-AD-离线五倍`)
// Common5.ReportDY("inLevel", "离线-AD-五倍");
UserManager.addMoney(this.moneyNum * 5, target)
this.node.removeFromParent()
this.node.destroy()
}
else {
Common5.showTips_custom("广告未观看完");
}
}, onFailed: () => {
}
}
AppPlatform.playVideo_custom(tab)
}
// update (dt) {}
}