add new ui

This commit is contained in:
guoqing.zhu 2022-06-07 10:49:46 +08:00
parent a4e42ef0d2
commit 2610429236
13 changed files with 3607 additions and 303 deletions

6
.prettierrc Normal file
View File

@ -0,0 +1,6 @@
{
"semi":true,
"singleQuote": true,
"tabWidth": 4,
"useTabs": true
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "64258bea-dcc5-4c36-8cb7-5ba3143f6974",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "106245c2-8c36-4d50-9569-92a5b53ff57f",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"subMetas": {}
}

View File

@ -1,10 +1,7 @@
const {
dropConfig,
all_ItemConfig,
} = require('../../game/gameConfig');
const { dropConfig, all_ItemConfig } = require('../../game/gameConfig');
const NetManage = require('../../manages/NetManage');
const { type } = require('../../netBattle/net/proto/bytebuffer');
var Utils = require("Utils")
var Utils = require('Utils');
cc.Class({
extends: cc.Component,
@ -22,43 +19,42 @@ cc.Class({
missionTitle: {
default: null,
type:cc.Label
type: cc.Label,
},
missionDesc: {
default: null,
type:cc.Label
type: cc.Label,
},
herolistNode: {
default: null,
type:cc.Node
type: cc.Node,
},
gunlistNode: {
default: null,
type:cc.Node
type: cc.Node,
},
rewardIcons: {
default: null,
type:cc.Node
type: cc.Node,
},
stars: {
default: null,
type:cc.Node
type: cc.Node,
},
fullStarSpriteframe: {
default: null,
type:cc.SpriteFrame
type: cc.SpriteFrame,
},
ceg_num: {
default: null,
type:cc.Label
}
type: cc.Label,
},
// needNode: {
// default: null,
// type: cc.Node,
@ -66,8 +62,7 @@ cc.Class({
},
initData(data, ceg_num) {
console.log("mission detail:"+JSON.stringify(data))
console.log('mission detail:' + JSON.stringify(data));
this.allChooseHero = new Array();
this.allChooseHero.length = 5;
this.allChooseGun = new Array();
@ -75,56 +70,54 @@ cc.Class({
this.missionData = data;
this.setRewards(data.reward)
this.setRewards(data.reward);
console.log(data.param2)
console.log(data.param2);
if (data.param2) {
for (let i = 0; i < data.param2; i += 1) {
console.log("set onmr ")
this.stars.children[i].getComponent(cc.Sprite).spriteFrame = this.fullStarSpriteframe
console.log('set onmr ');
this.stars.children[i].getComponent(cc.Sprite).spriteFrame =
this.fullStarSpriteframe;
}
}
if (data.param3) {
for (let i = 0; i < this.herolistNode.children.length; i += 1) {
this.herolistNode.children[i].active = false
this.herolistNode.children[i].active = false;
}
for (let i = 0; i < data.param3; i += 1) {
this.herolistNode.children[i].active = true
this.herolistNode.children[i].active = true;
}
}
if (data.param4) {
for (let i = 0; i < this.gunlistNode.children.length; i += 1) {
this.gunlistNode.children[i].active = false
this.gunlistNode.children[i].active = false;
}
for (let i = 0; i < data.param4; i += 1) {
this.gunlistNode.children[i].active = true
this.gunlistNode.children[i].active = true;
}
}
this.ceg_num.string =`x${ceg_num}`
this.ceg_num.string = `x${ceg_num}`;
},
setRewards(string) {
var config = dropConfig[string]
var rewards = config.itemdata
var config = dropConfig[string];
var rewards = config.itemdata;
// console.log(`reward---${JSON.stringify(rewards)}`)
for (let i = 0; i < rewards.length; i += 1) {
let id = rewards[i].id
let num = rewards[i].num
var tmp = this.rewardIcons.children[i]
tmp.active = true
tmp.children[0].getComponent(cc.Label).string = `x${num}`
let id = rewards[i].id;
let num = rewards[i].num;
var tmp = this.rewardIcons.children[i];
tmp.active = true;
tmp.children[0].getComponent(cc.Label).string = `x${num}`;
// console.log(JSON.stringify(all_ItemConfig[id]))
// Utils.setitem(this, id, tmp.children[1]);
}
},
// initNeedIcon(param, index) {
@ -173,7 +166,6 @@ cc.Class({
.init(data);
this.allChooseHero[this.currentBtn] = data;
}
});
cc.Notifier.on('hasChooseGun', this, (data) => {
@ -183,7 +175,6 @@ cc.Class({
.init(data);
this.allChooseGun[this.currentBtn] = data;
}
});
// cc.Notifier.on('ClearOneBox', this, (data) => {
@ -192,27 +183,25 @@ cc.Class({
// });
},
close() {
this.node.destroy();
cc.Notifier.off('hasChooseHero', this);
cc.Notifier.off('hasChooseGun', this);
},
onClickAdd(event, param) {
this.currentBtn = param;
console.log(this.currentBtn)
console.log(this.currentBtn);
this.mission_detail.active = true;
// set currentdata
console.log()
console.log();
var type = 0;
if(event.currentTarget.parent.name=="Hero"){
type = 0
if (event.currentTarget.parent.name == 'Hero') {
type = 0;
} else {
type = 1
type = 1;
}
this.mission_detail
@ -221,7 +210,7 @@ cc.Class({
},
check() {
return true
return true;
// let toReturn = true;
// this.allShowNode.forEach((element) => {
// if (element.children[0].active == false) {
@ -258,7 +247,7 @@ cc.Class({
this.allChooseHero.forEach((element) => {
if (element) {
if (element.hero_uniid) {
heroNum+=1
heroNum += 1;
this.sendData += `${1}:${element.hero_uniid}|`;
}
}
@ -274,11 +263,10 @@ cc.Class({
if (heroNum == 0) {
cc.uiHelper.showTips('Must choose a hero');
return
return;
}
if(this.sendData!=""){
if (this.sendData != '') {
NetManage.sendWantedMission(
this.missionData.id,
this.sendData,

View File

@ -1,6 +1,9 @@
const { dropConfig, all_ItemConfig } = require('../../game/gameConfig');
const NetManage = require('../../manages/NetManage');
var Utils = require("Utils")
var Utils = require('Utils');
const { uimanger } = require('../UIManger');
const { CancelBoost } = require('../../tips/CancelBoost');
const { BoostTips } = require('../../tips/BoostTips');
cc.Class({
extends: cc.Component,
@ -40,18 +43,28 @@ cc.Class({
stars: {
default: null,
type:cc.Node
type: cc.Node,
},
fullStarSpriteframe: {
default: null,
type:cc.SpriteFrame
type: cc.SpriteFrame,
},
ceg_num: {
default: null,
type:cc.Label
}
type: cc.Label,
},
},
onLoad() {
cc.Notifier.on('boostcancel', this, this.hasCancelBoost.bind(this));
cc.Notifier.on('boostsuccess', this, this.boostsuccess.bind(this));
},
onDestroy() {
cc.Notifier.off('boostcancel', this, this.hasCancelBoost.bind(this));
cc.Notifier.off('boostsuccess', this, this.boostsuccess.bind(this));
},
onClickBtn() {
@ -63,26 +76,40 @@ cc.Class({
}
if (this.missionState == 1) {
const node = cc.instantiate(this.missionPrefab);
node.getComponent('mission_choose').initData(this.wantedData,this.ceg);
node.getComponent('mission_choose').initData(
this.wantedData,
this.ceg
);
cc.find('Canvas').addChild(node);
}
if (this.missionState == 2) {
NetManage.boostOfferRewardMission(this.missionId, () => {
this.node.destroy();
cc.uiHelper.showTips('Boost Success!');
});
var data = {
cegNum: 10,
missionId: this.missionId,
};
uimanger.showUI(BoostTips.prefabPath, data);
}
},
onCancelBtn() {
cc.uiHelper.showTips('Boost cancel!');
uimanger.showUI(CancelBoost.prefabPath);
},
hasCancelBoost() {
NetManage.cancelOfferRewardMission(this.missionId, () => {
this.boostNode.active = false
this.receiveNode.active = false
this.getNode.active = true
this.lb_time.node.parent.active = false
})
this.boostNode.active = false;
this.receiveNode.active = false;
this.getNode.active = true;
this.lb_time.node.parent.active = false;
cc.uiHelper.showTips('Boost cancel!');
});
},
boostsuccess() {
NetManage.boostOfferRewardMission(this.missionId, () => {
// this.node.destroy();
cc.uiHelper.showTips('Boost Success!');
});
},
formatSeconds(value) {
@ -108,12 +135,10 @@ cc.Class({
},
init(data, originData) {
if (data.param2) {
for (let i = 0; i < data.param2; i += 1) {
this.stars.children[i].getComponent(cc.Sprite).spriteFrame = this.fullStarSpriteframe
this.stars.children[i].getComponent(cc.Sprite).spriteFrame =
this.fullStarSpriteframe;
}
}
@ -121,19 +146,19 @@ cc.Class({
this.missionId = originData.mission_id;
if (originData.state == 0) {
// this.btn_label.string = 'GET';
this.receiveNode.active = true
this.receiveNode.active = true;
this.missionState = 0;
}
if (originData.state == 2) {
if (originData.objects.length == 0) {
// this.btn_label.string = 'RECEIVE';
this.getNode.active = true
this.getNode.active = true;
this.missionState = 1;
} else {
var leftTime = originData.lefttime;
this.lb_time.node.parent.active = true;
// this.btn_label.string = 'BOOST';
this.boostNode.active = true
this.boostNode.active = true;
this.missionState = 2;
this.lb_time.string = this.formatSeconds(leftTime);
this.schedule(function () {
@ -148,29 +173,25 @@ cc.Class({
this.node.destroy();
}
this.ceg = originData.ceg_num
this.ceg_num.string =`x${originData.ceg_num}`
this.ceg = originData.ceg_num;
this.ceg_num.string = `x${originData.ceg_num}`;
},
start() {
this.setRewards(this.wantedData.reward)
this.setRewards(this.wantedData.reward);
},
setRewards(string) {
var config = dropConfig[string]
var rewards = config.itemdata
var config = dropConfig[string];
var rewards = config.itemdata;
for (let i = 0; i < rewards.length; i += 1) {
let id = rewards[i].id
let num = rewards[i].num
var tmp = this.allRewardNode.children[i]
tmp.active = true
tmp.children[0].getComponent(cc.Label).string = `x${num}`
let id = rewards[i].id;
let num = rewards[i].num;
var tmp = this.allRewardNode.children[i];
tmp.active = true;
tmp.children[0].getComponent(cc.Label).string = `x${num}`;
// Utils.setitem(this, id, tmp.children[1]);
}
},
});

View File

@ -31,8 +31,7 @@ window.connectOK = (account) => {
};
window.chainErr = () => {
console.log("打开提示框")
cc.Notifier.emit("chainerr");
cc.Notifier.emit('chainerr');
};
window.signApp = (sign) => {
@ -133,7 +132,6 @@ cc.Class({
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.allCountry = ['Japan', 'Singapore', 'Turkey', 'USA'];
this.cpa_icon = [];
@ -147,8 +145,7 @@ cc.Class({
cc.Notifier.on('autologinsuccess', this, this.loadMain.bind(this));
cc.Notifier.on("chainerr",this,this.showchainErrTip.bind(this));
cc.Notifier.on('chainerr', this, this.showchainErrTip.bind(this));
cc.debug.setDisplayStats(false);
@ -200,7 +197,7 @@ cc.Class({
cc.Notifier.off('sdkloginfail', this);
cc.Notifier.off('sdkLoginSuccess', this);
cc.Notifier.off('autologinsuccess', this);
cc.Notifier.off("chainerr",this,this.showchainErrTip.bind(this));
cc.Notifier.off('chainerr', this, this.showchainErrTip.bind(this));
cc.loader.onProgress = null;
SDKManage.logEvent('login_success', 'loginmain');
},
@ -251,17 +248,13 @@ cc.Class({
//
SDKManage.init('6516');
jcgamelog.addOperation(OperationType.LOGIN, 'gamestart');
jcgamelog.addOperation(
OperationType.LOGIN,
'gamestart',
OperationType.Login,
Config.mainConfig.packageid
);
console.log(`current packageid `+ Config.mainConfig.packageid)
console.log(`current version `+ Config.mainConfig.version)
jcgamelog.addOperation(OperationType.Login,Config.mainConfig.packageid)
if (!localStorage.getItem('currentNet')) {
localStorage.setItem('currentNet', allBaseNet.japan);
} else {

View File

@ -0,0 +1,35 @@
import NetManage from '../manages/NetManage';
import { UIBase } from '../UI/UIBase';
const { ccclass, property } = cc._decorator;
@ccclass
export class BoostTips extends UIBase {
public static prefabPath = 'prefabs/tips/pb_Boost';
@property(cc.Label) cegLabel: cc.Label = null;
private indata: any;
init(data: any) {
// {
// cegNum
// missionid
// }
this.indata = data;
this.cegLabel.string = `x${data.cegNum}`;
}
onClose() {
this.node.destroy();
}
onOK() {
this.node.destroy();
cc.Notifier.emit('boostsuccess');
// NetManage.boostOfferRewardMission(this.indata.missionId, () => {
// this.node.destroy();
// cc.uiHelper.showTips('Boost Success!');
// });
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "2d1dad63-551e-423c-9807-8647f0bc7082",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,22 @@
import NetManage from '../manages/NetManage';
import { UIBase } from '../UI/UIBase';
const { ccclass, property } = cc._decorator;
@ccclass
export class CancelBoost extends UIBase {
public static prefabPath = 'prefabs/tips/pb_cancelBoost';
private indata: any;
init(data: any) {}
onClose() {
this.node.destroy();
}
onOK() {
this.node.destroy();
cc.Notifier.emit('boostcancel');
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "e7f6257e-ede2-4576-a521-bbb6c70b9a7c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}