开箱 重做完成, item 信息更新修改

This commit is contained in:
2024-12-20 14:59:38 +08:00
parent 330f8da3da
commit e34eb5452b
6 changed files with 406 additions and 417 deletions

View File

@@ -1,4 +1,4 @@
import { _decorator, instantiate, Prefab ,Node, Label, Sprite, resources, SpriteAtlas} from "cc";
import { _decorator, instantiate, Prefab ,Node, Label, Sprite, resources, SpriteAtlas, v3} 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
@@ -9,6 +9,7 @@ import { HChipComp } from "../hero/HChipComp";
import { BoxDrop } from "../common/config/RewardSet";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { SChipComp } from "../hero/SChipComp";
import { ItemComp } from "./ItemComp";
const { ccclass, property } = _decorator;
@@ -145,11 +146,13 @@ export class LuckHomeCompComp extends CCComp {
let path = "game/gui/hchip";
let prefab: Prefab = oops.res.get(path, Prefab)!;
let node = instantiate(prefab);
node.setScale(2,2)
let hc= node.getComponent(HChipComp)
hc.update_data(uuid,num)
node.parent = this.node.getChildByName("bbox");
this.scheduleOnce(()=>{
node.parent = this.node.getChildByName("items");
node.setScale(1,1)
}, 0.5)
this.scheduleOnce(()=>{
node.destroy();
@@ -160,34 +163,13 @@ export class LuckHomeCompComp extends CCComp {
var path = "game/gui/item";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.getChildByName("num").getComponent(Label).string = num.toString();
if(num==0){
node.getChildByName("num").getComponent(Label).string ="";
}
let url = "gui/items";
let pathName= Items[uuid].path;
switch(Items[uuid].lv){
case 1:
node.getChildByName("lv1").active = true;
break;
case 2:
node.getChildByName("lv2").active = true;
break;
case 3:
node.getChildByName("lv3").active = true;
break;
case 4:
node.getChildByName("lv4").active = true;
break;
}
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
node.setScale(2,2)
let ic= node.getComponent(ItemComp)
ic.update_data(uuid,num)
node.parent = this.node.getChildByName("bbox");
this.scheduleOnce(()=>{
node.parent = this.node.getChildByName("items");
node.setScale(1,1)
}, 0.5)
this.scheduleOnce(()=>{
node.destroy();
@@ -197,11 +179,13 @@ export class LuckHomeCompComp extends CCComp {
let path = "game/gui/schip";
let prefab: Prefab = oops.res.get(path, Prefab)!;
let node = instantiate(prefab);
node.setScale(2,2)
let sc= node.getComponent(SChipComp)
sc.update_data(uuid,num)
node.parent = this.node.getChildByName("bbox");
this.scheduleOnce(()=>{
node.parent = this.node.getChildByName("items");
node.setScale(1,1)
}, 0.5)
this.scheduleOnce(()=>{
node.destroy();
@@ -213,7 +197,7 @@ export class LuckHomeCompComp extends CCComp {
var prefab: Prefab = oops.res.get(path, Prefab)!;
let box = instantiate(prefab);
box.parent = parent;
// parent.getChildByName("light").active = true;
parent.getChildByName("light").active = true;
this.scheduleOnce(()=>{
parent.getChildByName("light").active = false;
}, 0.5)