Files
fc/dev/project/library/imports/46/468cd3b8-e782-49db-baad-15d3a3b0bab0.js
T

125 lines
3.6 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '468cdO454JJ27qtFdOjsLqw', 'stone_dungeon_controller');
// Scripts/mod/pve/dungeon/stone_dungeon_controller.js
"use strict";
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
// 这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: 2019-01-08 11:59:10
// --------------------------------------------------------------------
var BridgeController = require("bridge.controller");
var StoneDungeonEvent = require("stone_dungeon_event");
// 桥接替换的界面
var Stone_dungeonController = cc.Class({
"extends": BridgeController,
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);
},
reqBaseFromServer: function reqBaseFromServer(_cb) {
var _this = this;
// 配置加载
var cfgs = ["dungeon_stone_data",
// 日常副本
"dailyplay_data"];
this.loadConfigs(cfgs, function (_ret, _data) {
_this.reqDungeonData(_cb);
});
},
checkIsOpen: function checkIsOpen() {
var open_config = game.configs.source_data.data_source_data[92].lev_limit;
if (open_config == null) return null;
var ret = nx.bridge.checkConditions([open_config]);
return ret;
},
reqDungeonData: function reqDungeonData(_cb) {
// 功能解锁检查
var is_open = this.checkIsOpen();
// 锁定中不请求数据
if (nx.dt.objNEmpty(is_open)) {
nx.dt.fnInvoke(_cb, true);
return;
}
this.SendProtocal(13030, {}, _cb);
},
openStoneDungeonView: function openStoneDungeonView(status, index) {
if (status) {
nx.bridge.createPanel("WndDungeonMain", {
index: index
});
} else {
nx.bridge.closePanel("WndDungeonMain");
}
},
// 副本信息
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.cur_dun_id = id;
this.SendProtocal(13031, {
id: id
});
},
on13031: function on13031(data) {
nx.tbox(data.msg);
if (data.code == 1) {
this.model.setCurChangeSweep(this.cur_dun_id);
}
},
// 扫荡副本
send13032: function send13032(id, num) {
if (num === void 0) {
num = 1;
}
this.cur_dun_id = id;
this.SendProtocal(13032, {
id: id,
num: num
});
},
on13032: function on13032(data) {
nx.tbox(data.msg);
if (data.code == 1) {
this.model.setCurChangeSweep(this.cur_dun_id);
}
}
});
module.exports = Stone_dungeonController;
cc._RF.pop();