235 lines
8.3 KiB
JavaScript
235 lines
8.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '091edGIgHBBFZxJE9VSINta', 'cmp.cchampion.sfmatch.page');
|
|
// Scripts/mod/pvp/crosschampion/cmp/cmp.cchampion.sfmatch.page.js
|
|
|
|
"use strict";
|
|
|
|
var MenuPage = require("cmp.com.menu.page");
|
|
var CrossChampionController = require("crosschampion_controller");
|
|
var ArenaEvent = require("arena_event");
|
|
var RoleController = require("role_controller");
|
|
var ArenaConst = require("arena_const");
|
|
cc.Class({
|
|
"extends": MenuPage,
|
|
properties: {
|
|
nodPlst: {
|
|
"default": null,
|
|
type: cc.Node,
|
|
displayName: "晉級信息相關"
|
|
},
|
|
nodGroup: {
|
|
"default": null,
|
|
type: cc.Node,
|
|
displayName: "組別信息"
|
|
},
|
|
nodLooks: {
|
|
"default": null,
|
|
type: cc.Node,
|
|
displayName: "查看回放"
|
|
},
|
|
nodFab: {
|
|
"default": null,
|
|
type: cc.Prefab,
|
|
displayName: "頭像顯示"
|
|
},
|
|
nodRace: {
|
|
"default": null,
|
|
type: cc.Node,
|
|
displayName: "比賽相關數據"
|
|
}
|
|
},
|
|
onLoad: function onLoad() {
|
|
var cct = CrossChampionController.getInstance();
|
|
var model = cct.getModel();
|
|
var race = model.getBaseInfo();
|
|
var info = race.step != ArenaConst.champion_step.match_8 ? ArenaConst.CrosschampionConstDefine : ArenaConst.CrosschampionEConstDefine;
|
|
for (var i = 0; i < this.nodPlst.children.length; i++) {
|
|
var item = info[i];
|
|
var nod = this.nodPlst.children[i];
|
|
var nodPre = cc.instantiate(this.nodFab);
|
|
nodPre.parent = nod;
|
|
nodPre.position = cc.Vec2.ZERO;
|
|
if (item) {
|
|
var cmp = nx.gui.getComponent(nod, "matchInfo", "cmp.cchampion.match.item");
|
|
if (cmp) {
|
|
cmp.setEmpty(item);
|
|
}
|
|
}
|
|
}
|
|
nx.gui.setString(this, "sfbg/change/txt", nx.text.format("Match64Desc", 8));
|
|
nx.gui.setString(this, "sfbg/back/txt", nx.text.format("Match64Desc", 64));
|
|
nx.gui.setActive(this, "sfbg/change", false);
|
|
nx.gui.setActive(this, "sfbg/back", false);
|
|
nx.gui.setActive(this.nodRace, "", false);
|
|
},
|
|
onEnable: function onEnable() {
|
|
// 视图监听
|
|
this.vbind([["CChampion", this.freshMyRace.bind(this)]]);
|
|
this.bindGEvent(ArenaEvent.UpdateTop32InfoEvent, this.freshMatch.bind(this));
|
|
this.bindGEvent(ArenaEvent.UpdateTop4InfoEvent, this.freshMatchE.bind(this));
|
|
this.bindGEvent(ArenaEvent.UpdateTop324GroupPosEvent, this.setRaceReplay.bind(this));
|
|
// this.nodMenus.posTog = this.onTogMenu.bind( this );
|
|
|
|
this.setEmpty();
|
|
},
|
|
// 隐藏
|
|
onDisable: function onDisable() {
|
|
// 视图监听解除
|
|
this.vunbind();
|
|
// 事件监听释放
|
|
this.unbindGEvents();
|
|
|
|
// nx.gui.setActive( this.nodEmpty, "", false );
|
|
// nx.gui.setActive( this.nodRace, "", false );
|
|
},
|
|
|
|
setEmpty: function setEmpty() {
|
|
var cct = CrossChampionController.getInstance();
|
|
cct.sender26209();
|
|
if (this.race && this.race.step == ArenaConst.champion_step.match_8) {
|
|
nx.gui.setActive(this, "sfbg/change", true);
|
|
nx.gui.setActive(this, "sfbg/back", false);
|
|
}
|
|
},
|
|
freshMyRace: function freshMyRace(_race) {
|
|
this.race = _race;
|
|
nx.gui.setActive(this, "sfbg/change", _race.step == ArenaConst.champion_step.match_8);
|
|
},
|
|
freshMatch: function freshMatch(_matchInfo) {
|
|
//
|
|
this.matchlist = _matchInfo;
|
|
this.group = 0;
|
|
this.dealShow();
|
|
var self = this;
|
|
var dealShow = function dealShow(_num) {
|
|
var chd = self.nodLooks.children;
|
|
for (var i = 0; i < chd.length; i++) {
|
|
var nod = chd[i];
|
|
nx.gui.setActive(nod, "", i < _num);
|
|
}
|
|
};
|
|
if (this.race.step == ArenaConst.champion_step.match_8) {
|
|
if (this.race.round == 1) {
|
|
dealShow(parseInt(this.race.step / 2));
|
|
} else if (this.race.round == 0) {
|
|
dealShow(parseInt(this.race.step));
|
|
}
|
|
}
|
|
if (this.race.step == ArenaConst.champion_step.match_64) {
|
|
if (this.race.round == 1) {
|
|
dealShow(parseInt(this.race.step / 8));
|
|
} else if (this.race.round == 2) {
|
|
dealShow(parseInt(this.race.step / 4 - 2));
|
|
} else {
|
|
dealShow(parseInt(this.race.step / 4));
|
|
}
|
|
}
|
|
},
|
|
freshMatchE: function freshMatchE(_matchInfo) {
|
|
//
|
|
this.matchlistE = _matchInfo;
|
|
this.dealShowE();
|
|
},
|
|
onTouchAdd: function onTouchAdd() {
|
|
if (this.group == 0 || this.group < this.matchlist.length) {
|
|
this.group++;
|
|
}
|
|
if (this.group >= this.matchlist.length) {
|
|
this.group = 0;
|
|
}
|
|
// console.log( "當前的數字顯示" + this.group );
|
|
this.dealShow();
|
|
},
|
|
onTouchDel: function onTouchDel() {
|
|
if (this.group == 0) {
|
|
this.group = this.matchlist.length;
|
|
}
|
|
if (this.group > 0 || this.group <= this.matchlist.length) {
|
|
this.group--;
|
|
}
|
|
// console.log( "當前的數字顯示減" + this.group );
|
|
this.dealShow();
|
|
},
|
|
dealShow: function dealShow() {
|
|
var desc = ArenaConst.getGroup(this.group + 1);
|
|
// console.log( "當前的組別" + desc );
|
|
nx.gui.setString(this.nodGroup, "group", nx.text.format("Group", desc));
|
|
var role = RoleController.getInstance().getRoleVo();
|
|
var chd = this.nodPlst.children;
|
|
var groupInfo = this.matchlist[this.group].pos_list;
|
|
groupInfo.sort(function (a, b) {
|
|
return a.pos - b.pos;
|
|
});
|
|
for (var i = 0; i < groupInfo.length; i++) {
|
|
var info = groupInfo[i];
|
|
var nod = chd[i];
|
|
if (info) {
|
|
var cmp = nx.gui.getComponent(nod, "matchInfo", "cmp.cchampion.match.item");
|
|
if (cmp) {
|
|
cmp.setData({
|
|
face: info.face,
|
|
avatar: 1000
|
|
});
|
|
cmp.setInfo(info);
|
|
}
|
|
}
|
|
}
|
|
nx.gui.setActive(this.nodGroup, "", true);
|
|
},
|
|
dealShowE: function dealShowE() {
|
|
// {"pos_list":[{"pos":8,"rid":61,"srv_id":"","name":"代雲紫安","face":24100,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":7,"rid":15,"srv_id":"","name":"懷蝶幼蓉","face":26202,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":6,"rid":5,"srv_id":"","name":"傲芙含卉","face":26400,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":5,"rid":6,"srv_id":"","name":"從蓉曉綠","face":28408,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":4,"rid":28,"srv_id":"","name":"憐夢夜安","face":24202,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":3,"rid":21,"srv_id":"","name":"尋真淩瑤","face":24201,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":2,"rid":38,"srv_id":"","name":"書蕾之山","face":26204,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":1,"rid":11,"srv_id":"","name":"訪蕊雅陽","face":28403,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""}]}
|
|
this.group = -1;
|
|
nx.gui.setActive(this.nodGroup, "", false);
|
|
var role = RoleController.getInstance().getRoleVo();
|
|
var chd = this.nodPlst.children;
|
|
var groupInfo = this.matchlistE;
|
|
if (groupInfo) {
|
|
groupInfo.sort(function (a, b) {
|
|
return a.pos - b.pos;
|
|
});
|
|
for (var i = 0; i < chd.length; i++) {
|
|
var info = nx.dt.objClone(groupInfo[i]);
|
|
var nod = chd[i];
|
|
var cmp = nx.gui.getComponent(nod, "matchInfo", "cmp.cchampion.match.item");
|
|
if (info) {
|
|
// nx.gui.setSpriteFrame( )
|
|
if (cmp) {
|
|
cmp.setData({
|
|
face: info.face,
|
|
avatar: 1000
|
|
});
|
|
cmp.setInfo(info, 8);
|
|
}
|
|
} else {
|
|
var _info2 = ArenaConst.CrosschampionEConstDefine[i];
|
|
if (cmp) {
|
|
cmp.setEmpty(_info2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
onTouchChangeToEight: function onTouchChangeToEight() {
|
|
var cct = CrossChampionController.getInstance();
|
|
cct.sender26210();
|
|
nx.gui.setActive(this, "sfbg/change", false);
|
|
nx.gui.setActive(this, "sfbg/back", true);
|
|
},
|
|
onTouchLook: function onTouchLook(_index) {
|
|
var pos = parseInt(_index);
|
|
var cct = CrossChampionController.getInstance();
|
|
var group = this.group >= 0 ? this.group + 1 : 0;
|
|
cct.sender26212(group, pos);
|
|
},
|
|
setRaceReplay: function setRaceReplay(_info) {
|
|
this.nodRace.getComponent("cmp.cchampion.race.info").setRaceInfo(_info);
|
|
nx.gui.setActive(this.nodRace, "", true);
|
|
nx.gui.setActive(this, "sfbg", false);
|
|
},
|
|
onTouchClose: function onTouchClose() {
|
|
nx.gui.setActive(this.nodRace, "", false);
|
|
nx.gui.setActive(this, "sfbg", true);
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |