refactor(gui): 首页 英雄选择信息更新 初步 完成
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "611b96e7-5597-4b8a-bdd7-d532cdc27c6f",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "Hinfo"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,10 +16,7 @@ export enum UIID {
|
||||
Netinstable,
|
||||
/** 角色控制 */
|
||||
Role_Controller,
|
||||
HeroInfo,
|
||||
Victory,
|
||||
HeroSelect,
|
||||
ItemInfo,
|
||||
Guide=1001,
|
||||
// Shop_Page,
|
||||
// Hero_Page,
|
||||
@@ -31,10 +28,7 @@ export var UIConfigData: { [key: number]: UIConfig } = {
|
||||
[UIID.Netinstable]: { layer: LayerType.PopUp, prefab: "common/prefab/netinstable" },
|
||||
// [UIID.Window]: { layer: LayerType.Dialog, prefab: "common/prefab/window" },
|
||||
[UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" },
|
||||
[UIID.HeroInfo]: { layer: LayerType.UI, prefab: "gui/Hinfo" },
|
||||
[UIID.Victory]: { layer: LayerType.UI, prefab: "gui/element/victory" },
|
||||
[UIID.HeroSelect]: { layer: LayerType.UI, prefab: "gui/hero_select" },
|
||||
[UIID.ItemInfo]: { layer: LayerType.UI, prefab: "gui/element/item_info" },
|
||||
[UIID.Guide]: { layer: LayerType.UI, prefab: "gui/element/guide_step" },
|
||||
// [UIID.Shop_Page]: { layer: LayerType.UI, prefab: "gui/shop_page" },
|
||||
// [UIID.Hero_Page]: { layer: LayerType.UI, prefab: "gui/heros_page" },
|
||||
|
||||
@@ -30,6 +30,15 @@ export enum HType {
|
||||
warrior = 0,
|
||||
remote = 1,
|
||||
mage = 2,
|
||||
support = 3,
|
||||
assassin = 4,
|
||||
}
|
||||
export const HTypeName ={
|
||||
0:"战士",
|
||||
1:"远程",
|
||||
2:"法师",
|
||||
3:"辅助",
|
||||
4:"刺客",
|
||||
}
|
||||
/**
|
||||
* 解锁英雄所需物品
|
||||
@@ -96,101 +105,101 @@ export const MonSet = {
|
||||
export const HeroInfo = {
|
||||
//主将
|
||||
5001:{uuid:5001,name:"火焰骑士",path:"hk1", fac:FacSet.HERO, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001,6301,6302,6303],
|
||||
type:HType.warrior,hp:100,def:5,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001,6301,6302,6303],
|
||||
buff:[],info:""},
|
||||
|
||||
5002:{uuid:5002,name:"刺客",path:"hc1", fac:FacSet.HERO, quality:QualitySet.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001,6301,6302,6303],
|
||||
type:HType.warrior,hp:100,def:5,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001,6301,6302,6303],
|
||||
buff:[],info:""},
|
||||
|
||||
|
||||
5005:{uuid:5005,name:"绿箭",path:"ha1", fac:FacSet.HERO, quality:QualitySet.BLUE,lv:1,kind:2,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003,6301,6302,6303],
|
||||
type:HType.remote,hp:100,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003,6301,6302,6303],
|
||||
buff:[],info:""},
|
||||
|
||||
|
||||
5007:{uuid:5007,name:"牧师",path:"hmh1", fac:FacSet.HERO, quality:QualitySet.PURPLE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6004,6004,6301,6302,6303],
|
||||
type:HType.mage,hp:100,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6004,6004,6301,6302,6303],
|
||||
buff:[],info:""},
|
||||
|
||||
5008:{uuid:5008,name:"火女",path:"hmf1", fac:FacSet.HERO, quality:QualitySet.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6005,6005,6301,6302,6303],
|
||||
type:HType.mage,hp:100,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6005,6005,6301,6302,6303],
|
||||
buff:[],info:""},
|
||||
|
||||
// 5009:{uuid:5009,name:"风暴精灵",path:"hk1", fac:FacSet.HERO, quality:QualitySet.BLUE,lv:1,kind:2,
|
||||
// type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6006,6006,6301,6302,6303],
|
||||
// type:HType.mage,hp:100,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6006,6006,6301,6302,6303],
|
||||
// buff:[],info:""},
|
||||
|
||||
// 5010:{uuid:5010,name:"战争祭祀",path:"hk1", fac:FacSet.HERO, quality:QualitySet.ORANGE,lv:1,kind:2,
|
||||
// type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6007,6007,6301,6302,6303],
|
||||
// type:HType.mage,hp:100,def:5,ap:15,dis:400,cd:1.5,speed:100,skills:[6007,6007,6301,6302,6303],
|
||||
// buff:[],info:""},
|
||||
|
||||
// 5011:{uuid:5011,name:"ha2",path:"ha2", fac:FacSet.HERO, quality:QualitySet.BLUE,lv:1,kind:2,
|
||||
// type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003,6301,6302,6303],
|
||||
// type:HType.remote,hp:100,def:5,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003,6301,6302,6303],
|
||||
// buff:[],info:""},
|
||||
|
||||
|
||||
//怪物
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
type:HType.warrior,hp:25,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1,speed:100,skills:[6007],
|
||||
type:HType.remote,hp:20,def:5,ap:5,dis:350,cd:1,speed:100,skills:[6007],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
type:HType.warrior,hp:25,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5204:{uuid:5204,name:"石卫", path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6001],
|
||||
type:HType.mage,hp:18,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5205:{uuid:5205,name:"土卫", path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6001],
|
||||
type:HType.mage,hp:18,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5206:{uuid:5206,name:"树卫", path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6001],
|
||||
type:HType.mage,hp:18,def:5,ap:5,dis:90,cd:2.5,speed:100,skills:[6001],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
|
||||
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:2,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
type:HType.warrior,hp:25,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
type:HType.warrior,hp:25,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1.5,speed:100,skills:[6007],
|
||||
type:HType.remote,hp:20,def:5,ap:5,dis:350,cd:1.5,speed:100,skills:[6007],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
type:HType.warrior,hp:25,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
type:HType.warrior,hp:25,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"mo1", fac:FacSet.MON, quality:QualitySet.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1.5,speed:100,skills:[6001],
|
||||
type:HType.remote,hp:20,def:5,ap:5,dis:350,cd:1.5,speed:100,skills:[6001],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5225:{uuid:5225,name:"精英独眼",path:"mo1", fac:FacSet.MON, quality:QualitySet.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6006],
|
||||
type:HType.warrior,hp:45,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6006],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mo1", fac:FacSet.MON, quality:QualitySet.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6007],
|
||||
type:HType.warrior,hp:45,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6007],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mo1", fac:FacSet.MON, quality:QualitySet.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6005],
|
||||
type:HType.warrior,hp:45,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6005],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { _decorator, Animation, AnimationClip, Component, Label, Node, resources, Sprite, SpriteFrame } from 'cc';
|
||||
import { oops } from 'db://oops-framework/core/Oops';
|
||||
import { UIID } from '../common/config/GameUIConfig';
|
||||
import { getHeroList, getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType, unlockHeroCost } from '../common/config/heroSet';
|
||||
import { getHeroList, getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType, HTypeName, unlockHeroCost } from '../common/config/heroSet';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
import { NumberFormatter } from '../common/config/BoxSet';
|
||||
@@ -12,13 +12,19 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('HInfoComp')
|
||||
export class HInfoComp extends Component {
|
||||
h_uuid:number=0
|
||||
name_node:any=null
|
||||
type_node:any=null
|
||||
ap_node:any=null
|
||||
hp_node:any=null
|
||||
def_node:any=null
|
||||
start() {
|
||||
|
||||
}
|
||||
onAdded(args: any) {
|
||||
console.log("[HInfoComp]:onAdded",this.node)
|
||||
this.update_data(args)
|
||||
startGuide(5)
|
||||
this.name_node=this.node.getChildByName("hero").getChildByName("hname").getChildByName("name")
|
||||
this.type_node=this.node.getChildByName("hero").getChildByName("hname").getChildByName("type")
|
||||
this.ap_node=this.node.getChildByName("info").getChildByName("base").getChildByName("ap").getChildByName("num")
|
||||
this.hp_node=this.node.getChildByName("info").getChildByName("base").getChildByName("hp").getChildByName("num")
|
||||
this.def_node=this.node.getChildByName("info").getChildByName("base").getChildByName("def").getChildByName("num")
|
||||
this.h_uuid=smc.fight_heros[0]
|
||||
this.update_data(this.h_uuid)
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
@@ -27,102 +33,16 @@ export class HInfoComp extends Component {
|
||||
this.h_uuid=uuid
|
||||
let hero_data = HeroInfo[uuid]
|
||||
console.log("[HInfoComp]:update_data",uuid,hero_data,this.node)
|
||||
let lv=smc.heros[uuid]?.lv??1
|
||||
this.name_node.getComponent(Label).string=hero_data.name
|
||||
this.type_node.getComponent(Label).string=HTypeName[hero_data.type]
|
||||
this.ap_node.getComponent(Label).string=hero_data.ap.toString()
|
||||
this.hp_node.getComponent(Label).string=hero_data.hp.toString()
|
||||
this.def_node.getComponent(Label).string=hero_data.def.toString()
|
||||
let anm_path=hero_data.path
|
||||
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
|
||||
this.node.getChildByName("hero").getComponent(Animation).addClip(clip);
|
||||
this.node.getChildByName("hero").getComponent(Animation).play("idle");
|
||||
});
|
||||
this.node.getChildByName("name").getComponent(Label).string=hero_data.name
|
||||
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=lv.toString()
|
||||
this.node.getChildByName("skills").getChildByName("sk2").getChildByName("lock").active= lv <5
|
||||
this.node.getChildByName("skills").getChildByName("sk3").getChildByName("lock").active= lv <10
|
||||
this.node.getChildByName("skills").getChildByName("sk4").getChildByName("lock").active= lv <15
|
||||
this.node.getChildByName("skills").getChildByName("sk5").getChildByName("lock").active= lv <20
|
||||
let {hp,ap,def}=getHeroStatsByLevel(uuid,lv)
|
||||
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=hp.toString()
|
||||
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=ap.toString()
|
||||
this.node.getChildByName("info").getChildByName("def").getChildByName("num").getComponent(Label).string=def.toString()
|
||||
let {experience,gold}=getUpgradeResources(lv)
|
||||
this.updata_need(experience,gold)
|
||||
this.node.getChildByName("upBtn").active=smc.data.exp>=experience&&smc.data.gold>=gold
|
||||
this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior
|
||||
this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote
|
||||
this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage
|
||||
this.show_lock(smc.heros[uuid]?.lv??0)
|
||||
}
|
||||
updata_need(experience:number,gold:number){
|
||||
let need_node=this.node.getChildByName("upNeed").getChildByName("need")
|
||||
need_node.getChildByName("exp").getChildByName("need").getComponent(Label).string=NumberFormatter.formatNumber(experience)
|
||||
need_node.getChildByName("gold").getChildByName("need").getComponent(Label).string=NumberFormatter.formatNumber(gold)
|
||||
need_node.getChildByName("exp").getChildByName("has").getComponent(Label).string=NumberFormatter.formatNumber(smc.data.exp)
|
||||
need_node.getChildByName("gold").getChildByName("has").getComponent(Label).string=NumberFormatter.formatNumber(smc.data.gold)
|
||||
}
|
||||
show_lock(lv:number){
|
||||
|
||||
if(lv==0){
|
||||
console.log("[HInfoComp]:show_lock lv==0",this.node)
|
||||
finishCurrGuide(3)
|
||||
startGuide(4)
|
||||
}
|
||||
this.node.getChildByName("upBtn").active=lv > 0
|
||||
this.node.getChildByName("upNeed").active=lv > 0
|
||||
this.node.getChildByName("lock").active=lv == 0
|
||||
this.node.getChildByName("unLock").active=lv == 0
|
||||
let need_item=unlockHeroCost[HeroInfo[this.h_uuid].quality]
|
||||
// console.log("[HInfoComp]:show_lock item:item_uuid:hero_uuid:hero_data",Items[need_item.i_uuid],need_item.i_uuid,this.h_uuid,HeroInfo[this.h_uuid])
|
||||
|
||||
this.node.getChildByName("unLockNeed").getChildByName("need").getChildByName("has").getComponent(Label).string=smc.items[need_item.i_uuid]??0
|
||||
this.node.getChildByName("unLockNeed").getChildByName("need").getChildByName("need").getComponent(Label).string=NumberFormatter.formatNumber(need_item.num)
|
||||
let path="gui/items/"+Items[need_item.i_uuid].path
|
||||
resources.load(path,SpriteFrame, (err, clip) => {
|
||||
this.node.getChildByName("unLockNeed").getChildByName("need").getChildByName("icon").getComponent(Sprite).spriteFrame=clip
|
||||
});
|
||||
this.node.getChildByName("unLockNeed").active=lv == 0
|
||||
}
|
||||
uplockhero(){
|
||||
let need_item=unlockHeroCost[HeroInfo[this.h_uuid].quality]
|
||||
if(!smc.items[need_item.i_uuid]||smc.items[need_item.i_uuid]<need_item.num){
|
||||
oops.gui.toast("["+Items[need_item.i_uuid].name+"]数量不足")
|
||||
return
|
||||
}
|
||||
if(!smc.spendItem(need_item.i_uuid,need_item.num)){
|
||||
smc.error()
|
||||
return
|
||||
}
|
||||
if(!smc.addHero(this.h_uuid)){
|
||||
smc.addItem(need_item.i_uuid,need_item.num,false)
|
||||
oops.gui.toast("英雄< "+HeroInfo[this.h_uuid].name+" >招募失败")
|
||||
return
|
||||
}
|
||||
oops.gui.toast("英雄< "+HeroInfo[this.h_uuid].name+" >招募成功")
|
||||
finishCurrGuide(4)
|
||||
startGuide(5)
|
||||
this.update_data(this.h_uuid)
|
||||
oops.message.dispatchEvent(GameEvent.HeroUnlock, {uuid:this.h_uuid})
|
||||
}
|
||||
uplevel(){
|
||||
let lv=smc.heros[this.h_uuid].lv
|
||||
let {experience,gold}=getUpgradeResources(lv)
|
||||
if(smc.data.exp<experience||smc.data.gold<gold){
|
||||
oops.gui.toast("经验或金币不足")
|
||||
return
|
||||
}
|
||||
if(!smc.spendGameProperty({exp:experience,gold:gold},false)){
|
||||
smc.error()
|
||||
return
|
||||
}
|
||||
if(!smc.levelUpHero(this.h_uuid)){
|
||||
smc.addExp(experience,false)
|
||||
smc.addGold(gold,false)
|
||||
smc.error()
|
||||
return
|
||||
}
|
||||
this.update_data(this.h_uuid)
|
||||
finishCurrGuide(5)
|
||||
startGuide(6)
|
||||
oops.gui.toast(`英雄< ${HeroInfo[this.h_uuid].name} >升级成功`)
|
||||
oops.message.dispatchEvent(GameEvent.HeroLvUp, {uuid:this.h_uuid})
|
||||
}
|
||||
next_hero(){
|
||||
let heros=getHeroList()
|
||||
|
||||
Reference in New Issue
Block a user