LineUpUIData.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Data } from "../../../mk/data/Data";
  2. import { RewardType } from "../GameData";
  3. export class LineUpUIData extends Data {
  4. public personCount = 0;
  5. public cashId = 0;
  6. public refresh = false;
  7. public redMoney = 0;
  8. public refresh2 = false;
  9. showTips() {
  10. console.log(`showTips======${gData.gameData.playerProp.lineRedMoney}`);
  11. if (gData.gameData.playerProp.lineRedMoney > 0) {
  12. cc.tween(this).delay(0.5).call(() => {
  13. let add = Math.round(this.redMoney / 100);
  14. mk.tip.pop(`插队成功,并获得${add}红包币`);
  15. }).start();
  16. } else {
  17. console.log("showTips================");
  18. cc.tween(this).delay(0.5).call(() => {
  19. console.log("showTips================2");
  20. mk.tip.pop("插队成功");
  21. }).start();
  22. }
  23. }
  24. setAdData(data) {
  25. //mk.console.logSingle('LineUpUIData addata ', this.adData);
  26. super.setAdData(data);
  27. console.log(`LineUpUIData=========${data}`);
  28. this.redMoney = 0;
  29. let rewardData = this.adData.videoRedMoney.videoRewardList;
  30. for (let i = 0; i != rewardData.length; ++i) {
  31. if (rewardData[i].rewardType == RewardType.redBag) {
  32. this.redMoney = rewardData[i].rewardNum;
  33. gData.gameData.playerProp.redMoney += this.redMoney;
  34. break;
  35. }
  36. }
  37. this.showTips();
  38. gData.gameData.playerProp.lineRedMoney = data.lineRedMoney;
  39. this.refresh2 = true;
  40. //gData.reward.data = gData.lineUpUIData.adData.videoRedMoney.videoRewardList;
  41. // let world_Pos = this.node_fly.parent.convertToWorldSpaceAR(this.node_fly.getPosition());
  42. // gData.reward.getReward(world_Pos);
  43. }
  44. }