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
"use strict";
cc._RF.push(module, '1bb41FclCZKzqq29ylNMALt', 'recruithero_controller');
// Scripts/mod/recruithero/recruithero_controller.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//      这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: 2019-07-02 16:51:49
// --------------------------------------------------------------------
var RecruitHeroEvent = require("recruithero_event");
 
var RecruitheroController = cc.Class({
  "extends": BaseController,
  ctor: function ctor() {},
  // 初始化配置数据
  initConfig: function initConfig() {
    var RecruitheroModel = require("recruithero_model");
 
    this.model = new RecruitheroModel();
    this.model.initConfig();
  },
  // 返回当前的model
  getModel: function getModel() {
    return this.model;
  },
  // 注册监听事件
  registerEvents: function registerEvents() {},
  // 注册协议接受事件
  registerProtocals: function registerProtocals() {
    this.RegisterProtocal(25100, this.handle25100);
    this.RegisterProtocal(25101, this.handle25101);
    this.RegisterProtocal(25102, this.handle25102);
  },
  // 限时招募信息
  sender25100: function sender25100() {
    this.SendProtocal(25100, {});
  },
  handle25100: function handle25100(data) {
    this.model.setRecruitEndTime(data.end_time);
    this.model.setRecruitBaseData(data);
    this.model.setStatusRedPoint(data);
    gcore.GlobalEvent.fire(RecruitHeroEvent.RecruitHeroBaseInfo, data);
  },
  // 领取奖励
  sender25101: function sender25101(id) {
    var proto = {};
    proto.id = id;
    this.SendProtocal(25101, proto);
  },
  handle25101: function handle25101(data) {
    message(data.msg);
  },
  //战斗预览
  sender25102: function sender25102() {
    var proto = {};
    this.SendProtocal(25102, proto);
  },
  handle25102: function handle25102(data) {
    message(data.msg);
  },
  openRecruitHeroWindow: function openRecruitHeroWindow(status) {
    if (status == true) {
      if (!this.recruit_hero_window) {
        this.recruit_hero_window = Utils.createClass("recruit_hero_window", this);
      }
 
      if (this.recruit_hero_window && this.recruit_hero_window.isOpen() == false) {
        this.recruit_hero_window.open();
      }
    } else {
      if (this.recruit_hero_window) {
        this.recruit_hero_window.close();
        this.recruit_hero_window = null;
      }
    }
  }
});
module.exports = RecruitheroController;
 
cc._RF.pop();