Files
fc/dev/project/library/imports/f7/f75b9e77-5bf6-43b8-bff1-65bbeb6b09b8.js
2026-05-24 10:21:26 +08:00

132 lines
3.8 KiB
JavaScript

"use strict";
cc._RF.push(module, 'f75b953W/ZDuL/xZbvrawm4', 'cmp.adventure.transform');
// Scripts/mod/pve/adventure/cmp/cmp.adventure.transform.js
"use strict";
var BridgeWindow = require("bridge.window");
var ADVCT = require("adventure_controller");
var ADEVT = require("adventure_event");
var PathTool = require("pathtool");
cc.Class({
"extends": BridgeWindow,
properties: {
btns: {
"default": [],
type: [cc.Node]
},
tips: {
"default": null,
type: cc.Node
},
list: {
"default": null,
type: cc.Node
},
item: {
"default": null,
type: cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
onLoad: function onLoad() {
this.ctrl = ADVCT.getInstance();
this.chips = [];
this.models = [];
},
start: function start() {},
onOpenConfigs: function onOpenConfigs(params) {
this.model_type = this.ctrl.getPlayModel();
this.evt_config = params.config;
this.room_id = params.room_id;
this.trans_data = this.ctrl.getTransData();
this.onTogTransModel(null, 0);
},
onPreClosed: function onPreClosed() {},
onTogTransModel: function onTogTransModel(e, _index) {
if (!this.trans_data) return;
var id = Number(_index);
var foster_ids = this.trans_data.foster_ids;
for (var i in foster_ids) {
var data = foster_ids[i];
var cfg = game.configs.adventure_endless_data.data_evt_desc[data.id];
if (id == 0) {
if (data.id == 8011) {
//補充芯片
nx.gui.setString(this.btns[0], "txt", cfg.desc);
this.chips.push(data.id);
} else if (data.id == 8031) {
//替換芯片
nx.gui.setString(this.btns[1], "txt", cfg.desc);
this.chips.push(data.id);
}
} else {
if (data.id == 8021) {
//補充模組
nx.gui.setString(this.btns[0], "txt", cfg.desc);
this.models.push(data.id);
} else if (data.id == 8041) {
//替換模組
nx.gui.setString(this.btns[1], "txt", cfg.desc);
this.models.push(data.id);
}
}
}
if (id == 0) {
nx.gui.setString(this.tips, "", cc.js.formatStr(nx.text.getKey("AdvenChipUseNum"), this.trans_data.chip_num));
} else {
nx.gui.setString(this.tips, "", cc.js.formatStr(nx.text.getKey("AdvenModelUseNum"), this.trans_data.module_num));
}
this.is_chip = id == 0 ? true : false;
this.refreshOwnerTrans();
},
onSelectTrans: function onSelectTrans(order) {
var num = Number(order);
var use_id = null;
if (this.is_chip) {
use_id = this.chips[num];
} else {
use_id = this.models[num];
}
if (!use_id) return;
//請求數據
this.ctrl.send29520([this.room_id], 1, [{
type: 1,
val: use_id
}], this.model_type);
this.close();
},
refreshOwnerTrans: function refreshOwnerTrans() {
nx.bridge.NodeChidrenDestroy(this.list);
if (this.is_chip) {
var chip_ids = this.trans_data.chip_id;
for (var i in chip_ids) {
var item_data = gitemdata(chip_ids[i].id);
if (item_data) {
var pre = cc.instantiate(this.item);
pre.parent = this.list;
pre.active = true;
pre.x = -this.list.width / 2;
nx.gui.setString(pre, "name", item_data.name);
nx.gui.setString(pre, "desc", item_data.desc);
}
}
} else {
var module_ids = this.trans_data.module_id;
for (var _i in module_ids) {
var skill_data = gskilldata("data_get_skill", module_ids[_i].id);
if (skill_data) {
var _pre = cc.instantiate(this.item);
_pre.parent = this.list;
_pre.active = true;
_pre.x = -this.list.width / 2;
nx.gui.setString(_pre, "name", skill_data.name);
nx.gui.setString(_pre, "desc", skill_data.des);
}
}
}
} // update (dt) {},
});
cc._RF.pop();