difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
"use strict";
cc._RF.push(module, 'e66e9PqqoRA05MdeWM280KE', 'timesummon_controller');
// Scripts/mod/timesummon/timesummon_controller.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//      这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: 2019-07-08 20:48:58
// --------------------------------------------------------------------
var TimesummonEvent = require("timesummon_event");
 
var TimesummonController = cc.Class({
  "extends": BaseController,
  ctor: function ctor() {},
  // 初始化配置数据
  initConfig: function initConfig() {
    var TimesummonModel = require("timesummon_model");
 
    this.model = new TimesummonModel();
    this.model.initConfig();
  },
  // 返回当前的model
  getModel: function getModel() {
    return this.model;
  },
  // 注册监听事件
  registerEvents: function registerEvents() {},
  requestTimeSummonData: function requestTimeSummonData() {
    var protocal = {};
    this.SendProtocal(23216, protocal);
  },
  // -- 请求限时召唤
  requestTimeSummon: function requestTimeSummon(times, recruit_type) {
    var protocal = {};
    protocal.times = times;
    protocal.recruit_type = recruit_type;
    this.SendProtocal(23217, protocal);
  },
  // -- 请求领取礼包
  requestSummonGetAward: function requestSummonGetAward() {
    var protocal = {};
    this.SendProtocal(23218, protocal);
  },
  send23219: function send23219(bid) {
    var protocal = {};
    protocal.bid = bid;
    this.SendProtocal(23219, protocal);
  },
  // 注册协议接受事件
  registerProtocals: function registerProtocals() {
    // this.RegisterProtocal(1110, this.on1110);
    this.RegisterProtocal(23216, this.handle23216); //-- 限时召唤数据
 
    this.RegisterProtocal(23217, this.handle23217); //-- 限时召唤
 
    this.RegisterProtocal(23218, this.handle23218); //-- 领取保底礼包
 
    this.RegisterProtocal(23219, this.handle23219); //-- 请求英雄试玩
  },
  handle23216: function handle23216(data) {
    if (data) {
      gcore.GlobalEvent.fire(TimesummonEvent.Update_Summon_Data_Event, data);
    }
  },
  handle23217: function handle23217(data) {
    message(data.msg);
  },
  handle23218: function handle23218(data) {
    message(data.msg);
  },
  handle23219: function handle23219(data) {
    message(data.msg);
 
    if (data.flag == false) {
      var BattleController = require("battle_controller");
 
      BattleController.getInstance().csFightExit();
    }
  },
  // -- 打开奖励预览 text_elite:内容描述
  openTimeSummonAwardView: function openTimeSummonAwardView(status, group_id, data, text_elite) {
    if (status == true) {
      if (this.summon_award_view == null) {
        var TimeSummonAwardView = require("time_summon_award_window");
 
        this.summon_award_view = new TimeSummonAwardView(this);
      }
 
      if (this.summon_award_view.isOpen() == false) {
        this.summon_award_view.open({
          group_id: group_id,
          data: data,
          text_elite: text_elite
        });
      }
    } else {
      if (this.summon_award_view) {
        this.summon_award_view.close();
        this.summon_award_view = null;
      }
    }
  },
  openTimeSummonProgressView: function openTimeSummonProgressView(status, times, camp_id) {
    if (status == true) {
      if (this.summon_progress_view == null) {
        var TimeSummonProgressView = require("time_summon_progress_window");
 
        this.summon_progress_view = new TimeSummonProgressView(this);
      }
 
      if (this.summon_progress_view.isOpen() == false) {
        this.summon_progress_view.open({
          times: times,
          camp_id: camp_id
        });
      }
    } else {
      if (this.summon_progress_view) {
        this.summon_progress_view.close();
        this.summon_progress_view = null;
      }
    }
  },
  openTimeSummonpreviewWindow: function openTimeSummonpreviewWindow(status, index, bool) {
    if (status == true) {
      if (this.SummonpreviewWindow == null) {
        var TimeSummonPreviewWindow = require("time_summon_preview_window");
 
        this.SummonpreviewWindow = new TimeSummonPreviewWindow(this);
      }
 
      if (this.SummonpreviewWindow.isOpen() == false) {
        this.SummonpreviewWindow.open({
          index: index,
          bool: bool
        });
      }
    } else {
      if (this.SummonpreviewWindow) {
        this.SummonpreviewWindow.close();
        this.SummonpreviewWindow = null;
      }
    }
  }
});
module.exports = TimesummonController;
 
cc._RF.pop();