英雄页面基本完成,todo 完善 数据显示
This commit is contained in:
@@ -6,10 +6,10 @@ type:
|
||||
*/
|
||||
|
||||
export const Items={
|
||||
1001:{uuid: 1001,path: "3011",type:1,lv:1,r_num:10,name: "近战卷轴",info:"提升近战英雄等级", },
|
||||
1001:{uuid: 1001,path: "3011",type:1,lv:1,r_num:10,name: "经验卷轴",info:"提升英雄等级", },
|
||||
1002:{uuid: 1002,path: "3012",type:1,lv:1,r_num:10,name: "远程卷轴",info:"提升远程英雄等级", },
|
||||
1003:{uuid: 1003,path: "3013",type:1,lv:1,r_num:10,name: "辅助卷轴",info:"提升辅助英雄等级", },
|
||||
1004:{uuid: 1004,path: "2011",type:1,lv:2,r_num:10,name: "近战凭证",info:"提升近战英雄星级", },
|
||||
1004:{uuid: 1004,path: "2011",type:1,lv:2,r_num:10,name: "英雄凭证",info:"提升英雄星级", },
|
||||
1005:{uuid: 1005,path: "2012",type:1,lv:2,r_num:10,name: "远程凭证",info:"提升远程英雄星级", },
|
||||
1006:{uuid: 1006,path: "2013",type:1,lv:2,r_num:10,name: "辅助凭证",info:"提升辅助英雄星级", },
|
||||
1021:{uuid: 1021,path: "1001",type:1,lv:1,r_num:1,name: "普通攻击石",info:"增加装备攻击力10,成功几率20%", },
|
||||
|
||||
@@ -2,6 +2,7 @@ import { _decorator } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { HeroHomeComp } from "../map/HeroHomeComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -12,7 +13,9 @@ export class HeroCardComp extends CCComp {
|
||||
@property(HeroHomeComp)
|
||||
hcc_home: HeroHomeComp = null!;
|
||||
hcc_uuid: number = 0;
|
||||
|
||||
onLoad() {
|
||||
oops.message.on("hero_card_show_info", this.check_show, this);
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
this.hcc_home=this.node.parent.parent.parent.parent.getComponent(HeroHomeComp);
|
||||
@@ -21,6 +24,16 @@ export class HeroCardComp extends CCComp {
|
||||
}
|
||||
show_info(){
|
||||
this.hcc_home.hero_show(this.hcc_uuid)
|
||||
oops.message.dispatchEvent("hero_card_show_info",{uuid:this.hcc_uuid})
|
||||
}
|
||||
check_show(event: string, args: any){
|
||||
this.show_bg(false)
|
||||
if(args.uuid==this.hcc_uuid){
|
||||
this.show_bg(true)
|
||||
}
|
||||
}
|
||||
show_bg(val:boolean){
|
||||
this.node.getChildByName("show").active=val
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
|
||||
@@ -40,11 +40,14 @@ export class CardControllerComp extends CCComp {
|
||||
|
||||
}
|
||||
hh_show(){
|
||||
this.node.getChildByName("hero_home").active = true;
|
||||
let node=this.node.getChildByName("hero_home")
|
||||
tween(node).to( 0.1,{ position: v3(0,node.position.y)}, ).start();
|
||||
}
|
||||
hh_hide(){
|
||||
this.node.getChildByName("hero_home").active = false;
|
||||
let node=this.node.getChildByName("hero_home")
|
||||
tween(node).to( 0.1,{ position: v3(1000,node.position.y)}, ).start();
|
||||
}
|
||||
|
||||
mh_show(){
|
||||
this.node.getChildByName("mission_home").active=true;
|
||||
}
|
||||
|
||||
@@ -4,19 +4,24 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { HeroList } from "../common/config/heroSet";
|
||||
import { HeroCard } from "../hero/HeroCard";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { Items } from "../common/config/Items";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('HeroHomeComp')
|
||||
@ecs.register('HeroHome', false)
|
||||
export class HeroHomeComp extends CCComp {
|
||||
|
||||
h_uuid:number=0
|
||||
protected onLoad(): void {
|
||||
|
||||
}
|
||||
start() {
|
||||
// this.load_talents()
|
||||
console.log("hero_home start")
|
||||
this.h_uuid=9001
|
||||
this.hero_show(this.h_uuid)
|
||||
this.loads()
|
||||
}
|
||||
loads(){
|
||||
@@ -33,6 +38,7 @@ export class HeroHomeComp extends CCComp {
|
||||
}
|
||||
hero_show(uuid:number) {
|
||||
console.log("hero_home hero_show:",uuid)
|
||||
this.h_uuid=uuid
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
|
||||
@@ -40,7 +46,15 @@ export class HeroHomeComp extends CCComp {
|
||||
});
|
||||
this.node.getChildByName("name").getChildByName("value").getComponent(Label).string=smc.heros[uuid].name
|
||||
}
|
||||
|
||||
lv_up(){
|
||||
console.log("lvup h_uuid:",this.h_uuid)
|
||||
}
|
||||
slv_up(){
|
||||
console.log("lvup slv_up:",this.h_uuid)
|
||||
}
|
||||
item_show(e:any,val:any){
|
||||
oops.gui.open(UIID.ItemInfo, Items[val]);
|
||||
}
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user