import { RichData, RichPropItemParam } from "../datas/RichData"; import AdM from "../manager/AdM"; import GameM, { AUDIO_TYPE, VIDEO_TYPE } from "../manager/GameM"; import GuideMng from "../manager/GuideMng"; import UiM from "../manager/UiM"; import RoadItem from "../other/item/RoadItem"; import Roads from "../other/item/Roads"; import MyExtends from "../tools/MyExtends"; import BasePanel from "../uiFrames/BasePanel"; import Random from "../utils/Random"; import EffectNode from "./EffectNode"; const { ccclass, property } = cc._decorator; @ccclass export default class RichPropPanel extends BasePanel { @property(cc.Node) panelNode: cc.Node = null; @property(cc.Node) panel_ctrl: cc.Node = null; @property(cc.Node) panel_double: cc.Node = null; @property(cc.Node) panel_getdice: cc.Node = null; @property(cc.Node) panel_getCtrl: cc.Node = null; @property(cc.Label) txtDouble: cc.Label = null; @property(cc.Node) diceAry: cc.Node[] = []; @property(cc.Node) diceSelect: cc.Node = null; @property(cc.Node) txtNodeFreeOver: cc.Node = null; @property(cc.Node) txtNodeFree: cc.Node = null; @property(cc.Label) txtDiceAd: cc.Label = null; @property(cc.Label) txtRevertTimer: cc.Label = null; @property(cc.Label) txtRevertNum: cc.Label = null; @property(cc.Node) btnSure: cc.Node = null; revertUpdateTimer: number = 0; /**界面类型 1 使用遥控卡 2 使用双倍卡 3 获取骰子 4 获取遥控卡*/ panelType: number = 1; diceNum: number = 0; OnEnter(type: number) { this.panelType = type; this.panelNode.scale = 0; this.node.active = true; cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" }) .call(() => { if (type == 1) { //引导取经 大富翁 GuideMng.Ins.CheckRichGuide24(); } else if (type == 2) { //引导取经 大富翁 GuideMng.Ins.CheckRichGuide25(); } }) .start(); this.panel_ctrl.active = type == 1; this.panel_double.active = type == 2; this.panel_getdice.active = type == 3; this.panel_getCtrl.active = type == 4; switch (type) { case 1: this.diceNum = 0; this.diceSelect.active = false; this.btnSure.active = true; break; case 2: this.btnSure.active = true; this.txtDouble.string = RichData.Ins.richItemCardCfg.doubleTimes + ""; break; case 3: let n = RichData.Ins.richItemCardCfg.diceDailyMax - RichData.Ins.adDiceDaily; this.txtNodeFreeOver.active = n == 0; this.txtNodeFree.active = n > 0; this.txtDiceAd.string = n > 0 ? n + "" : "";// "(" + RichData.Ins.adDiceDaily + "/" + RichData.Ins.richItemCardCfg.diceDailyMax + ")"; this.txtRevertNum.string = RichData.Ins.richItemCardCfg.diceDailyTimes + ""; this.txtRevertTimer.string = MyExtends.TimeToFormat(RichData.Ins.revertTimer, 3); this.revertUpdateTimer = 0; this.btnSure.active = false; break; case 4: this.btnSure.active = false; break; } } OnExit() { this.node.active = false; } update(dt) { this.TimerRevertDice(dt); } TimerRevertDice(dt) { if (RichData.Ins.revertTimer != 0) { this.revertUpdateTimer += dt; if (this.revertUpdateTimer > 1) { this.revertUpdateTimer = 0; this.txtRevertTimer.string = MyExtends.TimeToFormat(RichData.Ins.revertTimer, 3); } } else { this.revertUpdateTimer += dt; if (this.revertUpdateTimer > 1) { this.revertUpdateTimer = 0; this.txtRevertTimer.string = MyExtends.TimeToFormat(RichData.Ins.revertTimer, 3); } } } Click_DiceBtn(event, index) { if (!this.diceSelect.active) this.diceSelect.active = true; this.diceNum = parseInt(index) + 1; this.diceSelect.setPosition(this.diceAry[this.diceNum - 1].getPosition()); GameM.audioM.playEffect(AUDIO_TYPE.button); } /**日常任务按钮*/ Click_GoToTaskBtn() { console.log("go to task panel"); this.OnExit(); RichData.Ins.richPanel.OnExit(); UiM.Instance.taskNode.active = true; GameM.audioM.playEffect(AUDIO_TYPE.button); } /**视频获取骰子按钮*/ Click_DiceAdBtn() { //看广告 if (RichData.Ins.adDiceDaily < RichData.Ins.richItemCardCfg.diceDailyMax) { GameM.adM.watchVideo(VIDEO_TYPE.richGetDiceAd); GameM.audioM.playEffect(AUDIO_TYPE.button); AdM.onSendEvent('video_init_18', '取经免费获得骰子拉起', 'video_init') } else { EffectNode.instance.PlayTip("观看次数已用完"); } } /**视频获取骰子回调*/ DiceAdEnd() { console.log("DiceAdEnd get dice"); let p = new RichPropItemParam(); p.diceAdvertise = 1; RichData.Ins.UpdateItemCardNew(p, () => { let n = RichData.Ins.richItemCardCfg.diceDailyMax - RichData.Ins.adDiceDaily; this.txtNodeFreeOver.active = n == 0; this.txtNodeFree.active = n > 0; this.txtDiceAd.string = n > 0 ? n + "" : "";// "(" + RichData.Ins.adDiceDaily + "/" + RichData.Ins.richItemCardCfg.diceDailyMax + ")"; EffectNode.instance.PlayTip("恭喜获得" + RichData.Ins.richItemCardCfg.diceDailyTimes + "个骰子"); this.OnExit(); }); //RichData.Ins.UpdateItemCard(this.num, 0, 0, 0, 1, 0, -1, () => { // RichData.Ins.MoveEnd(); // RichData.Ins.PlayParticleEft(this.propType, 2, this.node); // this.ClearState(); //},false); AdM.onSendEvent('video_end_18', '取经免费获得骰子拉起', 'video_end') } /**获取遥控卡*/ Click_GetCtrlBtn() { //看广告 GameM.adM.watchVideo(VIDEO_TYPE.richCtrlAd); GameM.audioM.playEffect(AUDIO_TYPE.button); AdM.onSendEvent(`video_init_17`, `取经免费获得遥控卡视频拉起`, 'video_init'); } /**获取遥控卡 广告回调*/ AdRichCtrlEnd() { RichData.Ins.UpdateItemCard(0, 0, 0, 1, 0, 0, 0); this.OnExit(); } Click_SureBtn() { switch (this.panelType) { case 1: if (this.diceNum > 0) { RichData.Ins.UseCtrlCard(this.diceNum); this.OnExit(); AdM.onSendEvent('Qujing_UseControl', '取经使用遥控卡', "qujing"); } else { EffectNode.instance.PlayTip("请先选择掷骰子的点数"); } break; case 2: if (RichData.Ins.doubleNum > 0) { RichData.Ins.UseDoubleCard(); AdM.onSendEvent('Qujing_UseDouble', '取经使用双倍卡', "qujing"); } this.OnExit(); break; case 3: this.OnExit(); break; } GameM.audioM.playEffect(AUDIO_TYPE.button); } Click_CloseBtn() { this.OnExit(); GameM.audioM.playEffect(AUDIO_TYPE.button); } } /* IT 2.35 Program Files 3.38 Program Files 86 4.76 ProgramData 1.42 Windows 23.7 Windows.old 34.7 (占用 28.9) 用户 31.5 (占用 25.9) hiberfil.sys 6.38 pagefile.sys 10 */