feat(游戏数据): 添加金币字段并调整英雄属性和UI

- 在 SingletonModuleComp 中添加 gold 字段作为玩家金币数据
- 调整 HeroConf 配置:降低英雄属性上限并将购买成本设为0
- 修改 HInfoComp 中购买英雄的金币检查逻辑,使用 smc.data.gold 替代 smc.vmdata.gold
- 更新 role_controller.prefab 的UI元素位置、尺寸和精灵资源
This commit is contained in:
panw
2026-02-05 09:55:59 +08:00
parent ee9d72be5c
commit 49b4bef033
4 changed files with 61 additions and 48 deletions

View File

@@ -16765,8 +16765,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -26.017, "x": -31.708,
"y": 5.697, "y": 5.69,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -16778,8 +16778,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1, "x": 0.4,
"y": 1, "y": 0.4,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -16806,8 +16806,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 58, "width": 116,
"height": 42 "height": 120
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -16843,7 +16843,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@8801c", "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@b6975",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,
@@ -16858,7 +16858,10 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": "" "_id": ""
}, },
{ {
@@ -16901,7 +16904,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 10.834, "x": 26.388,
"y": 6.349, "y": 6.349,
"z": 0 "z": 0
}, },
@@ -17374,7 +17377,7 @@
"__id__": 1421 "__id__": 1421
} }
], ],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 1690 "__id__": 1690
@@ -19214,13 +19217,13 @@
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0, "z": 0.7071067811865475,
"w": 1 "w": 0.7071067811865476
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.4, "x": 1,
"y": 1.4, "y": 1,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -19229,7 +19232,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0 "z": 90
}, },
"_id": "" "_id": ""
}, },
@@ -19247,8 +19250,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 58, "width": 84,
"height": 42 "height": 96
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -19284,7 +19287,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@8801c", "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@9d293",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,
@@ -19299,7 +19302,10 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": "" "_id": ""
}, },
{ {
@@ -19738,13 +19744,13 @@
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0, "z": -0.7071067811865475,
"w": 1 "w": 0.7071067811865476
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.4, "x": 1,
"y": 1.4, "y": 1,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -19753,7 +19759,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0 "z": -90
}, },
"_id": "" "_id": ""
}, },
@@ -19771,8 +19777,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 58, "width": 84,
"height": 42 "height": 96
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -19808,7 +19814,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@95d3a", "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@9d293",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,
@@ -19823,7 +19829,10 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": "" "_id": ""
}, },
{ {
@@ -20336,7 +20345,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 22.017, "x": 34.342,
"y": 5, "y": 5,
"z": 0 "z": 0
}, },
@@ -20377,7 +20386,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 109, "width": 94,
"height": 54.4 "height": 54.4
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -20416,8 +20425,8 @@
"_string": "得分榜", "_string": "得分榜",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 35, "_actualFontSize": 30,
"_fontSize": 35, "_fontSize": 30,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 40,
"_overflow": 0, "_overflow": 0,
@@ -20495,7 +20504,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -56.462, "x": -50.045,
"y": 5, "y": 5,
"z": 0 "z": 0
}, },
@@ -20508,8 +20517,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 3, "x": 0.5,
"y": 3, "y": 0.5,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -20536,8 +20545,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 12, "width": 122,
"height": 11 "height": 108
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -20573,7 +20582,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@e5181", "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@260b0",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,
@@ -20588,7 +20597,10 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": "" "_id": ""
}, },
{ {

View File

@@ -52,6 +52,7 @@ export class SingletonModuleComp extends ecs.Comp {
score:0, score:0,
mission:1, mission:1,
diamond:100, //商店购买 及 双倍奖励资源 diamond:100, //商店购买 及 双倍奖励资源
gold:1000,
task:0, task:0,
noStop:false, noStop:false,
showInfo:true, showInfo:true,

View File

@@ -75,11 +75,11 @@ export enum MonStart {
} }
export enum HeroConf{ export enum HeroConf{
COST=1500, COST=0,
MAX_HP=10000, MAX_HP=500,
MAX_MP=1000, MAX_MP=100,
MAX_AP=2000, MAX_AP=200,
MAX_DEF=500, MAX_DEF=100,
} }
export const getPreAttr = (uuid:number)=>{ export const getPreAttr = (uuid:number)=>{
let hp=HeroInfo[uuid].hp/HeroConf.MAX_HP let hp=HeroInfo[uuid].hp/HeroConf.MAX_HP

View File

@@ -210,7 +210,7 @@ export class HInfoComp extends CCComp {
animComponent.play("idle"); animComponent.play("idle");
} }
} else { } else {
mLogger.log(this.debugMode, 'HInfoComp', `[HInfoComp]: Failed to load animation for hero ${uuid}`, err); mLogger.log(this.debugMode, 'HInfoComp', ` Failed to load animation for hero ${uuid}`, err);
} }
}); });
@@ -294,8 +294,8 @@ export class HInfoComp extends CCComp {
this.node.getChildByName("ranks").active=false this.node.getChildByName("ranks").active=false
} }
buy_hero(){ buy_hero(){
mLogger.log(this.debugMode, 'HInfoComp', "[HInfoComp]:buy_hero",this.h_uuid) mLogger.log(this.debugMode, 'HInfoComp', "buy_hero",this.h_uuid)
if(smc.vmdata.gold < HeroConf.COST) { if(smc.data.gold < HeroConf.COST) {
oops.gui.toast("金币不足") oops.gui.toast("金币不足")
return return
} }
@@ -305,7 +305,7 @@ export class HInfoComp extends CCComp {
this.close_buy() this.close_buy()
} }
start_mission() { start_mission() {
mLogger.log(this.debugMode, 'HInfoComp', "[HInfoComp]:start_mission") mLogger.log(this.debugMode, 'HInfoComp', "start_mission")
oops.message.dispatchEvent(GameEvent.MissionStart, {}) oops.message.dispatchEvent(GameEvent.MissionStart, {})
this.node.active=false; this.node.active=false;
} }