update
This commit is contained in:
parent
a941f317bc
commit
2cebeacf6c
@ -1,4 +1,4 @@
|
||||
import { isTest, mainConfig } from "./Config";
|
||||
import { isTest, mainConfig } from './Config';
|
||||
|
||||
export var allBaseNet = {
|
||||
usa: '-z1-test.cebg.games',
|
||||
@ -7,42 +7,38 @@ export var allBaseNet = {
|
||||
turkey: '-z4-test.cebg.games',
|
||||
};
|
||||
|
||||
|
||||
isDevEnv()
|
||||
isExamining()
|
||||
isDevEnv();
|
||||
isExamining();
|
||||
|
||||
function isDevEnv() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function isExamining() {
|
||||
|
||||
if(!isDevEnv() && isTest && mainConfig.packageid!=0 ){
|
||||
|
||||
return true
|
||||
}else{
|
||||
|
||||
return false
|
||||
if (!isDevEnv() && isTest && mainConfig.packageid != 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getDevEnvUrlSuffix() {
|
||||
//'-test.kingsome.cn'
|
||||
return atob('LXRlc3Qua2luZ3NvbWUuY24=');
|
||||
//'-test.kingsome.cn'
|
||||
return atob('LXRlc3Qua2luZ3NvbWUuY24=');
|
||||
}
|
||||
|
||||
function getExaminingUrlSuffix() {
|
||||
return '-test.cebg.games';
|
||||
return '-test.cebg.games';
|
||||
}
|
||||
|
||||
function getUrlSuffix() {
|
||||
let urlSuffix = '-z3-test.cebg.games';
|
||||
if (isDevEnv()) {
|
||||
urlSuffix = getDevEnvUrlSuffix();
|
||||
} else if (isExamining()) {
|
||||
urlSuffix = getExaminingUrlSuffix();
|
||||
}
|
||||
return urlSuffix;
|
||||
let urlSuffix = '-z3-test.cebg.games';
|
||||
if (isDevEnv()) {
|
||||
urlSuffix = getDevEnvUrlSuffix();
|
||||
} else if (isExamining()) {
|
||||
urlSuffix = getExaminingUrlSuffix();
|
||||
}
|
||||
return urlSuffix;
|
||||
}
|
||||
|
||||
const netIdHash = (function () {
|
||||
@ -85,11 +81,11 @@ function getCommonParam() {
|
||||
'_net=' +
|
||||
encodeURIComponent(localStorage.getItem('currentNet')) +
|
||||
'&_os=' +
|
||||
encodeURIComponent(os) +
|
||||
encodeURIComponent(os) +
|
||||
'&_version=' +
|
||||
encodeURIComponent(mainConfig.version) +
|
||||
'&_hotfixversion=' +
|
||||
encodeURIComponent(mainConfig.hotfixVersion)+
|
||||
encodeURIComponent(mainConfig.hotfixVersion) +
|
||||
'&_packageid=' +
|
||||
encodeURIComponent(mainConfig.packageid)
|
||||
);
|
||||
@ -98,7 +94,7 @@ function getCommonParam() {
|
||||
export function getNormalApiUrl(name) {
|
||||
return (
|
||||
functionNet[name] +
|
||||
getUrlSuffix() +
|
||||
getUrlSuffix() +
|
||||
'/webapp/index.php?' +
|
||||
getCommonParam()
|
||||
);
|
||||
@ -114,11 +110,7 @@ export function getExaminingUrl() {
|
||||
}
|
||||
|
||||
export function getRelationUrl() {
|
||||
return (
|
||||
functionNet['relation'] +
|
||||
getUrlSuffix() +
|
||||
'/friend/websocket'
|
||||
);
|
||||
return functionNet['relation'] + getUrlSuffix() + '/friend/websocket';
|
||||
}
|
||||
|
||||
export function getNodeUrl() {
|
||||
@ -185,12 +177,12 @@ function getZName(zid) {
|
||||
}
|
||||
|
||||
export function getGameServer(teamUuid) {
|
||||
if (isDevEnv()) {
|
||||
return 'wss://game2006' + getDevEnvUrlSuffix() + '/websocket';
|
||||
}
|
||||
if (isExamining()) {
|
||||
return 'wss://game2006' + getExaminingUrlSuffix() + '/websocket';
|
||||
}
|
||||
if (isDevEnv()) {
|
||||
return 'wss://game2006' + getDevEnvUrlSuffix() + '/websocket';
|
||||
}
|
||||
if (isExamining()) {
|
||||
return 'wss://game2006' + getExaminingUrlSuffix() + '/websocket';
|
||||
}
|
||||
const nodeId = teamUuid ? teamUuid.split('_')[0] : cc.SDKManage.NodeId;
|
||||
const zid = teamUuid
|
||||
? teamUuid.split('_')[1]
|
||||
|
@ -1,409 +1,412 @@
|
||||
var battlenet = require("battlenetmanage");
|
||||
var SDKManage = require("SDKManage");
|
||||
var gameConfig = require("gameConfig");
|
||||
var Utils = require("Utils");
|
||||
const NetManage = require("../../manages/NetManage");
|
||||
const { showLoading } = require("../../gif/Loading");
|
||||
const { OperationType } = require("../../Operation/Operation");
|
||||
const jcgamelog = require("../../jcfw/service/jcgamelog");
|
||||
var battlenet = require('battlenetmanage');
|
||||
var SDKManage = require('SDKManage');
|
||||
var gameConfig = require('gameConfig');
|
||||
var Utils = require('Utils');
|
||||
const NetManage = require('../../manages/NetManage');
|
||||
const { showLoading } = require('../../gif/Loading');
|
||||
const { OperationType } = require('../../Operation/Operation');
|
||||
const jcgamelog = require('../../jcfw/service/jcgamelog');
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
nd_chat: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_back: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
lb_time: {
|
||||
default: null,
|
||||
type: cc.Label,
|
||||
},
|
||||
nd_time5: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_btns: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
btn_ready: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
btn_noready: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
btn_go: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
pb_herolihui: {
|
||||
default: null,
|
||||
type: cc.Prefab,
|
||||
},
|
||||
nd_teamlihui: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_onehui: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
|
||||
tableView_chose: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
properties: {
|
||||
nd_chat: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_back: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
lb_time: {
|
||||
default: null,
|
||||
type: cc.Label,
|
||||
},
|
||||
nd_time5: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_btns: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
btn_ready: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
btn_noready: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
btn_go: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
pb_herolihui: {
|
||||
default: null,
|
||||
type: cc.Prefab,
|
||||
},
|
||||
nd_teamlihui: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_onehui: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
|
||||
pb_chooseWeapon: {
|
||||
default: null,
|
||||
type: cc.Prefab,
|
||||
},
|
||||
tableView_chose: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
|
||||
nd_weaponNode1: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_weaponNode2: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
},
|
||||
pb_chooseWeapon: {
|
||||
default: null,
|
||||
type: cc.Prefab,
|
||||
},
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
nd_weaponNode1: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
nd_weaponNode2: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
},
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.weaponStr = "[]";
|
||||
this.weapon_uniid = new Array();
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
cc.Notifier.on("battleclickchose", this, this.battleclickchose.bind(this));
|
||||
cc.Notifier.on(
|
||||
"SMUpdateMatchInfo",
|
||||
this,
|
||||
this.SMUpdateMatchInfo.bind(this)
|
||||
);
|
||||
cc.Notifier.on("infochangeskin", this, this.infochangeskin.bind(this));
|
||||
// choose weapon
|
||||
cc.Notifier.on("haschooseWeapon", this, (index, name) => {
|
||||
if (index) {
|
||||
console.log(`index-------${window.currentWeaponName}`);
|
||||
if (index == 0) {
|
||||
cc.loader.loadRes(
|
||||
`icons/${window.currentWeaponName}`,
|
||||
cc.SpriteFrame,
|
||||
(err, res) => {
|
||||
if (this.nd_weaponNode1)
|
||||
this.nd_weaponNode1.getComponent(cc.Sprite).spriteFrame = res;
|
||||
}
|
||||
);
|
||||
} else if (index == 1) {
|
||||
cc.loader.loadRes(
|
||||
`icons/${window.currentWeaponName}`,
|
||||
cc.SpriteFrame,
|
||||
(err, res) => {
|
||||
if (this.nd_weaponNode2)
|
||||
this.nd_weaponNode2.getComponent(cc.Sprite).spriteFrame = res;
|
||||
}
|
||||
);
|
||||
}
|
||||
//
|
||||
onLoad() {
|
||||
this.weaponStr = '[]';
|
||||
this.weapon_uniid = new Array();
|
||||
|
||||
if (window.firstgun && this.weapon_uniid) {
|
||||
this.weapon_uniid[0] = window.firstgun;
|
||||
}
|
||||
if (window.secondgun && this.weapon_uniid) {
|
||||
this.weapon_uniid[1] = window.secondgun;
|
||||
}
|
||||
cc.Notifier.on(
|
||||
'battleclickchose',
|
||||
this,
|
||||
this.battleclickchose.bind(this)
|
||||
);
|
||||
cc.Notifier.on(
|
||||
'SMUpdateMatchInfo',
|
||||
this,
|
||||
this.SMUpdateMatchInfo.bind(this)
|
||||
);
|
||||
cc.Notifier.on('infochangeskin', this, this.infochangeskin.bind(this));
|
||||
// choose weapon
|
||||
cc.Notifier.on('haschooseWeapon', this, (index, name) => {
|
||||
if (index) {
|
||||
console.log(`index-------${window.currentWeaponName}`);
|
||||
if (index == 0) {
|
||||
cc.loader.loadRes(
|
||||
`icons/${window.currentWeaponName}`,
|
||||
cc.SpriteFrame,
|
||||
(err, res) => {
|
||||
if (this.nd_weaponNode1)
|
||||
this.nd_weaponNode1.getComponent(
|
||||
cc.Sprite
|
||||
).spriteFrame = res;
|
||||
}
|
||||
);
|
||||
} else if (index == 1) {
|
||||
cc.loader.loadRes(
|
||||
`icons/${window.currentWeaponName}`,
|
||||
cc.SpriteFrame,
|
||||
(err, res) => {
|
||||
if (this.nd_weaponNode2)
|
||||
this.nd_weaponNode2.getComponent(
|
||||
cc.Sprite
|
||||
).spriteFrame = res;
|
||||
}
|
||||
);
|
||||
}
|
||||
//
|
||||
|
||||
this.weaponStr = JSON.stringify(this.weapon_uniid);
|
||||
if (window.firstgun && this.weapon_uniid) {
|
||||
this.weapon_uniid[0] = window.firstgun;
|
||||
}
|
||||
if (window.secondgun && this.weapon_uniid) {
|
||||
this.weapon_uniid[1] = window.secondgun;
|
||||
}
|
||||
|
||||
console.log(this.weaponStr);
|
||||
}
|
||||
});
|
||||
},
|
||||
onDestroy() {
|
||||
cc.Notifier.off("battleclickchose", this);
|
||||
cc.Notifier.off("SMUpdateMatchInfo", this);
|
||||
cc.Notifier.off("infochangeskin", this);
|
||||
},
|
||||
SMUpdateMatchInfo(_data) {
|
||||
var data = _data.info;
|
||||
this.herodatalist = data.members;
|
||||
for (var i = 0; i < data.members.length; i++) {
|
||||
var onedata = data.members[i];
|
||||
if (onedata.hero_skin > 0) {
|
||||
onedata.hero_id = gameConfig.all_ItemConfig[onedata.hero_skin].playerid;
|
||||
onedata.hero_skin = onedata.hero_skin;
|
||||
}
|
||||
}
|
||||
if (data.countdown <= 5) {
|
||||
this.lb_time.node.active = false;
|
||||
this.nd_btns.active = false;
|
||||
this.nd_time5.active = true;
|
||||
} else {
|
||||
this.lb_time.node.active = true;
|
||||
this.lb_time.string = Utils.second3Time(data.countdown);
|
||||
}
|
||||
this.refresh();
|
||||
},
|
||||
this.weaponStr = JSON.stringify(this.weapon_uniid);
|
||||
|
||||
battleclickchose(v) {
|
||||
this.tmpv = v;
|
||||
if (this.mystate != 0) {
|
||||
return;
|
||||
}
|
||||
console.log(this.weaponStr);
|
||||
}
|
||||
});
|
||||
},
|
||||
onDestroy() {
|
||||
cc.Notifier.off('battleclickchose', this);
|
||||
cc.Notifier.off('SMUpdateMatchInfo', this);
|
||||
cc.Notifier.off('infochangeskin', this);
|
||||
},
|
||||
SMUpdateMatchInfo(_data) {
|
||||
var data = _data.info;
|
||||
this.herodatalist = data.members;
|
||||
for (var i = 0; i < data.members.length; i++) {
|
||||
var onedata = data.members[i];
|
||||
if (onedata.hero_skin > 0) {
|
||||
onedata.hero_id =
|
||||
gameConfig.all_ItemConfig[onedata.hero_skin].playerid;
|
||||
onedata.hero_skin = onedata.hero_skin;
|
||||
}
|
||||
}
|
||||
if (data.countdown <= 5) {
|
||||
this.lb_time.node.active = false;
|
||||
this.nd_btns.active = false;
|
||||
this.nd_time5.active = true;
|
||||
} else {
|
||||
this.lb_time.node.active = true;
|
||||
this.lb_time.string = Utils.second3Time(data.countdown);
|
||||
}
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
var heroDetail = this.getHeroDetailByID(v.hero_id)
|
||||
var process = (heroDetail.ceg_uplimit - heroDetail.today_get_gold) / heroDetail.ceg_uplimit;
|
||||
battleclickchose(v) {
|
||||
this.tmpv = v;
|
||||
if (this.mystate != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.node.getComponentInChildren("pbbattleui").nd_processbar.progress = process;
|
||||
this.node.getComponentInChildren("pbbattleui").nd_remainceg.string = heroDetail.ceg_uplimit - heroDetail.today_get_gold;
|
||||
var heroDetail = this.getHeroDetailByID(v.hero_id);
|
||||
var process =
|
||||
(heroDetail.ceg_uplimit - heroDetail.today_get_gold) /
|
||||
heroDetail.ceg_uplimit;
|
||||
|
||||
for (var i = 0; i < this.herodatalist.length; i++) {
|
||||
if (this.herodatalist[i].account_id == v.account_id) {
|
||||
this.herodatalist[i].hero_id = v.hero_id;
|
||||
this.herodatalist[i].hero_skin = v.hero_skin;
|
||||
this.herodatalist[i].hero_uuid = this.getHeroUUidByid(v.hero_id);
|
||||
if (SDKManage.account_id == v.account_id) {
|
||||
cc.playerData.changeHero(v.hero_id);
|
||||
this.hero_id = v.hero_id;
|
||||
this.hero_uuid = this.getHeroUUidByid(v.hero_id);
|
||||
this.canzb = true;
|
||||
if (this.team_mode) {
|
||||
let data = {
|
||||
hero_id: v.hero_id,
|
||||
weapons: JSON.parse(this.weaponStr),
|
||||
skins: [],
|
||||
baseskin: gameConfig.all_ItemConfig[v.hero_skin].skinid,
|
||||
hero_skin: v.hero_skin,
|
||||
skill_list: cc.playerData.getbattleskilllist(),
|
||||
hero_uniid:this.herodatalist[i].hero_uuid,
|
||||
};
|
||||
this.node.getComponentInChildren('pbbattleui').nd_processbar.progress =
|
||||
process;
|
||||
this.node.getComponentInChildren('pbbattleui').nd_remainceg.string =
|
||||
heroDetail.ceg_uplimit - heroDetail.today_get_gold;
|
||||
|
||||
this.matchdata = data;
|
||||
for (var i = 0; i < this.herodatalist.length; i++) {
|
||||
if (this.herodatalist[i].account_id == v.account_id) {
|
||||
this.herodatalist[i].hero_id = v.hero_id;
|
||||
this.herodatalist[i].hero_skin = v.hero_skin;
|
||||
this.herodatalist[i].hero_uuid = this.getHeroUUidByid(
|
||||
v.hero_id
|
||||
);
|
||||
if (SDKManage.account_id == v.account_id) {
|
||||
cc.playerData.changeHero(v.hero_id);
|
||||
this.hero_id = v.hero_id;
|
||||
this.hero_uuid = this.getHeroUUidByid(v.hero_id);
|
||||
this.canzb = true;
|
||||
if (this.team_mode) {
|
||||
let data = {
|
||||
hero_id: v.hero_id,
|
||||
weapons: JSON.parse(this.weaponStr),
|
||||
skins: [],
|
||||
baseskin:
|
||||
gameConfig.all_ItemConfig[v.hero_skin].skinid,
|
||||
hero_skin: v.hero_skin,
|
||||
skill_list: cc.playerData.getbattleskilllist(),
|
||||
hero_uniid: this.herodatalist[i].hero_uuid,
|
||||
};
|
||||
|
||||
cc.battleIns.sendbattlemsg("CMMatchChoose", data);
|
||||
}
|
||||
}
|
||||
this.matchdata = data;
|
||||
|
||||
this.refresh();
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
initdata(opt) {
|
||||
this.lb_time.node.active = false;
|
||||
this.mystate = 0;
|
||||
this.nd_time5.active = false;
|
||||
this.btn_ready.active = false;
|
||||
this.btn_noready.active = false;
|
||||
this.btn_go.active = false;
|
||||
this.nd_back.active = false;
|
||||
this.herodatalist = [];
|
||||
this.herolist = [];
|
||||
cc.battleIns.sendbattlemsg('CMMatchChoose', data);
|
||||
}
|
||||
}
|
||||
|
||||
cc.playerData.changeHero(30100);
|
||||
var addnode = this.nd_teamlihui;
|
||||
var pcount = 1;
|
||||
this.refresh();
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
initdata(opt) {
|
||||
this.lb_time.node.active = false;
|
||||
this.mystate = 0;
|
||||
this.nd_time5.active = false;
|
||||
this.btn_ready.active = false;
|
||||
this.btn_noready.active = false;
|
||||
this.btn_go.active = false;
|
||||
this.nd_back.active = false;
|
||||
this.herodatalist = [];
|
||||
this.herolist = [];
|
||||
|
||||
if (opt.teamuuid) {
|
||||
this.team_mode = true;
|
||||
pcount = 4;
|
||||
} else {
|
||||
this.btn_go.active = true;
|
||||
this.nd_back.active = true;
|
||||
addnode = this.nd_onehui;
|
||||
this.herodatalist.push({
|
||||
state: 0,
|
||||
name: cc.playerData.name,
|
||||
hero_id: 0,
|
||||
hero_skin: 0,
|
||||
account_id: SDKManage.account_id,
|
||||
hero_uuid: 0,
|
||||
});
|
||||
}
|
||||
for (var i = 0; i < pcount; i++) {
|
||||
var nd = cc.instantiate(this.pb_herolihui);
|
||||
addnode.addChild(nd);
|
||||
var scp = nd.getComponent("pbbattleui");
|
||||
scp.target = this;
|
||||
this.herolist.push(scp);
|
||||
}
|
||||
cc.playerData.changeHero(30100);
|
||||
var addnode = this.nd_teamlihui;
|
||||
var pcount = 1;
|
||||
|
||||
this.refresh();
|
||||
this.changelist(0);
|
||||
},
|
||||
if (opt.teamuuid) {
|
||||
this.team_mode = true;
|
||||
pcount = 4;
|
||||
} else {
|
||||
this.btn_go.active = true;
|
||||
this.nd_back.active = true;
|
||||
addnode = this.nd_onehui;
|
||||
this.herodatalist.push({
|
||||
state: 0,
|
||||
name: cc.playerData.name,
|
||||
hero_id: 0,
|
||||
hero_skin: 0,
|
||||
account_id: SDKManage.account_id,
|
||||
hero_uuid: 0,
|
||||
});
|
||||
}
|
||||
for (var i = 0; i < pcount; i++) {
|
||||
var nd = cc.instantiate(this.pb_herolihui);
|
||||
addnode.addChild(nd);
|
||||
var scp = nd.getComponent('pbbattleui');
|
||||
scp.target = this;
|
||||
this.herolist.push(scp);
|
||||
}
|
||||
|
||||
changetype(data1, data2) {
|
||||
this.changelist(Number(data2));
|
||||
cc.Notifier.emit("btnchose", { k: data2 });
|
||||
},
|
||||
this.refresh();
|
||||
this.changelist(0);
|
||||
},
|
||||
|
||||
changelist(type) {
|
||||
var cherolist = [];
|
||||
var openherolist = cc.playerData.getopenhero();
|
||||
|
||||
var herolist = [];
|
||||
this.allHeroUUID = [];
|
||||
this.allHeroID = [];
|
||||
this.heroDetails=[]
|
||||
changetype(data1, data2) {
|
||||
this.changelist(Number(data2));
|
||||
cc.Notifier.emit('btnchose', { k: data2 });
|
||||
},
|
||||
|
||||
NetManage.getHeroList((data) => {
|
||||
herolist = data.hero_list;
|
||||
for (var i = 0; i < herolist.length; i++) {
|
||||
var element = herolist[i];
|
||||
if(element.lock_type!=3){
|
||||
this.allHeroUUID.push(element.hero_uniid);
|
||||
this.allHeroID.push(element.hero_id)
|
||||
this.heroDetails.push(herolist[i])
|
||||
}
|
||||
}
|
||||
changelist(type) {
|
||||
var cherolist = [];
|
||||
var openherolist = cc.playerData.getopenhero();
|
||||
|
||||
console.log(this.allHeroID)
|
||||
var herolist = [];
|
||||
this.allHeroUUID = [];
|
||||
this.allHeroID = [];
|
||||
this.heroDetails = [];
|
||||
|
||||
NetManage.getHeroList((data) => {
|
||||
herolist = data.hero_list;
|
||||
for (var i = 0; i < herolist.length; i++) {
|
||||
var element = herolist[i];
|
||||
if (element.lock_type != 3) {
|
||||
this.allHeroUUID.push(element.hero_uniid);
|
||||
this.allHeroID.push(parseInt(element.hero_id));
|
||||
this.heroDetails.push(herolist[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < this.allHeroID.length; i++) {
|
||||
var hid = this.allHeroID[i];
|
||||
var heroType = gameConfig.playerConfig[hid].herotype;
|
||||
if (type == 0 || type == heroType) {
|
||||
if (cc.playerData.checkhasgethero(hid)) {
|
||||
cherolist.push(hid);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < this.allHeroID.length; i++) {
|
||||
var hid = this.allHeroID[i];
|
||||
var heroType = gameConfig.playerConfig[hid].herotype;
|
||||
if (type == 0 || type == heroType) {
|
||||
if (cc.playerData.checkhasgethero(hid)) {
|
||||
cherolist.push(hid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var newlist = Utils.arrtoarr(cherolist, 2);
|
||||
// this.allHeroID = cherolist;
|
||||
this.tableView_chose
|
||||
.getComponent("tableView")
|
||||
.initTableView(newlist.length, {
|
||||
array: newlist,
|
||||
target: this,
|
||||
});
|
||||
var newlist = Utils.arrtoarr(cherolist, 2);
|
||||
// this.allHeroID = cherolist;
|
||||
this.tableView_chose
|
||||
.getComponent('tableView')
|
||||
.initTableView(newlist.length, {
|
||||
array: newlist,
|
||||
target: this,
|
||||
});
|
||||
});
|
||||
|
||||
// for (var i = 0; i < openherolist.length; i++) {
|
||||
// var hid = openherolist[i];
|
||||
// var heroType = gameConfig.playerConfig[hid].herotype;
|
||||
// if (type == 0 || type == heroType) {
|
||||
// if (cc.playerData.checkhasgethero(hid)) {
|
||||
// cherolist.push(hid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
});
|
||||
// var newlist = Utils.arrtoarr(cherolist, 2);
|
||||
// this.allHeroID = cherolist;
|
||||
// this.tableView_chose
|
||||
// .getComponent("tableView")
|
||||
// .initTableView(newlist.length, {
|
||||
// array: newlist,
|
||||
// target: this,
|
||||
// });
|
||||
},
|
||||
|
||||
getHeroUUidByid(id) {
|
||||
var index = this.allHeroID.indexOf(id);
|
||||
return this.allHeroUUID[index];
|
||||
},
|
||||
|
||||
// for (var i = 0; i < openherolist.length; i++) {
|
||||
// var hid = openherolist[i];
|
||||
// var heroType = gameConfig.playerConfig[hid].herotype;
|
||||
// if (type == 0 || type == heroType) {
|
||||
// if (cc.playerData.checkhasgethero(hid)) {
|
||||
// cherolist.push(hid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
getHeroDetailByID(id) {
|
||||
var index = this.allHeroID.indexOf(id);
|
||||
return this.heroDetails[index];
|
||||
},
|
||||
|
||||
// var newlist = Utils.arrtoarr(cherolist, 2);
|
||||
// this.allHeroID = cherolist;
|
||||
// this.tableView_chose
|
||||
// .getComponent("tableView")
|
||||
// .initTableView(newlist.length, {
|
||||
// array: newlist,
|
||||
// target: this,
|
||||
// });
|
||||
},
|
||||
onclickclose() {
|
||||
window.firstgun = null;
|
||||
window.secondgun = null;
|
||||
this.node.destroy();
|
||||
},
|
||||
onclickgo() {
|
||||
//single
|
||||
jcgamelog.addOperation(OperationType.BUTTON, 'startgame');
|
||||
if (!this.canzb) {
|
||||
cc.uiHelper.showTips('Please choose a hero first');
|
||||
return;
|
||||
}
|
||||
// showLoading();
|
||||
// setTimeout(() => {
|
||||
// this.btn_noready.parent.parent.zindex = 99;
|
||||
// }, 1500);
|
||||
var opt = cc.playerData.getbattleopt();
|
||||
opt.team_mode = 0;
|
||||
opt.player_count = 1;
|
||||
opt.hero_uniid = this.hero_uuid;
|
||||
|
||||
getHeroUUidByid(id) {
|
||||
var index = this.allHeroID.indexOf(id);
|
||||
return this.allHeroUUID[index];
|
||||
},
|
||||
if (window.firstgun) {
|
||||
opt.weapon_uniid = new Array();
|
||||
opt.weapon_uniid.push(window.firstgun);
|
||||
if (window.secondgun) {
|
||||
opt.weapon_uniid.push(window.secondgun);
|
||||
}
|
||||
}
|
||||
|
||||
getHeroDetailByID(id){
|
||||
var index = this.allHeroID.indexOf(id);
|
||||
return this.heroDetails[index];
|
||||
},
|
||||
battlenet.initengine(opt);
|
||||
},
|
||||
refresh() {
|
||||
for (var i = 0; i < this.herodatalist.length; i++) {
|
||||
this.herolist[i].initdata(this.herodatalist[i]);
|
||||
}
|
||||
},
|
||||
onclicktype() {},
|
||||
onclickcancelready() {
|
||||
cc.battleIns.sendbattlemsg('CMMatchCancelStartGame');
|
||||
},
|
||||
onclickready() {
|
||||
jcgamelog.addOperation(OperationType.BUTTON, 'startgame');
|
||||
// team
|
||||
if (!this.canzb) {
|
||||
cc.uiHelper.showTips('Please choose a hero first');
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (this.matchdata) {
|
||||
this.matchdata.weapons = JSON.parse(this.weaponStr);
|
||||
cc.battleIns.sendbattlemsg('CMMatchChoose', this.matchdata);
|
||||
}
|
||||
//
|
||||
cc.battleIns.sendbattlemsg('CMMatchStartGame');
|
||||
},
|
||||
doready(state) {
|
||||
if (this.team_mode) {
|
||||
this.mystate = state;
|
||||
this.btn_ready.active = state == 0;
|
||||
this.btn_noready.active = !this.btn_ready.active;
|
||||
}
|
||||
},
|
||||
infochangeskin(v) {
|
||||
cc.Notifier.emit('battleclickchose', {
|
||||
account_id: SDKManage.account_id,
|
||||
hero_id: this.hero_id,
|
||||
hero_skin: v,
|
||||
});
|
||||
cc.playerData.changeSkin(v);
|
||||
},
|
||||
|
||||
onclickclose() {
|
||||
window.firstgun = null;
|
||||
window.secondgun = null;
|
||||
this.node.destroy();
|
||||
},
|
||||
onclickgo() {
|
||||
//single
|
||||
jcgamelog.addOperation(
|
||||
OperationType.BUTTON,
|
||||
'startgame',
|
||||
);
|
||||
if (!this.canzb) {
|
||||
cc.uiHelper.showTips("Please choose a hero first");
|
||||
return;
|
||||
}
|
||||
// showLoading();
|
||||
// setTimeout(() => {
|
||||
// this.btn_noready.parent.parent.zindex = 99;
|
||||
// }, 1500);
|
||||
var opt = cc.playerData.getbattleopt();
|
||||
opt.team_mode = 0;
|
||||
opt.player_count = 1;
|
||||
opt.hero_uniid = this.hero_uuid;
|
||||
// update (dt) {},
|
||||
|
||||
if (window.firstgun) {
|
||||
opt.weapon_uniid = new Array();
|
||||
opt.weapon_uniid.push(window.firstgun);
|
||||
if (window.secondgun) {
|
||||
opt.weapon_uniid.push(window.secondgun);
|
||||
}
|
||||
}
|
||||
|
||||
battlenet.initengine(opt);
|
||||
},
|
||||
refresh() {
|
||||
for (var i = 0; i < this.herodatalist.length; i++) {
|
||||
this.herolist[i].initdata(this.herodatalist[i]);
|
||||
}
|
||||
},
|
||||
onclicktype() {},
|
||||
onclickcancelready() {
|
||||
cc.battleIns.sendbattlemsg("CMMatchCancelStartGame");
|
||||
},
|
||||
onclickready() {
|
||||
jcgamelog.addOperation(
|
||||
OperationType.BUTTON,
|
||||
'startgame',
|
||||
);
|
||||
// team
|
||||
if (!this.canzb) {
|
||||
cc.uiHelper.showTips("Please choose a hero first");
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (this.matchdata) {
|
||||
this.matchdata.weapons = JSON.parse(this.weaponStr);
|
||||
cc.battleIns.sendbattlemsg("CMMatchChoose", this.matchdata);
|
||||
}
|
||||
//
|
||||
cc.battleIns.sendbattlemsg("CMMatchStartGame");
|
||||
},
|
||||
doready(state) {
|
||||
if (this.team_mode) {
|
||||
this.mystate = state;
|
||||
this.btn_ready.active = state == 0;
|
||||
this.btn_noready.active = !this.btn_ready.active;
|
||||
}
|
||||
},
|
||||
infochangeskin(v) {
|
||||
cc.Notifier.emit("battleclickchose", {
|
||||
account_id: SDKManage.account_id,
|
||||
hero_id: this.hero_id,
|
||||
hero_skin: v,
|
||||
});
|
||||
cc.playerData.changeSkin(v);
|
||||
},
|
||||
|
||||
// update (dt) {},
|
||||
|
||||
onClickChooseWeapon(event, data) {
|
||||
var node = cc.instantiate(this.pb_chooseWeapon);
|
||||
node.scale = 0.8;
|
||||
this.node.addChild(node);
|
||||
node.getComponent("chooseGun").startFrom(data);
|
||||
},
|
||||
onClickChooseWeapon(event, data) {
|
||||
var node = cc.instantiate(this.pb_chooseWeapon);
|
||||
node.scale = 0.8;
|
||||
this.node.addChild(node);
|
||||
node.getComponent('chooseGun').startFrom(data);
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user