From 2da0dbbb7ba445c0593f3a93ff9470d93b936e19 Mon Sep 17 00:00:00 2001 From: "guoqing.zhu" <1521292690@qq.com> Date: Mon, 6 Jun 2022 10:51:24 +0800 Subject: [PATCH] updat --- assets/res/prefabs/NUI/UIGuninfo.prefab | 4 +- assets/res/prefabs/NUI/UINheroinfo.prefab | 4 +- .../res/prefabs/NUI/cell_HeroItemGroup.prefab | 16 ++++---- assets/res/prefabs/NUI/cell_guns.prefab | 12 +++--- assets/scripts/UI/battlematch/UIChoseHero.js | 41 ++++++++++++++++--- assets/scripts/UI/guns/chooseGun.js | 4 +- assets/scripts/UI/guns/guns_info.ts | 31 +++++++++++++- assets/scripts/UI/guns/guns_single.ts | 30 +++++++++++++- assets/scripts/UI/hero/UIHeroinfo.ts | 29 ++++++++++++- assets/scripts/UI/hero/herochoseone.js | 31 +++++++++++++- assets/scripts/UI/task/singleWanted.js | 4 +- 11 files changed, 175 insertions(+), 31 deletions(-) diff --git a/assets/res/prefabs/NUI/UIGuninfo.prefab b/assets/res/prefabs/NUI/UIGuninfo.prefab index 5e28aa97..acb07a16 100644 --- a/assets/res/prefabs/NUI/UIGuninfo.prefab +++ b/assets/res/prefabs/NUI/UIGuninfo.prefab @@ -10246,8 +10246,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, diff --git a/assets/res/prefabs/NUI/UINheroinfo.prefab b/assets/res/prefabs/NUI/UINheroinfo.prefab index 007aa048..479bc364 100644 --- a/assets/res/prefabs/NUI/UINheroinfo.prefab +++ b/assets/res/prefabs/NUI/UINheroinfo.prefab @@ -4622,8 +4622,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, diff --git a/assets/res/prefabs/NUI/cell_HeroItemGroup.prefab b/assets/res/prefabs/NUI/cell_HeroItemGroup.prefab index 171c28b1..db64b0e3 100644 --- a/assets/res/prefabs/NUI/cell_HeroItemGroup.prefab +++ b/assets/res/prefabs/NUI/cell_HeroItemGroup.prefab @@ -4391,8 +4391,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, @@ -9012,8 +9012,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, @@ -13633,8 +13633,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, @@ -18254,8 +18254,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, diff --git a/assets/res/prefabs/NUI/cell_guns.prefab b/assets/res/prefabs/NUI/cell_guns.prefab index 4f822fd0..5f6788e9 100644 --- a/assets/res/prefabs/NUI/cell_guns.prefab +++ b/assets/res/prefabs/NUI/cell_guns.prefab @@ -3066,8 +3066,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, @@ -6439,8 +6439,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, @@ -9812,8 +9812,8 @@ }, "_enabled": true, "_useOriginalSize": false, - "_string": "99:99:99", - "_N$string": "99:99:99", + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, diff --git a/assets/scripts/UI/battlematch/UIChoseHero.js b/assets/scripts/UI/battlematch/UIChoseHero.js index 481eb87d..55829923 100644 --- a/assets/scripts/UI/battlematch/UIChoseHero.js +++ b/assets/scripts/UI/battlematch/UIChoseHero.js @@ -257,13 +257,19 @@ cc.Class({ herolist = data.hero_list; for (var i = 0; i < herolist.length; i++) { var element = herolist[i]; - this.allHeroUUID.push(element.hero_uniid); - this.heroDetails.push(herolist[i]) + if(element.lock_type!=3){ + this.allHeroUUID.push(element.hero_uniid); + this.allHeroID.push(element.hero_id) + this.heroDetails.push(herolist[i]) + } } - }); - for (var i = 0; i < openherolist.length; i++) { - var hid = openherolist[i]; + console.log(this.allHeroID) + + + + 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)) { @@ -273,13 +279,36 @@ cc.Class({ } var newlist = Utils.arrtoarr(cherolist, 2); - this.allHeroID = cherolist; + // 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) { diff --git a/assets/scripts/UI/guns/chooseGun.js b/assets/scripts/UI/guns/chooseGun.js index 941af84e..d87c73f8 100644 --- a/assets/scripts/UI/guns/chooseGun.js +++ b/assets/scripts/UI/guns/chooseGun.js @@ -98,7 +98,9 @@ cc.Class({ // gun.getComponent(cc.Button). gun.getComponent("guns_single").removeClickEvent(); gun.off("click", this.chooseEvent, this); - gun.on("click", this.chooseEvent, this); + if( gun.getComponent("guns_single").wantedNode.active != true){ + gun.on("click", this.chooseEvent, this); + } }); }); }); diff --git a/assets/scripts/UI/guns/guns_info.ts b/assets/scripts/UI/guns/guns_info.ts index b4d1efde..63e477ed 100644 --- a/assets/scripts/UI/guns/guns_info.ts +++ b/assets/scripts/UI/guns/guns_info.ts @@ -65,10 +65,18 @@ export default class guns_info extends UIBase { ["35", this.lab_successrate], ["37", this.lab_naijiu], ]); - console.log(JSON.stringify(data.lock_type)) + + + var lefttime = data.unlock_lefttime if(data.lock_type==3){ this.showWanted() + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + this.schedule(function () { + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + lefttime-=1 + }, 1); + }else{ this.wantedNode.active = false @@ -119,4 +127,25 @@ export default class guns_info extends UIBase { imgNode.getComponent(cc.Sprite).spriteFrame = res; }); } + formatSeconds(value) { + let result = parseInt(value); + let h = + Math.floor(result / 3600) < 10 + ? '0' + Math.floor(result / 3600) + : Math.floor(result / 3600); + let m = + Math.floor((result / 60) % 60) < 10 + ? '0' + Math.floor((result / 60) % 60) + : Math.floor((result / 60) % 60); + let s = + Math.floor(result % 60) < 10 + ? '0' + Math.floor(result % 60) + : Math.floor(result % 60); + + let res = ''; + res += `${h}:`; + res += `${m}:`; + res += `${s}`; + return res; + } } diff --git a/assets/scripts/UI/guns/guns_single.ts b/assets/scripts/UI/guns/guns_single.ts index 3b7b9aa9..1d906a9f 100644 --- a/assets/scripts/UI/guns/guns_single.ts +++ b/assets/scripts/UI/guns/guns_single.ts @@ -31,10 +31,16 @@ export class guns_single extends cc.Component { } var limit = data.ceg_uplimit var get = data.today_get_gold - console.log(JSON.stringify(data.lock_type)) + + var lefttime = data.unlock_lefttime if(data.lock_type==3){ this.showWanted() + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + this.schedule(function () { + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + lefttime-=1 + }, 1); }else{ this.wantedNode.active = false } @@ -78,4 +84,26 @@ export class guns_single extends cc.Component { removeClickEvent() { this.getComponent(cc.Button).clickEvents.length = 0; } + + formatSeconds(value) { + let result = parseInt(value); + let h = + Math.floor(result / 3600) < 10 + ? '0' + Math.floor(result / 3600) + : Math.floor(result / 3600); + let m = + Math.floor((result / 60) % 60) < 10 + ? '0' + Math.floor((result / 60) % 60) + : Math.floor((result / 60) % 60); + let s = + Math.floor(result % 60) < 10 + ? '0' + Math.floor(result % 60) + : Math.floor(result % 60); + + let res = ''; + res += `${h}:`; + res += `${m}:`; + res += `${s}`; + return res; + } } diff --git a/assets/scripts/UI/hero/UIHeroinfo.ts b/assets/scripts/UI/hero/UIHeroinfo.ts index 7362e2ce..6773f408 100644 --- a/assets/scripts/UI/hero/UIHeroinfo.ts +++ b/assets/scripts/UI/hero/UIHeroinfo.ts @@ -108,9 +108,14 @@ export class UIHeroinfo extends UIBase { init(data: any) { - console.log(JSON.stringify(data.lock_type)) + var lefttime = data.unlock_lefttime if(data.lock_type==3){ this.showWanted() + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + this.schedule(function () { + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + lefttime-=1 + }, 1); }else{ this.wantedNode.active = false } @@ -317,4 +322,26 @@ export class UIHeroinfo extends UIBase { onClickUpgrade() { uimanger.showUI(UIUpdateHero.prefabPath, {}); } + + formatSeconds(value) { + let result = parseInt(value); + let h = + Math.floor(result / 3600) < 10 + ? '0' + Math.floor(result / 3600) + : Math.floor(result / 3600); + let m = + Math.floor((result / 60) % 60) < 10 + ? '0' + Math.floor((result / 60) % 60) + : Math.floor((result / 60) % 60); + let s = + Math.floor(result % 60) < 10 + ? '0' + Math.floor(result % 60) + : Math.floor(result % 60); + + let res = ''; + res += `${h}:`; + res += `${m}:`; + res += `${s}`; + return res; + } } diff --git a/assets/scripts/UI/hero/herochoseone.js b/assets/scripts/UI/hero/herochoseone.js index 57fe44d3..e65353f7 100644 --- a/assets/scripts/UI/hero/herochoseone.js +++ b/assets/scripts/UI/hero/herochoseone.js @@ -54,9 +54,16 @@ cc.Class({ return; } - console.log(JSON.stringify(v.lock_type)) + + var lefttime= v.unlock_lefttime + if(v.lock_type==3){ this.showWanted() + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + this.schedule(function () { + this.wantedNode.getComponentInChildren(cc.Label).string = this.formatSeconds(lefttime) + lefttime-=1 + }, 1); }else{ this.wantedNode.active = false } @@ -106,4 +113,26 @@ cc.Class({ onclick() { uimanger.showUI(this.infoPage, this._data); }, + + formatSeconds(value) { + let result = parseInt(value); + let h = + Math.floor(result / 3600) < 10 + ? '0' + Math.floor(result / 3600) + : Math.floor(result / 3600); + let m = + Math.floor((result / 60) % 60) < 10 + ? '0' + Math.floor((result / 60) % 60) + : Math.floor((result / 60) % 60); + let s = + Math.floor(result % 60) < 10 + ? '0' + Math.floor(result % 60) + : Math.floor(result % 60); + + let res = ''; + res += `${h}:`; + res += `${m}:`; + res += `${s}`; + return res; + } }); diff --git a/assets/scripts/UI/task/singleWanted.js b/assets/scripts/UI/task/singleWanted.js index c669c495..36f915c5 100644 --- a/assets/scripts/UI/task/singleWanted.js +++ b/assets/scripts/UI/task/singleWanted.js @@ -88,8 +88,8 @@ cc.Class({ : Math.floor(result % 60); let res = ''; - if (h !== '00') res += `${h}:`; - if (m !== '00') res += `${m}:`; + res += `${h}:`; + res += `${m}:`; res += `${s}`; return res; },