物品ui修改 完善

This commit is contained in:
panw
2025-01-20 10:29:02 +08:00
parent d756516cc6
commit 2b7de7ee92
11 changed files with 2853 additions and 1237 deletions

View File

@@ -54,11 +54,23 @@ export enum GameSet {
HERO_NUM=3,
}
export const ColorSet: { [key: string]: string } = {
RED: "ff364d",
RED: "FF364D",
RED1: "FC1702",
RED2: "7B0B05",
BLUE: "2CBEFF",
BLUE2: "00A8FF",
BLUE3: "117bff",
BLUE4: "113287",
YELLOW: "E0C300" ,
YELLOW2: "DBAD00" ,
GREEN:"83CE00",
GREEN2:"17A047",
YELLOW3: "F19A02",
YELLOW4: "8E3110",
GREEN: "83CE00",
GREEN2: "17A047",
GREEN3: "5ECC3C",
GREEN4: "014523",
PURPLE1: "B640EA",
PURPLE2: "621678",
ORIGIN1: "968369",
ORIGIN2: "483825",
};

View File

@@ -19,7 +19,7 @@ export class HChipComp extends Component {
}
show_info(){
if(this.node.parent.name=="reward"||this.node.parent.name=="item_info") return
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:2});
}

View File

@@ -30,11 +30,11 @@ const { ccclass, property } = _decorator;
@ccclass('HeroViewComp') // 定义为 Cocos Creator 组件
@ecs.register('HeroView', false) // 定义为 ECS 组件
export class HeroViewComp extends CCComp {
BUFFCOMP:any=null!;
enemy_pos:Vec3=null!;
enemy:any=null!;
BUFFCOMP:BuffComp=null!
enemy_pos:Vec3=null!
// enemy:any=null!;
as: HeroSpine = null!;
as: HeroSpine = null!
anm_timer:Timer = new Timer(0.3);
anm_name="idle"
status:String = "idle"

View File

@@ -17,7 +17,7 @@ export class ItemComp extends CCComp {
//todo 设定icon 显示
}
update_data(uuid:number,num:number){
update_data(uuid:number,num:number=0){
this.i_uuid=uuid;
this.num=num;
this.node.getChildByName("num").getComponent(Label).string = num.toString();
@@ -26,26 +26,18 @@ export class ItemComp extends CCComp {
}
let url = "gui/items";
let pathName= Items[uuid].path;
switch(Items[uuid].lv){
case 1:
this.node.getChildByName("lv1").active = true;
break;
case 2:
this.node.getChildByName("lv2").active = true;
break;
case 3:
this.node.getChildByName("lv3").active = true;
break;
case 4:
this.node.getChildByName("lv4").active = true;
break;
}
this.node.getChildByName("lv1").active = Items[uuid].lv==1;
this.node.getChildByName("lv2").active = Items[uuid].lv==2;
this.node.getChildByName("lv3").active = Items[uuid].lv==3;
this.node.getChildByName("lv4").active = Items[uuid].lv==4;
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
}
show_info(){
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.i_uuid,type:0});
}

View File

@@ -8,6 +8,7 @@ import { SkillSet } from "../common/config/SkillSet";
import { HeroInfo, HeroSet } from "../common/config/heroSet";
import { Hero } from "../hero/Hero";
import { HChipComp } from "../hero/HChipComp";
import { ItemComp } from "./ItemComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -23,31 +24,9 @@ export class ItemInfoComp extends CCComp {
this.node.getChildByName("item").active = true;
this.node.getChildByName("name").getComponent(Label).string=Items[args.uuid].name
this.node.getChildByName("info").getComponent(Label).string=Items[args.uuid].info
let url = "gui/items";
let pathName= Items[args.uuid].path;
this.node.getChildByName("item").getChildByName("lv1").active = false;
this.node.getChildByName("item").getChildByName("lv2").active = false;
this.node.getChildByName("item").getChildByName("lv3").active = false;
this.node.getChildByName("item").getChildByName("lv4").active = false;
switch(Items[args.uuid].lv){
case 1:
this.node.getChildByName("item").getChildByName("lv1").active = true;
break;
case 2:
this.node.getChildByName("item").getChildByName("lv2").active = true;
break;
case 3:
this.node.getChildByName("item").getChildByName("lv3").active = true;
break;
case 4:
this.node.getChildByName("item").getChildByName("lv4").active = true;
break;
}
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("item").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
let itemcom = this.node.getChildByName("item").getComponent(ItemComp);
itemcom.update_data(args.uuid,args.num);
}
if(args.type==1){ //技能碎片
this.node.getChildByName("skill").active = true;
@@ -59,13 +38,12 @@ export class ItemInfoComp extends CCComp {
// console.log("update_data",atlas,sprite)
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[args.uuid].path);
});
}
if(args.type==2){ //英雄碎片
this.node.getChildByName("hero").active = true;
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[args.uuid].name+" 碎片"
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于英雄升阶,开宝箱获得"
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于强化英雄,怪物掉落和开宝箱抽卡获得"
let HChip=this.node.getChildByName("hero").getComponent(HChipComp);
HChip.update_data(args.uuid)
}

View File

@@ -1,4 +1,4 @@
import { _decorator, Animation, Component, Node } from 'cc';
import { _decorator, Animation, Component, Node, sp } from 'cc';
import { SkillCom } from './SkillCom';
import { SkillSet } from '../common/config/SkillSet';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';