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 = {
|
export var allBaseNet = {
|
||||||
usa: '-z1-test.cebg.games',
|
usa: '-z1-test.cebg.games',
|
||||||
@ -7,22 +7,18 @@ export var allBaseNet = {
|
|||||||
turkey: '-z4-test.cebg.games',
|
turkey: '-z4-test.cebg.games',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
isDevEnv();
|
||||||
isDevEnv()
|
isExamining();
|
||||||
isExamining()
|
|
||||||
|
|
||||||
function isDevEnv() {
|
function isDevEnv() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isExamining() {
|
function isExamining() {
|
||||||
|
if (!isDevEnv() && isTest && mainConfig.packageid != 0) {
|
||||||
if(!isDevEnv() && isTest && mainConfig.packageid!=0 ){
|
return true;
|
||||||
|
} else {
|
||||||
return true
|
return false;
|
||||||
}else{
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +85,7 @@ function getCommonParam() {
|
|||||||
'&_version=' +
|
'&_version=' +
|
||||||
encodeURIComponent(mainConfig.version) +
|
encodeURIComponent(mainConfig.version) +
|
||||||
'&_hotfixversion=' +
|
'&_hotfixversion=' +
|
||||||
encodeURIComponent(mainConfig.hotfixVersion)+
|
encodeURIComponent(mainConfig.hotfixVersion) +
|
||||||
'&_packageid=' +
|
'&_packageid=' +
|
||||||
encodeURIComponent(mainConfig.packageid)
|
encodeURIComponent(mainConfig.packageid)
|
||||||
);
|
);
|
||||||
@ -114,11 +110,7 @@ export function getExaminingUrl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getRelationUrl() {
|
export function getRelationUrl() {
|
||||||
return (
|
return functionNet['relation'] + getUrlSuffix() + '/friend/websocket';
|
||||||
functionNet['relation'] +
|
|
||||||
getUrlSuffix() +
|
|
||||||
'/friend/websocket'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNodeUrl() {
|
export function getNodeUrl() {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
var battlenet = require("battlenetmanage");
|
var battlenet = require('battlenetmanage');
|
||||||
var SDKManage = require("SDKManage");
|
var SDKManage = require('SDKManage');
|
||||||
var gameConfig = require("gameConfig");
|
var gameConfig = require('gameConfig');
|
||||||
var Utils = require("Utils");
|
var Utils = require('Utils');
|
||||||
const NetManage = require("../../manages/NetManage");
|
const NetManage = require('../../manages/NetManage');
|
||||||
const { showLoading } = require("../../gif/Loading");
|
const { showLoading } = require('../../gif/Loading');
|
||||||
const { OperationType } = require("../../Operation/Operation");
|
const { OperationType } = require('../../Operation/Operation');
|
||||||
const jcgamelog = require("../../jcfw/service/jcgamelog");
|
const jcgamelog = require('../../jcfw/service/jcgamelog');
|
||||||
cc.Class({
|
cc.Class({
|
||||||
extends: cc.Component,
|
extends: cc.Component,
|
||||||
|
|
||||||
@ -78,18 +78,22 @@ cc.Class({
|
|||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.weaponStr = "[]";
|
this.weaponStr = '[]';
|
||||||
this.weapon_uniid = new Array();
|
this.weapon_uniid = new Array();
|
||||||
|
|
||||||
cc.Notifier.on("battleclickchose", this, this.battleclickchose.bind(this));
|
|
||||||
cc.Notifier.on(
|
cc.Notifier.on(
|
||||||
"SMUpdateMatchInfo",
|
'battleclickchose',
|
||||||
|
this,
|
||||||
|
this.battleclickchose.bind(this)
|
||||||
|
);
|
||||||
|
cc.Notifier.on(
|
||||||
|
'SMUpdateMatchInfo',
|
||||||
this,
|
this,
|
||||||
this.SMUpdateMatchInfo.bind(this)
|
this.SMUpdateMatchInfo.bind(this)
|
||||||
);
|
);
|
||||||
cc.Notifier.on("infochangeskin", this, this.infochangeskin.bind(this));
|
cc.Notifier.on('infochangeskin', this, this.infochangeskin.bind(this));
|
||||||
// choose weapon
|
// choose weapon
|
||||||
cc.Notifier.on("haschooseWeapon", this, (index, name) => {
|
cc.Notifier.on('haschooseWeapon', this, (index, name) => {
|
||||||
if (index) {
|
if (index) {
|
||||||
console.log(`index-------${window.currentWeaponName}`);
|
console.log(`index-------${window.currentWeaponName}`);
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
@ -98,7 +102,9 @@ cc.Class({
|
|||||||
cc.SpriteFrame,
|
cc.SpriteFrame,
|
||||||
(err, res) => {
|
(err, res) => {
|
||||||
if (this.nd_weaponNode1)
|
if (this.nd_weaponNode1)
|
||||||
this.nd_weaponNode1.getComponent(cc.Sprite).spriteFrame = res;
|
this.nd_weaponNode1.getComponent(
|
||||||
|
cc.Sprite
|
||||||
|
).spriteFrame = res;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else if (index == 1) {
|
} else if (index == 1) {
|
||||||
@ -107,7 +113,9 @@ cc.Class({
|
|||||||
cc.SpriteFrame,
|
cc.SpriteFrame,
|
||||||
(err, res) => {
|
(err, res) => {
|
||||||
if (this.nd_weaponNode2)
|
if (this.nd_weaponNode2)
|
||||||
this.nd_weaponNode2.getComponent(cc.Sprite).spriteFrame = res;
|
this.nd_weaponNode2.getComponent(
|
||||||
|
cc.Sprite
|
||||||
|
).spriteFrame = res;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -127,9 +135,9 @@ cc.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onDestroy() {
|
onDestroy() {
|
||||||
cc.Notifier.off("battleclickchose", this);
|
cc.Notifier.off('battleclickchose', this);
|
||||||
cc.Notifier.off("SMUpdateMatchInfo", this);
|
cc.Notifier.off('SMUpdateMatchInfo', this);
|
||||||
cc.Notifier.off("infochangeskin", this);
|
cc.Notifier.off('infochangeskin', this);
|
||||||
},
|
},
|
||||||
SMUpdateMatchInfo(_data) {
|
SMUpdateMatchInfo(_data) {
|
||||||
var data = _data.info;
|
var data = _data.info;
|
||||||
@ -137,7 +145,8 @@ cc.Class({
|
|||||||
for (var i = 0; i < data.members.length; i++) {
|
for (var i = 0; i < data.members.length; i++) {
|
||||||
var onedata = data.members[i];
|
var onedata = data.members[i];
|
||||||
if (onedata.hero_skin > 0) {
|
if (onedata.hero_skin > 0) {
|
||||||
onedata.hero_id = gameConfig.all_ItemConfig[onedata.hero_skin].playerid;
|
onedata.hero_id =
|
||||||
|
gameConfig.all_ItemConfig[onedata.hero_skin].playerid;
|
||||||
onedata.hero_skin = onedata.hero_skin;
|
onedata.hero_skin = onedata.hero_skin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,17 +167,23 @@ cc.Class({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var heroDetail = this.getHeroDetailByID(v.hero_id)
|
var heroDetail = this.getHeroDetailByID(v.hero_id);
|
||||||
var process = (heroDetail.ceg_uplimit - heroDetail.today_get_gold) / heroDetail.ceg_uplimit;
|
var process =
|
||||||
|
(heroDetail.ceg_uplimit - heroDetail.today_get_gold) /
|
||||||
|
heroDetail.ceg_uplimit;
|
||||||
|
|
||||||
this.node.getComponentInChildren("pbbattleui").nd_processbar.progress = process;
|
this.node.getComponentInChildren('pbbattleui').nd_processbar.progress =
|
||||||
this.node.getComponentInChildren("pbbattleui").nd_remainceg.string = heroDetail.ceg_uplimit - heroDetail.today_get_gold;
|
process;
|
||||||
|
this.node.getComponentInChildren('pbbattleui').nd_remainceg.string =
|
||||||
|
heroDetail.ceg_uplimit - heroDetail.today_get_gold;
|
||||||
|
|
||||||
for (var i = 0; i < this.herodatalist.length; i++) {
|
for (var i = 0; i < this.herodatalist.length; i++) {
|
||||||
if (this.herodatalist[i].account_id == v.account_id) {
|
if (this.herodatalist[i].account_id == v.account_id) {
|
||||||
this.herodatalist[i].hero_id = v.hero_id;
|
this.herodatalist[i].hero_id = v.hero_id;
|
||||||
this.herodatalist[i].hero_skin = v.hero_skin;
|
this.herodatalist[i].hero_skin = v.hero_skin;
|
||||||
this.herodatalist[i].hero_uuid = this.getHeroUUidByid(v.hero_id);
|
this.herodatalist[i].hero_uuid = this.getHeroUUidByid(
|
||||||
|
v.hero_id
|
||||||
|
);
|
||||||
if (SDKManage.account_id == v.account_id) {
|
if (SDKManage.account_id == v.account_id) {
|
||||||
cc.playerData.changeHero(v.hero_id);
|
cc.playerData.changeHero(v.hero_id);
|
||||||
this.hero_id = v.hero_id;
|
this.hero_id = v.hero_id;
|
||||||
@ -179,15 +194,16 @@ cc.Class({
|
|||||||
hero_id: v.hero_id,
|
hero_id: v.hero_id,
|
||||||
weapons: JSON.parse(this.weaponStr),
|
weapons: JSON.parse(this.weaponStr),
|
||||||
skins: [],
|
skins: [],
|
||||||
baseskin: gameConfig.all_ItemConfig[v.hero_skin].skinid,
|
baseskin:
|
||||||
|
gameConfig.all_ItemConfig[v.hero_skin].skinid,
|
||||||
hero_skin: v.hero_skin,
|
hero_skin: v.hero_skin,
|
||||||
skill_list: cc.playerData.getbattleskilllist(),
|
skill_list: cc.playerData.getbattleskilllist(),
|
||||||
hero_uniid:this.herodatalist[i].hero_uuid,
|
hero_uniid: this.herodatalist[i].hero_uuid,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.matchdata = data;
|
this.matchdata = data;
|
||||||
|
|
||||||
cc.battleIns.sendbattlemsg("CMMatchChoose", data);
|
cc.battleIns.sendbattlemsg('CMMatchChoose', data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +246,7 @@ cc.Class({
|
|||||||
for (var i = 0; i < pcount; i++) {
|
for (var i = 0; i < pcount; i++) {
|
||||||
var nd = cc.instantiate(this.pb_herolihui);
|
var nd = cc.instantiate(this.pb_herolihui);
|
||||||
addnode.addChild(nd);
|
addnode.addChild(nd);
|
||||||
var scp = nd.getComponent("pbbattleui");
|
var scp = nd.getComponent('pbbattleui');
|
||||||
scp.target = this;
|
scp.target = this;
|
||||||
this.herolist.push(scp);
|
this.herolist.push(scp);
|
||||||
}
|
}
|
||||||
@ -241,7 +257,7 @@ cc.Class({
|
|||||||
|
|
||||||
changetype(data1, data2) {
|
changetype(data1, data2) {
|
||||||
this.changelist(Number(data2));
|
this.changelist(Number(data2));
|
||||||
cc.Notifier.emit("btnchose", { k: data2 });
|
cc.Notifier.emit('btnchose', { k: data2 });
|
||||||
},
|
},
|
||||||
|
|
||||||
changelist(type) {
|
changelist(type) {
|
||||||
@ -251,23 +267,19 @@ cc.Class({
|
|||||||
var herolist = [];
|
var herolist = [];
|
||||||
this.allHeroUUID = [];
|
this.allHeroUUID = [];
|
||||||
this.allHeroID = [];
|
this.allHeroID = [];
|
||||||
this.heroDetails=[]
|
this.heroDetails = [];
|
||||||
|
|
||||||
NetManage.getHeroList((data) => {
|
NetManage.getHeroList((data) => {
|
||||||
herolist = data.hero_list;
|
herolist = data.hero_list;
|
||||||
for (var i = 0; i < herolist.length; i++) {
|
for (var i = 0; i < herolist.length; i++) {
|
||||||
var element = herolist[i];
|
var element = herolist[i];
|
||||||
if(element.lock_type!=3){
|
if (element.lock_type != 3) {
|
||||||
this.allHeroUUID.push(element.hero_uniid);
|
this.allHeroUUID.push(element.hero_uniid);
|
||||||
this.allHeroID.push(element.hero_id)
|
this.allHeroID.push(parseInt(element.hero_id));
|
||||||
this.heroDetails.push(herolist[i])
|
this.heroDetails.push(herolist[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.allHeroID)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (var i = 0; i < this.allHeroID.length; i++) {
|
for (var i = 0; i < this.allHeroID.length; i++) {
|
||||||
var hid = this.allHeroID[i];
|
var hid = this.allHeroID[i];
|
||||||
var heroType = gameConfig.playerConfig[hid].herotype;
|
var heroType = gameConfig.playerConfig[hid].herotype;
|
||||||
@ -281,16 +293,13 @@ cc.Class({
|
|||||||
var newlist = Utils.arrtoarr(cherolist, 2);
|
var newlist = Utils.arrtoarr(cherolist, 2);
|
||||||
// this.allHeroID = cherolist;
|
// this.allHeroID = cherolist;
|
||||||
this.tableView_chose
|
this.tableView_chose
|
||||||
.getComponent("tableView")
|
.getComponent('tableView')
|
||||||
.initTableView(newlist.length, {
|
.initTableView(newlist.length, {
|
||||||
array: newlist,
|
array: newlist,
|
||||||
target: this,
|
target: this,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// for (var i = 0; i < openherolist.length; i++) {
|
// for (var i = 0; i < openherolist.length; i++) {
|
||||||
// var hid = openherolist[i];
|
// var hid = openherolist[i];
|
||||||
// var heroType = gameConfig.playerConfig[hid].herotype;
|
// var heroType = gameConfig.playerConfig[hid].herotype;
|
||||||
@ -316,7 +325,7 @@ cc.Class({
|
|||||||
return this.allHeroUUID[index];
|
return this.allHeroUUID[index];
|
||||||
},
|
},
|
||||||
|
|
||||||
getHeroDetailByID(id){
|
getHeroDetailByID(id) {
|
||||||
var index = this.allHeroID.indexOf(id);
|
var index = this.allHeroID.indexOf(id);
|
||||||
return this.heroDetails[index];
|
return this.heroDetails[index];
|
||||||
},
|
},
|
||||||
@ -328,12 +337,9 @@ cc.Class({
|
|||||||
},
|
},
|
||||||
onclickgo() {
|
onclickgo() {
|
||||||
//single
|
//single
|
||||||
jcgamelog.addOperation(
|
jcgamelog.addOperation(OperationType.BUTTON, 'startgame');
|
||||||
OperationType.BUTTON,
|
|
||||||
'startgame',
|
|
||||||
);
|
|
||||||
if (!this.canzb) {
|
if (!this.canzb) {
|
||||||
cc.uiHelper.showTips("Please choose a hero first");
|
cc.uiHelper.showTips('Please choose a hero first');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// showLoading();
|
// showLoading();
|
||||||
@ -362,25 +368,22 @@ cc.Class({
|
|||||||
},
|
},
|
||||||
onclicktype() {},
|
onclicktype() {},
|
||||||
onclickcancelready() {
|
onclickcancelready() {
|
||||||
cc.battleIns.sendbattlemsg("CMMatchCancelStartGame");
|
cc.battleIns.sendbattlemsg('CMMatchCancelStartGame');
|
||||||
},
|
},
|
||||||
onclickready() {
|
onclickready() {
|
||||||
jcgamelog.addOperation(
|
jcgamelog.addOperation(OperationType.BUTTON, 'startgame');
|
||||||
OperationType.BUTTON,
|
|
||||||
'startgame',
|
|
||||||
);
|
|
||||||
// team
|
// team
|
||||||
if (!this.canzb) {
|
if (!this.canzb) {
|
||||||
cc.uiHelper.showTips("Please choose a hero first");
|
cc.uiHelper.showTips('Please choose a hero first');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (this.matchdata) {
|
if (this.matchdata) {
|
||||||
this.matchdata.weapons = JSON.parse(this.weaponStr);
|
this.matchdata.weapons = JSON.parse(this.weaponStr);
|
||||||
cc.battleIns.sendbattlemsg("CMMatchChoose", this.matchdata);
|
cc.battleIns.sendbattlemsg('CMMatchChoose', this.matchdata);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
cc.battleIns.sendbattlemsg("CMMatchStartGame");
|
cc.battleIns.sendbattlemsg('CMMatchStartGame');
|
||||||
},
|
},
|
||||||
doready(state) {
|
doready(state) {
|
||||||
if (this.team_mode) {
|
if (this.team_mode) {
|
||||||
@ -390,7 +393,7 @@ cc.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
infochangeskin(v) {
|
infochangeskin(v) {
|
||||||
cc.Notifier.emit("battleclickchose", {
|
cc.Notifier.emit('battleclickchose', {
|
||||||
account_id: SDKManage.account_id,
|
account_id: SDKManage.account_id,
|
||||||
hero_id: this.hero_id,
|
hero_id: this.hero_id,
|
||||||
hero_skin: v,
|
hero_skin: v,
|
||||||
@ -404,6 +407,6 @@ cc.Class({
|
|||||||
var node = cc.instantiate(this.pb_chooseWeapon);
|
var node = cc.instantiate(this.pb_chooseWeapon);
|
||||||
node.scale = 0.8;
|
node.scale = 0.8;
|
||||||
this.node.addChild(node);
|
this.node.addChild(node);
|
||||||
node.getComponent("chooseGun").startFrom(data);
|
node.getComponent('chooseGun').startFrom(data);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user