Files
fc/dev/project/library/imports/7b/7bd968b4-d546-4f5b-bb76-670e8aa20727.js
2026-05-24 10:21:26 +08:00

101 lines
3.3 KiB
JavaScript

"use strict";
cc._RF.push(module, '7bd96i01UZPW7t2Zw6Kogcn', 'cmp.main.task.item');
// Scripts/mod/task/cmp/cmp.main.task.item.js
"use strict";
var TaskConst = require("task_const");
var BridgeWindow = require("bridge.window");
// 任务状态
var TST = TaskConst.task_status;
cc.Class({
"extends": BridgeWindow,
properties: {
nodName: {
"default": null,
type: cc.Label
},
nodFocus: {
"default": null,
type: cc.Node
}
},
onLoad: function onLoad() {
nx.gui.setActive(this, "on", false);
nx.gui.setActive(this, "off", true);
// this.bindGEvent( TaskEvent.UpdateTaskList,this.freshTask.bind( this) );
},
freshTask: function freshTask(_data) {
if (this.mdata) {
if (this.mdata.id == _data.id) {
this.mdata.finish = _data.finish;
}
}
},
// 数据重置
setData: function setData(_data, _index) {
this.index = _index;
this.mdata = _data;
// 刷新
this.freshBase();
// if( _index == 0 ){
// this.scheduleOnce( ()=>{
// this.onTouchfocus();
// }, 0.3 );
// }
// this.freshStatus();
},
// 刷新基本信息
freshBase: function freshBase() {
// 设状态
if (this.mdata) {
// console.log( JSON.stringify( this.mdata) + "当前 的任务单个信息" );
var pro = "";
pro = this.mdata.type == 1 ? "" : this.mdata.progress[0].value + "/" + this.mdata.progress[0].target_val;
nx.gui.setString(this, "lock/txt", this.mdata.desc);
if (this.mdata.canshow) {
var color = this.mdata.finish == 1 || this.mdata.finish == 2 ? new cc.Color().fromHEX("#28a812") : new cc.Color().fromHEX("#ff1b1b");
// nx.gui.setColor( this,"on/progress", color );
// nx.gui.setColor( this,"off/progress", color );
nx.gui.setString(this, "on/txt", this.mdata.desc);
nx.gui.setString(this, "on/progress", "");
nx.gui.setActive(this, "on/doing", this.mdata.finish == 0 && this.mdata.type == 1);
nx.gui.setActive(this, "on/done", this.mdata.finish == 2 && this.mdata.type == 1);
nx.gui.setActive(this, "on/get", this.mdata.finish == 1 && this.mdata.type == 1);
nx.gui.setString(this, "off/txt", this.mdata.desc);
nx.gui.setString(this, "off/progress", "");
nx.gui.setActive(this, "off/doing", this.mdata.finish == 0 && this.mdata.type == 1);
nx.gui.setActive(this, "off/done", this.mdata.finish == 2 && this.mdata.type == 1);
nx.gui.setActive(this, "off/get", this.mdata.finish == 1 && this.mdata.type == 1);
nx.gui.setActive(this, "on", false);
nx.gui.setActive(this, "off", true);
}
nx.gui.setActive(this, "lock", !this.mdata.canshow);
}
},
onTouchfocus: function onTouchfocus() {
// console.log( "当前点击的对应的序号" + this.index );
// nx.gui.setActive( this, "on", true );
// nx.gui.setActive( this, "off", false );
var nodes = this.node.parent;
var chd = nodes.children;
var chdn = chd[this.index];
for (var i = 0; i < chd.length; i++) {
var nod = chd[i];
nx.gui.setActive(nod, "on", false);
nx.gui.setActive(nod, "off", true);
}
nx.gui.setActive(chdn, "on", true);
nx.gui.setActive(chdn, "off", false);
nx.bridge.vset("TaskInfo", this.mdata);
},
onTouchlock: function onTouchlock() {
nx.tbox("Locked");
}
});
cc._RF.pop();