MoreGame.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * @description 互推界面
  3. * @author kaka
  4. */
  5. const { ccclass, property } = cc._decorator;
  6. @ccclass
  7. export default class MoreGame extends cc.Component {
  8. @property(cc.Node)
  9. node_sv: cc.Node = null;
  10. @property(cc.Prefab)
  11. moreGameNormalNode: cc.Prefab = null
  12. private normalDatas = null
  13. start() {
  14. this.node.setContentSize(cc.winSize)
  15. gData.moreGame.init();
  16. mk.ad.showInterAd(0);
  17. mk.ad.destoryBanner();
  18. }
  19. update() {
  20. if (gData.moreGame.init_moreGameList) {
  21. this.initView();
  22. }
  23. }
  24. lateUpdate() {
  25. gData.moreGame.init_moreGameList = false;
  26. }
  27. initView() {
  28. this.normalDatas = gData.moreGame.moreGameList.normal;
  29. let data = [];
  30. let len = this.normalDatas.length;
  31. for (var i = 0; i < len; i++) {
  32. let pfbType = 0;
  33. let obj = {
  34. item_data: this.normalDatas[i],
  35. pfbType: pfbType
  36. }
  37. data.push(obj);
  38. if (i == 1) {
  39. pfbType = 1;
  40. let obj = {
  41. item_data: gData.moreGame.moreGameList.banner,
  42. pfbType: pfbType
  43. }
  44. data.push(obj);
  45. }
  46. }
  47. this.node_sv.emit('srollview-init', data)
  48. }
  49. onClickClose() {
  50. mk.ad.showBanner();
  51. // mk.ad.checkShowInterByChance();
  52. }
  53. }