错误版本

This commit is contained in:
panw
2025-08-14 15:47:47 +08:00
parent 3b4ce5b33e
commit 96ae0481d1
16 changed files with 17974 additions and 15860 deletions

View File

@@ -1,9 +1,11 @@
import { _decorator, Color, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
import { _decorator, Animation, AnimationClip, Color, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
import { HeroInfo } from '../common/config/heroSet';
import { oops } from '../../../../extensions/oops-plugin-framework/assets/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
import { Items } from '../common/config/Items';
import { ColorSet } from '../common/config/BoxSet';
import { ColorSet, getColor } from '../common/config/BoxSet';
import { smc } from '../common/SingletonModuleComp';
import { GameEvent } from '../common/config/GameEvent';
const { ccclass, property } = _decorator;
@ccclass('HChipComp')
@@ -12,32 +14,38 @@ export class HChipComp extends Component {
num:number=0
lv:number=0
start() {
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
}
update(deltaTime: number) {
}
show_info(){
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:2});
// oops.gui.open(UIID.ItemInfo, {uuid:this.h_uuid,type:2});
}
update_data(uuid:number,num:number=0){
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);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
});
if(num > 1){
this.node.getChildByName("num").getComponent(Label).string = num.toString();
}else{
this.node.getChildByName("num").getComponent(Label).string = "";
update_hero(e:string,data:any){
if(this.h_uuid==data.uuid){
this.update_data(data.uuid)
}
this.node.getChildByName("g1").active=HeroInfo[uuid].quality==1
this.node.getChildByName("g2").active=HeroInfo[uuid].quality==2
this.node.getChildByName("g3").active=HeroInfo[uuid].quality==3
}
update_data(uuid:number){
this.h_uuid=uuid
let hero_data = HeroInfo[uuid]
let hero= this.node.getChildByName("hero")
let anm_path=hero_data.path
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
hero.getComponent(Animation).addClip(clip);
hero.getComponent(Animation).play("idle");
});
this.node.getChildByName("name").getComponent(Label).string=hero_data.name
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[uuid].lv.toString()
this.node.getChildByName("slv").getChildByName("lv1").active=smc.heros[uuid].slv>=1
this.node.getChildByName("slv").getChildByName("lv2").active=smc.heros[uuid].slv>=2
this.node.getChildByName("slv").getChildByName("lv3").active=smc.heros[uuid].slv>=3
this.node.getChildByName("slv").getChildByName("lv4").active=smc.heros[uuid].slv>=4
this.node.getChildByName("slv").getChildByName("lv5").active=smc.heros[uuid].slv>=5
this.node.getChildByName("bg").getComponent(Sprite).color=Color[getColor(hero_data.quality)[0]]
this.node.getChildByName("bgg").getComponent(Sprite).color=Color[getColor(hero_data.quality)[1]]
}
}