Files
fc/dev/project/library/imports/b6/b61f3074-1a19-42c7-aac4-4645d4a4a563.js
2026-05-24 10:21:26 +08:00

106 lines
3.1 KiB
JavaScript

"use strict";
cc._RF.push(module, 'b61f3B0GhlCx6rERkXUpKVj', 'cmp.adventure.people');
// Scripts/mod/pve/adventure/cmp/cmp.adventure.people.js
"use strict";
var BridgeWindow = require("bridge.window");
var ADVCT = require("adventure_controller");
var ADEVT = require("adventure_event");
var Togs = require("nx.fx.togs");
cc.Class({
"extends": BridgeWindow,
properties: {
answers: {
"default": null,
type: Togs
},
titles: {
"default": null,
type: cc.Node
},
problem: {
"default": null,
type: cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
onLoad: function onLoad() {
this.ctrl = ADVCT.getInstance();
this.answers.posTog = this.togAnswers.bind(this);
this.select_index = 0;
this.answers.togTo(0);
},
start: function start() {},
togAnswers: function togAnswers(_index) {
var oldTog = this.answers.togs[this.select_index];
var old_lb = nx.gui.find(oldTog, "on/scroll/ans");
old_lb.stopAllActions();
old_lb.x = 0;
this.select_index = _index;
var tog = this.answers.togs[_index];
var on_lb = nx.gui.find(tog, "on/scroll/ans");
if (on_lb.width > 400) {
on_lb.runAction(cc.repeatForever(cc.sequence(cc.moveBy(5, cc.v2(-on_lb.width / 2, 0)), cc.moveTo(0.1, cc.v2(0, 0)), cc.delayTime(2))));
}
},
onOpenConfigs: function onOpenConfigs(params) {
var _this = this;
this.model_type = this.ctrl.getPlayModel();
this.evt_config = params.config;
this.room_id = params.room_id;
this.NPC_data = this.ctrl.getNPCData();
if (this.NPC_data) {
this.freashProblems();
this.scheduleOnce(function () {
_this.togAnswers(0);
}, 0.2);
}
this.setUI();
},
setUI: function setUI() {
nx.gui.setActive(this.titles, "type" + this.evt_config.evt_type, true);
},
freashProblems: function freashProblems() {
var ids = this.NPC_data.npc_ids;
var tip = "";
for (var i = 0; i < this.answers.togs.length; i++) {
var npc_data = null;
if (ids[i]) {
if (this.model_type == 1) {
npc_data = game.configs.adventure_endless_data.data_adventure_npc_data[ids[i].id];
} else {
npc_data = game.configs.adventure_weekly_data.data_adventure_event[ids[i].id];
}
if (!npc_data) return;
tip = npc_data.tip;
var tog = this.answers.togs[i];
if (tog) {
if (this.evt_config.evt_type != 6) {
nx.gui.setString(tog, "on/scroll/ans", npc_data.desc);
nx.gui.setString(tog, "off/scroll/ans", npc_data.desc);
} else {
nx.gui.setString(tog, "on/scroll/ans", "??????");
nx.gui.setString(tog, "off/scroll/ans", "??????");
}
}
}
}
nx.gui.setString(this.problem, "", tip);
},
onPreClosed: function onPreClosed() {},
clickSureEvent: function clickSureEvent() {
if (!this.NPC_data) return;
var id = this.NPC_data.npc_ids[this.select_index];
if (!id) {
id = 0;
}
this.ctrl.send29520([this.room_id], 1, [{
type: 1,
val: id.id
}], this.model_type);
this.close();
} // update (dt) {},
});
cc._RF.pop();