| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import JsbSystem from "../../../mk/system/JsbSystem";
- import { UITween } from "../../component/tween/UITween";
- import { VideoAdType } from "../../data/GameData";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export class GradeRewardItem extends cc.Component{
- @property({displayName:"名字", type: cc.Sprite})
- private sp_name: cc.Sprite = null;
- @property({displayName:"等级", type: cc.Label})
- private lbl_grade: cc.Label = null;
- @property({displayName:"金额",type: cc.Label})
- private lbl_value: cc.Label = null;
- @property({type: cc.Node})
- private node_unGetRewad: cc.Node = null;
- @property({type: cc.Node})
- private node_unluck: cc.Node = null;
- @property({type: cc.Node})
- private node_getRewad: cc.Node = null;
- public id: number;
- private data:any = {};
- onLoad(){
- }
- async start(){
- this.id = this.data.id;
- this.lbl_value.string = this.data.showMoney;
- this.lbl_grade.string = `LV:${this.data.level}`;
- this.sp_name.spriteFrame = await mk.loader.load('module/gradeReward/texture/name' + this.id, cc.SpriteFrame);
-
- this.changeBtnState();
-
- this.showUIAct();
- }
- changeBtnState()
- {
- if( this.data.status == 1)
- {
- this.node_unGetRewad.active = true;
- this.node_unluck.active = false;
- this.node_getRewad.active = false;
-
- }else if (this.data.status == 0){
- this.node_unGetRewad.active = false;
- this.node_unluck.active = true;
- this.node_getRewad.active = false;
-
- }
- else{
- this.node_unGetRewad.active = false;
- this.node_unluck.active = false;
- this.node_getRewad.active = true;
- }
- }
- setData(data)
- {
- this.data = data;
- }
- public showUIAct()
- {
- let p = this.node.position;
- this.node.position = cc.v3(540, p.y, 0);
- cc.tween(this.node).delay(0.9 - this.id * 0.1).call(()=>{
- this.node.active = true;
- }).to(0.2, {x: 0}).start();
- }
- private clickUnGetRewardBtn(){
- mk.audio.playEffect("button");
-
- if (cc.sys.isNative && !gData.loginData.isAuth) {
- // JsbSystem.WxAuth();
- gData.gameData.authUIType = 0;
- mk.ui.openPanel('module/authUI/authUI');
- return;
- }
- gData.adData.checkPopCashFull();
- gData.farmGradeData.HttpCashOut(this.data.id);
- // mk.ad.videoAdType = VideoAdType.farmGradeCashOut;
- // mk.ad.watchAd((success: boolean) => {
- // mk.console.log("watchFarmAd:" + success);
- // if (success) {
- // }
- // });
- }
- private clickNoReachBtn(){
- mk.audio.playEffect("button");
- mk.tip.pop('提现进度不足');
- }
- private clickGetRewardBtn(){
- mk.audio.playEffect("button");
- mk.tip.pop('该红包已提现');
- }
- }
|