This commit is contained in:
guoqing.zhu 2022-06-13 20:27:21 +08:00
parent caad051e47
commit 11e2bde915
9 changed files with 768 additions and 250 deletions

View File

@ -47,8 +47,8 @@
},
"_scale": {
"__type__": "cc.Vec3",
"x": 0.982421875,
"y": 0.982421875,
"x": 0.8318611174186546,
"y": 0.8318611174186546,
"z": 1
},
"_quat": {

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
const NetManage = require('../../manages/NetManage');
import { uimanger } from '../UIManger';
import { ChooseHeroUpdate } from './ChooseHeroUpdate';
import { ChooseHeroUpQuality } from './ChooseHeroUpQuality';
import { UIUpdateHero } from './UIUpdateHero';
const { ccclass, property } = cc._decorator;
@ -28,18 +30,30 @@ export default class Academy_block extends cc.Component {
@property({ type: cc.Enum(BoxType) }) boxtype: BoxType = BoxType.UpLevel;
public status = TRAINBLOCKSTATUS.FREE;
private currentData: any;
private leftTime = 0;
protected onLoad(): void {
onLoad() {
this.setStatus(this.status);
}
init(data) {
this.currentData = data;
if (data == null) {
this.status = TRAINBLOCKSTATUS.FREE;
} else {
if (data.countdown == 0) {
this.status = TRAINBLOCKSTATUS.COMPLETE;
} else {
this.status = TRAINBLOCKSTATUS.TRAINING;
}
this.leftTime = this.currentData.countdown;
}
this.setStatus(this.status);
}
setStatus(status: TRAINBLOCKSTATUS) {
switch (status) {
// case TRAINBLOCKSTATUS.LOCKED:
// this.bg.getComponent(cc.Sprite).spriteFrame = this.allbgs[0];
// this.okTag.active = false;
// this.title.string = 'ADD NEW TRAINING ROOM';
// break;
case TRAINBLOCKSTATUS.FREE:
this.bg.getComponent(cc.Sprite).spriteFrame = this.allbgs[0];
this.addsign.active = true;
@ -52,6 +66,15 @@ export default class Academy_block extends cc.Component {
this.addsign.active = false;
this.title.string = 'TRAINING';
this.timeLabel.node.active = true;
this.schedule(function () {
if (this.leftTime >= 1) {
this.timeLabel.string = this.formatSeconds(
this.leftTime
);
this.leftTime -= 1;
}
}, 1);
this.okTag.active = false;
break;
case TRAINBLOCKSTATUS.COMPLETE:
@ -64,6 +87,28 @@ export default class Academy_block extends cc.Component {
}
}
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;
}
onClick(event, param) {
var data = {
boxIndex: param,
@ -82,4 +127,22 @@ export default class Academy_block extends cc.Component {
break;
}
}
onRecive() {
var type = 0;
if (this.boxtype == BoxType.UpLevel) {
type = 1;
} else {
type = 2;
}
NetManage.reciveUpReward(type, this.currentData.info.hero_uniid, () => {
cc.uiHelper.showTips('get reward success');
var node = cc
.find('Canvas')
.getComponentInChildren(UIUpdateHero).node;
node.emit('refreshUI');
// cc.Notifier.emit('refreshUI');
});
}
}

View File

@ -1,6 +1,7 @@
const NetManage = require('../../manages/NetManage');
import { UIBase } from '../UIBase';
import { uimanger } from '../UIManger';
import { UIUpdateHero } from './UIUpdateHero';
import { UpdateChoose } from './updatechoose';
const { ccclass, property } = cc._decorator;
@ -33,7 +34,11 @@ export class ChooseHeroUpQuality extends UIBase {
private mainHeroData: any;
private secHeroData: any;
init(data: any) {}
private boxIndex = 0;
init(data: any) {
this.boxIndex = data.boxIndex;
}
onLoad(): void {
this.oldAtk.string = '0';
@ -81,8 +86,13 @@ export class ChooseHeroUpQuality extends UIBase {
NetManage.heroUpgradeQuality(
this.mainHeroData,
this.secHeroData,
0,
this.boxIndex,
() => {
var node = cc
.find('Canvas')
.getComponentInChildren(UIUpdateHero).node;
node.emit('refreshUI');
this.node.destroy();
this.node.destroy();
}
);

View File

@ -1,5 +1,6 @@
import { UIBase } from '../UIBase';
import { uimanger } from '../UIManger';
import { UIUpdateHero } from './UIUpdateHero';
import { UpdateChoose } from './updatechoose';
const NetManage = require('../../manages/NetManage');
@ -17,8 +18,12 @@ export class ChooseHeroUpdate extends UIBase {
@property(cc.Node) chooseNode: cc.Node = null;
private hero_uuid = null;
private boxIndex = 0;
init(data: any) {}
init(data: any) {
this.boxIndex = data.boxIndex;
}
onLoad(): void {
cc.Notifier.on('academyCHOOSE', this, this.hasGetOne.bind(this));
@ -45,7 +50,11 @@ export class ChooseHeroUpdate extends UIBase {
onComform() {
if (this.hero_uuid) {
NetManage.heroUpgradeLevel(this.hero_uuid, 0, () => {
NetManage.heroUpgradeLevel(this.hero_uuid, this.boxIndex, () => {
var node = cc
.find('Canvas')
.getComponentInChildren(UIUpdateHero).node;
node.emit('refreshUI');
this.node.destroy();
});
} else {

View File

@ -1,37 +1,89 @@
const NetManage = require('../../manages/NetManage');
import { UIBase } from '../UIBase';
import Academy_block from './Academy_block';
const { ccclass, property } = cc._decorator;
@ccclass
export class UIUpdateHero extends UIBase {
public static prefabPath = 'prefabs/UIPrefab/UI_UpdateHero';
public static prefabPath = 'prefabs/UIPrefab/UI_UpdateHero';
@property(cc.Node) updateNode: cc.Node = null;
@property(cc.Node) advanceNode: cc.Node = null;
@property(cc.Node) updateNode: cc.Node = null;
@property(cc.Node) advanceNode: cc.Node = null;
@property(cc.Node) leftBtn: cc.Node = null;
@property(cc.Node) upLevelNodes: cc.Node = null;
@property(cc.Node) upGradeNodes: cc.Node = null;
init(data: any) {
if (data['current'] == 'advance') {
this.updateNode.active = false;
this.advanceNode.active = true;
this.leftBtn.children[0].getComponent(cc.Toggle).isChecked = false;
this.leftBtn.children[1].getComponent(cc.Toggle).isChecked = true;
}
}
@property(cc.Node) leftBtn: cc.Node = null;
onClickUpdate() {
this.updateNode.active = true;
this.advanceNode.active = false;
}
init(data: any) {
if (data['current'] == 'advance') {
this.updateNode.active = false;
this.advanceNode.active = true;
this.leftBtn.children[0].getComponent(cc.Toggle).isChecked = false;
this.leftBtn.children[1].getComponent(cc.Toggle).isChecked = true;
}
NetManage.getUpgradeLevelList((res) => {
for (let i = 0; i < 2; i += 1) {
this.upLevelNodes.children[i]
.getComponent(Academy_block)
.init(res.infos[i]);
}
});
}
onClickAdvance() {
this.updateNode.active = false;
this.advanceNode.active = true;
}
reSetUI() {
NetManage.getUpgradeLevelList((res) => {
for (let i = 0; i < 2; i += 1) {
this.upLevelNodes.children[i]
.getComponent(Academy_block)
.init(res.infos[i]);
}
});
onClose() {
this.node.destroy();
cc.loader.releaseRes(UIUpdateHero.prefabPath);
}
NetManage.getUpgradeQualityList((res) => {
for (let i = 0; i < 2; i += 1) {
this.upGradeNodes.children[i]
.getComponent(Academy_block)
.init(res.infos[i]);
}
});
}
protected onLoad(): void {
this.node.on('refreshUI', this.reSetUI, this);
}
onDestroy() {
this.node.off('refreshUI', this.reSetUI, this);
}
onClickUpdate() {
this.updateNode.active = true;
this.advanceNode.active = false;
NetManage.getUpgradeLevelList((res) => {
for (let i = 0; i < 2; i += 1) {
this.upLevelNodes.children[i]
.getComponent(Academy_block)
.init(res.infos[i]);
}
});
}
onClickAdvance() {
this.updateNode.active = false;
this.advanceNode.active = true;
NetManage.getUpgradeQualityList((res) => {
for (let i = 0; i < 2; i += 1) {
this.upGradeNodes.children[i]
.getComponent(Academy_block)
.init(res.infos[i]);
}
});
}
onClose() {
this.node.destroy();
cc.loader.releaseRes(UIUpdateHero.prefabPath);
}
}

View File

@ -28,6 +28,10 @@ export class UpdateChoose extends UIBase {
this.currentChoose = element;
});
this.nd_heroContent.addChild(node);
if (element.lock_type != 0) {
node.getComponent('wantedHero').showCover();
}
});
});
}

View File

@ -699,4 +699,37 @@ module.exports = {
.addKV('cost_item_id', 10001);
this.getResponce(cb, this.urlbd);
},
getUpgradeLevelList(cb) {
this.urlbd
.addKV('c', 'Hero')
.addKV('a', 'getUpgradeLevelList')
.addKV('account_id', this.account_id)
.addKV('session_id', this.session_id);
this.getResponce(cb, this.urlbd);
},
getUpgradeQualityList(cb) {
this.urlbd
.addKV('c', 'Hero')
.addKV('a', 'getUpgradeQualityList')
.addKV('account_id', this.account_id)
.addKV('session_id', this.session_id);
this.getResponce(cb, this.urlbd);
},
reciveUpReward(type, hero_uuid, cb) {
console.log(type);
console.log(hero_uuid);
this.urlbd.clear();
this.urlbd
.addKV('c', 'Hero')
.addKV('a', 'receive')
.addKV('account_id', this.account_id)
.addKV('session_id', this.session_id)
.addKV('type', type) // 1 level 2 quality
.addKV('hero_uniid', hero_uuid);
this.getResponce(cb, this.urlbd);
},
};

View File

@ -220,14 +220,15 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcapms/0.5.4_1.5.2.300.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2021/07/20<br />\n<strong>更新说明:</strong><br />\n1、新增对Game SDK的支持。<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcapms/0.5.6_1.5.2.300.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcapms",
"package_versions": [
"0.5.1_1.3.1",
"0.5.2_1.3.1.300",
"0.5.3_1.5.2.300",
"0.5.4_1.5.2.300"
"0.5.4_1.5.2.300",
"0.5.6_1.5.2.300"
],
"build_platform": [],
"require_verify": 0,
@ -251,13 +252,14 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcauth/0.5.3_1.4.1.300.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2021/08/10<br />\n<strong>更新说明:</strong><br />\n修复微信登陆失败的问题。<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcauth/0.5.6_1.6.0.300.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n2、更新 service SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcauth",
"package_versions": [
"0.5.1_1.3.1",
"0.5.2_1.4.1.300",
"0.5.3_1.4.1.300"
"0.5.3_1.4.1.300",
"0.5.6_1.6.0.300"
],
"build_platform": [],
"require_verify": 0,
@ -281,12 +283,13 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agccrash/0.5.5_1.4.1.300.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2020/10/19<br />\n<strong>更新说明:</strong><br />\n修复一些 bug<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agccrash/0.5.8_1.6.0.300.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n2、更新 service SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agccrash",
"package_versions": [
"0.5.3_1.3.2",
"0.5.5_1.4.1.300"
"0.5.5_1.4.1.300",
"0.5.8_1.6.0.300"
],
"build_platform": [],
"require_verify": 0,
@ -310,15 +313,16 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcapplinking/0.6.0_1.4.2.301.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2020/12/8<br />\n<strong>更新说明:</strong><br />\n1.升级 SDK 版本到 1.4.2.301<br />\n2.服务面板添加 <strong>intent link type</strong> 选项<br />\n3.服务面板添加 <strong>剪切板设置</strong> 选项<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcapplinking/0.6.2_1.6.0.300.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n2、更新 service SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcapplinking",
"package_versions": [
"0.5.2_1.3.2",
"0.5.4_1.3.2",
"0.5.7_1.4.1.300",
"0.5.9_1.4.1.300",
"0.6.0_1.4.2.301"
"0.6.0_1.4.2.301",
"0.6.2_1.6.0.300"
],
"build_platform": [],
"require_verify": 0,
@ -342,14 +346,15 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcappmessaging/0.5.6_1.4.2.301.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2020/12/04<br />\n<strong>更新说明:</strong><br />\n1、升级 SDK 版本到 1.4.2.301<br />\n2、增加了设置图片和弹框消息的显示位置setDisplayLocation 的接口<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcappmessaging/0.6.0_1.6.0.300.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n2、更新 service SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcappmessaging",
"package_versions": [
"0.5.2_1.4.0",
"0.5.3_1.4.0",
"0.5.3_1.4.0",
"0.5.6_1.4.2.301"
"0.5.6_1.4.2.301",
"0.6.0_1.6.0.300"
],
"build_platform": [],
"require_verify": 0,
@ -373,12 +378,13 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcremoteconfig/0.5.1_1.4.1.300.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2020/10/19<br />\n<strong>更新说明:</strong><br />\n更新 SDK 1.4.1.300,添加本地配置入口。<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcremoteconfig/0.5.3_1.6.0.300.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n2、更新 service SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcremoteconfig",
"package_versions": [
"0.5.0_1.4.0",
"0.5.1_1.4.1.300"
"0.5.1_1.4.1.300",
"0.5.3_1.6.0.300"
],
"build_platform": [],
"require_verify": 0,
@ -402,12 +408,13 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcstorage/0.5.2_1.3.1.100.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2020/12/04<br />\n<strong>更新说明:</strong><br />\n1.更新云存储 SDK 到版本 1.3.1.100<br />\n2.修复 updateFileMetadata 接口崩溃问题<br />\n3.新增部分 AGCStorageReference 接口<br />\n4.新增部分获取 Android 应用存储目录接口<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcstorage/0.5.4_1.4.0.100.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcstorage",
"package_versions": [
"0.5.1_1.3.0.300",
"0.5.2_1.3.1.100"
"0.5.2_1.3.1.100",
"0.5.4_1.4.0.100"
],
"build_platform": [],
"require_verify": 0,
@ -431,14 +438,15 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcclouddb/0.5.5_1.2.3.301.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2020/12/23<br />\n<strong>更新说明:</strong><br />\n1、修复生成器未适配新版 FORMAT-VERSION 的索引导致的崩溃问题。<br />\n2、修复 Query 查询器类型转换问题导致的崩溃。<br />\n3、修复JSON解析库导致的数据库插入失败。<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcclouddb/0.5.7_1.2.3.301.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcclouddb",
"package_versions": [
"0.5.1_1.2.1.301",
"0.5.3_1.2.3.301",
"0.5.4_1.2.3.301",
"0.5.5_1.2.3.301"
"0.5.5_1.2.3.301",
"0.5.7_1.2.3.301"
],
"build_platform": [],
"require_verify": 0,
@ -462,11 +470,12 @@
"support_platform": [
"安卓"
],
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcfunction/0.5.0_1.4.1.300.zip",
"package_version_desc": "<p><strong>更新日期:</strong> 2020/11/05<br />\n<strong>更新说明:</strong><br />\n新增 AGC 云函数服务<br />\n",
"package_download_url": "https://download.cocos.com/CocosUdc/plugins/service-agcfunction/0.5.2_1.6.0.300.zip",
"package_version_desc": "<p>1、更新 AGC SDK 版本到 v1.6.0.300<br />\n2、更新 service SDK 版本到 v1.6.0.300<br />\n",
"service_component_name": "service-agcfunction",
"package_versions": [
"0.5.0_1.4.1.300"
"0.5.0_1.4.1.300",
"0.5.2_1.6.0.300"
],
"build_platform": [],
"require_verify": 0,