英雄 技能 碎片重做, 商品页完善

This commit is contained in:
2024-12-18 10:59:20 +08:00
parent 62975dc78b
commit e7f5b44b1e
10 changed files with 17391 additions and 9907 deletions

View File

@@ -54,8 +54,8 @@ export class SingletonModuleComp extends ecs.Comp {
goods:any={
free: [ {uuid:9001,num:100000}, {uuid:1001,num:10}, {uuid:1002,num:10}, {uuid:1007,num:10},],
goods1:[ {uuid:1001,num:100}, {uuid:9002,num:1} ],
goods2:[ {uuid:1002,num:100}, {uuid:9002,num:1} ],
goods3:[ {uuid:1007,num:100}, {uuid:9002,num:1} ],
herochips:[ {uuid:9001,num:2}, {uuid:9002,num:1} ],
skillchips:[ {uuid:1001,num:100}, {uuid:1002,num:1} ],
goods4:[ {uuid:9001,num:100}, {uuid:9002,num:1} ],
};
items:any={
@@ -119,8 +119,8 @@ export class SingletonModuleComp extends ecs.Comp {
free:{ cost:0,num:3,buy:3,},
goods1:{ cost:2000,num:3,buy:3,},
goods2:{ cost:3000,num:4,buy:3,},
goods3:{ cost:4000,num:5,buy:3,},
herochips:{ cost:3000,num:4,buy:3,},
skillchips:{ cost:4000,num:5,buy:3,},
};
vmAdd() {

View File

@@ -17,6 +17,14 @@ export class SChipComp extends Component {
}
update_data(uuid:number,num:number=0){
if(num > 0){
this.node.getChildByName("num").getComponent(Label).string = num.toString();
}else{
this.node.getChildByName("num").getComponent(Label).string = "";
}
if(uuid == 0){ return;}
var icon_path = "game/skills/skill_icon"
// console.log("update_data",SkillSet[uuid].path)
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
@@ -24,11 +32,7 @@ export class SChipComp extends Component {
// console.log("update_data",atlas,sprite)
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
});
if(num > 0){
this.node.getChildByName("num").getComponent(Label).string = num.toString();
}else{
this.node.getChildByName("num").getComponent(Label).string = "";
}
}
}

View File

@@ -1,4 +1,4 @@
import { _decorator } from "cc";
import { _decorator, instantiate, Prefab, UITransform } 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";
@@ -6,6 +6,9 @@ import { UIID } from "../common/config/GameUIConfig";
import { Items } from "../common/config/Items";
import { Item } from "./Item";
import { smc } from "../common/SingletonModuleComp";
import { RewardComp } from "./RewardComp";
import { SChipComp } from "../hero/SChipComp";
import { HChipComp } from "../hero/HChipComp";
const { ccclass, property } = _decorator;
@@ -18,11 +21,14 @@ export class ShopHomeComp extends CCComp {
this.get_items();
}
get_items(){
let free = this.node.getChildByName("goods_list").getChildByName("free").getChildByName("items");
let goods1 = this.node.getChildByName("goods_list").getChildByName("goods1").getChildByName("items");
let goods2 = this.node.getChildByName("goods_list").getChildByName("goods2").getChildByName("items");
let goods3 = this.node.getChildByName("goods_list").getChildByName("goods3").getChildByName("items");
let goods = this.node.getChildByName("goods").getChildByName("view").getChildByName("content")
goods.getComponent(UITransform).height=5*200
console.log("smc.goods",smc.goods)
let free = goods.getChildByName("free").getChildByName("items");
let goods1 = goods.getChildByName("goods1").getChildByName("items");
let herochips = goods.getChildByName("herochips").getChildByName("items");
let skillchips = goods.getChildByName("skillchips").getChildByName("items");
for (let x = 0; x < smc.goods.free.length; x++) {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.free[x].uuid,smc.goods.free[x].num,free)
@@ -31,14 +37,22 @@ export class ShopHomeComp extends CCComp {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.goods1[x].uuid,smc.goods.goods1[x].num,goods1)
}
for (let x = 0; x < smc.goods.goods2.length; x++) {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.goods2[x].uuid,smc.goods.goods2[x].num,goods2)
for (let x = 0; x < smc.goods.herochips.length; x++) {
let path = "game/gui/hchip";
let prefab: Prefab = oops.res.get(path, Prefab)!;
let node = instantiate(prefab);
node.parent=herochips
let hc= node.getComponent(HChipComp)
hc.update_data(smc.goods.herochips[x].uuid,smc.goods.herochips[x].num)
}
for (let x = 0; x < smc.goods.goods3.length; x++) {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.goods3[x].uuid,smc.goods.goods3[x].num,goods3)
for (let x = 0; x < smc.goods.skillchips.length; x++) {
let path = "game/gui/schip";
let prefab: Prefab = oops.res.get(path, Prefab)!;
let node = instantiate(prefab);
node.parent=skillchips
let sc= node.getComponent(SChipComp)
sc.update_data(smc.goods.skillchips[x].uuid,smc.goods.skillchips[x].num)
}
// for (let x = 0; x < smc.goods.goods4.length; x++) {
// let item=ecs.getEntity<Item>(Item)

View File

@@ -21,7 +21,7 @@ export class SkillHomeComp extends CCComp {
let ms_num:number =MSklist.length
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
let height=ms_num*135
parent.getComponent(UITransform).width=height
parent.getComponent(UITransform).height=height
for (let i = 0; i < ms_num; i++) {
let msc =ecs.getEntity<MSCard>(MSCard)
msc.load(MSklist[i],parent,1)