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
"use strict";
cc._RF.push(module, '468cdO454JJ27qtFdOjsLqw', 'stone_dungeon_controller');
// Scripts/mod/stone_dungeon/stone_dungeon_controller.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//      这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: 2019-01-08 11:59:10
// --------------------------------------------------------------------
var StoneDungeonEvent = require("stone_dungeon_event");
 
var Stone_dungeonController = cc.Class({
  "extends": BaseController,
  ctor: function ctor() {},
  // 初始化配置数据
  initConfig: function initConfig() {
    var Stone_dungeonModel = require("stone_dungeon_model");
 
    this.model = new Stone_dungeonModel();
    this.model.initConfig();
  },
  // 返回当前的model
  getModel: function getModel() {
    return this.model;
  },
  // 注册监听事件
  registerEvents: function registerEvents() {// if(!this.init_role_event){
    //     this.init_role_event = gcore.GlobalEvent.bind(EventId.EVT_ROLE_CREATE_SUCCESS, (function(){
    //         gcore.GlobalEvent.unbind(this.init_role_event);
    //         this.init_role_event = null;
    //         this.send13030();
    //     }).bind(this));
    // }
  },
  // 注册协议接受事件
  registerProtocals: function registerProtocals() {
    this.RegisterProtocal(13030, this.on13030);
    this.RegisterProtocal(13031, this.on13031);
    this.RegisterProtocal(13032, this.on13032);
  },
  openStoneDungeonView: function openStoneDungeonView(status) {
    if (status) {
      var open_data = Config.dailyplay_data.data_exerciseactivity[1];
 
      if (open_data == null) {
        message(Utils.TI18N("日常副本数据异常"));
        return;
      }
 
      var MainuiController = require("mainui_controller");
 
      var bool = MainuiController.getInstance().checkIsOpenByActivate(open_data.activate);
 
      if (bool == false) {
        message(open_data.lock_desc);
        return;
      }
 
      if (!this.stoneDungeonView) {
        this.stoneDungeonView = Utils.createClass("stone_dungeon_window", this);
      }
 
      if (this.stoneDungeonView && this.stoneDungeonView.isOpen() == false) {
        this.stoneDungeonView.open();
      }
    } else {
      if (this.stoneDungeonView) {
        this.stoneDungeonView.close();
        this.stoneDungeonView = null;
      }
    }
  },
  // 副本信息
  send13030: function send13030() {
    this.SendProtocal(13030, {});
  },
  on13030: function on13030(data) {
    this.model.setChangeSweepCount(data.list);
    this.model.setPassClearanceID(data.pass_list);
    gcore.GlobalEvent.fire(StoneDungeonEvent.Update_StoneDungeon_Data, data);
  },
  // 挑战副本
  send13031: function send13031(id) {
    this.SendProtocal(13031, {
      id: id
    });
  },
  on13031: function on13031(data) {
    message(data.msg);
  },
  // 扫荡副本
  send13032: function send13032(id) {
    this.SendProtocal(13032, {
      id: id
    });
  },
  on13032: function on13032(data) {
    message(data.msg);
  },
  getStoneDungeonRoot: function getStoneDungeonRoot(finish_cb) {
    if (!finish_cb) {
      if (this.stoneDungeonView) return this.stoneDungeonView.root_wnd;
    } else {
      if (this.stoneDungeonView) {
        this.stoneDungeonView.getRootWnd(finish_cb);
      } else {
        finish_cb(null);
      }
    }
  }
});
module.exports = Stone_dungeonController;
 
cc._RF.pop();