| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import AdM from "../manager/AdM";
- import GameM, { AUDIO_TYPE, VIDEO_TYPE } from "../manager/GameM";
- import GuideMng from "../manager/GuideMng";
- import RoadItem from "../other/item/RoadItem";
- import BasePanel from "../uiFrames/BasePanel";
- import Sciencen_M from "../utils/Sciencen_M";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class RichRewardPanel extends BasePanel {
- @property(cc.Node)
- panelNode: cc.Node = null;
- @property(cc.Sprite)
- rewardImg: cc.Sprite = null;
- @property(cc.Label)
- txtNum: cc.Label = null;
- /**界面类型 10001 金币 10002 红包币 10004 武将宝盒 20001 加速卡 20002 转盘卡 20003 夺宝券 20006 天赋石 30001 骰子 30002 遥控卡 30003 传送阵 30004 经书 30005 双倍卡*/
- panelType: number = 1;
- roadItem: RoadItem = null;
- /*
-
- */
- OnEnter(roaditem: RoadItem) {
- this.roadItem = roaditem;
- this.panelType = roaditem.propType;
- this.panelNode.scale = 0;
- this.node.active = true;
- cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" })
- .call(() => {
- })
- .start();
- let url = "xiyou/icon/reward" + roaditem.propType;
- if (roaditem.propType == 10001) {
- if (roaditem.num <= 49) {
- url = "xiyou/icon/reward10001";
- } else if (roaditem.num <= 99) {
- url = "xiyou/icon/reward10001_2";
- } else {
- url = "xiyou/icon/reward10001_3";
- }
- }
- else if (roaditem.propType == 10002) {
- if (roaditem.num <= 49) {
- url = "xiyou/icon/reward10002";
- } else if (roaditem.num <= 99) {
- url = "xiyou/icon/reward10002_2";
- } else {
- url = "xiyou/icon/reward10002_3";
- }
- }
- cc.loader.loadRes(url, cc.SpriteFrame, (error, assets) => {
- if (error != null) {
- return;
- }
- this.rewardImg.spriteFrame = assets;
- });
- if (roaditem.propType != 10001) {
- this.txtNum.string = roaditem.num * roaditem.dispalyTimes + "";
- } else {
- this.txtNum.string = Sciencen_M.instance.format(Sciencen_M.instance.accMul(GameM.commonData.goldSecond.toString(), (roaditem.num * roaditem.dispalyTimes * 60).toString()));
- //this.txtNum.string = roaditem.num * roaditem.dispalyTimes + "分钟";
- }
- AdM.showNative();
- }
- OnExit() {
- this.node.active = false;
- AdM.destroyNative()
- }
- Click_GetBtn() {
- if (this.roadItem != null)
- this.roadItem.GetReward();
- this.OnExit();
- GameM.audioM.playEffect(AUDIO_TYPE.button);
- }
- Click_CloseBtn() {
- if (this.roadItem != null)
- this.roadItem.GetReward();
- this.OnExit();
- GameM.audioM.playEffect(AUDIO_TYPE.button);
- }
- }
|