From 59f965dc1c384437e85a0a0c496ff4efb6918178 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sun, 8 Dec 2024 11:18:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E5=92=8C=E5=8D=A1=E7=89=87?= =?UTF-8?q?=20=E8=81=94=E5=8A=A8=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/game/gui/hero_card.prefab | 1210 ++++++++++++++++---- assets/script/game/hero/HeroCard.ts | 15 +- assets/script/game/hero/HeroCardComp.ts | 23 +- assets/script/game/map/HeroHomeComp.ts | 5 +- 4 files changed, 999 insertions(+), 254 deletions(-) diff --git a/assets/resources/game/gui/hero_card.prefab b/assets/resources/game/gui/hero_card.prefab index 2f5564d0..96135b35 100644 --- a/assets/resources/game/gui/hero_card.prefab +++ b/assets/resources/game/gui/hero_card.prefab @@ -37,26 +37,26 @@ "__id__": 40 }, { - "__id__": 46 + "__id__": 76 } ], "_active": true, "_components": [ { - "__id__": 80 + "__id__": 112 }, { - "__id__": 82 + "__id__": 114 }, { - "__id__": 84 + "__id__": 116 }, { - "__id__": 86 + "__id__": 118 } ], "_prefab": { - "__id__": 89 + "__id__": 121 }, "_lpos": { "__type__": "cc.Vec3", @@ -663,7 +663,7 @@ }, { "__type__": "cc.Node", - "_name": "lv_icon", + "_name": "lv", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -684,8 +684,8 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -45.98, - "y": 61.153, + "x": 19.718, + "y": 66.227, "z": 0 }, "_lrot": { @@ -725,8 +725,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 89, - "height": 89 + "width": 200, + "height": 54.4 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -737,10 +737,10 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "7aA4ZvlQpNear6ycFqd468" + "fileId": "5cSQlKpO9IZ7kewEfJxXl3" }, { - "__type__": "cc.Sprite", + "__type__": "cc.Label", "_name": "", "_objFlags": 0, "__editorExtras__": {}, @@ -761,156 +761,20 @@ "b": 255, "a": 255 }, - "_spriteFrame": { - "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@008c0", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 0, - "_fillType": 0, - "_sizeMode": 1, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "b7uI2M3YdGj6VIy7UY4akz" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "e8i10bRRRABphjmj2v+NEC", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.Node", - "_name": "lv", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 1 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 35 - }, - { - "__id__": 37 - } - ], - "_prefab": { - "__id__": 39 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": -45.97999999999999, - "y": 61.15300000000002, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 0.4, - "y": 0.4, - "z": 1 - }, - "_mobility": 0, - "_layer": 33554432, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 34 - }, - "_enabled": true, - "__prefab": { - "__id__": 36 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 80, - "height": 54.4 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "5cSQlKpO9IZ7kewEfJxXl3" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 34 - }, - "_enabled": true, - "__prefab": { - "__id__": 38 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, "_string": "111", - "_horizontalAlign": 1, + "_horizontalAlign": 2, "_verticalAlign": 1, - "_actualFontSize": 40, + "_actualFontSize": 41, "_fontSize": 40, "_fontFamily": "Arial", "_lineHeight": 40, - "_overflow": 1, + "_overflow": 2, "_enableWrapText": true, "_font": null, "_isSystemFontUsed": true, "_spacingX": 0, "_isItalic": false, - "_isBold": false, + "_isBold": true, "_isUnderline": false, "_underlineHeight": 2, "_cacheMode": 0, @@ -968,14 +832,14 @@ "_active": true, "_components": [ { - "__id__": 41 + "__id__": 35 }, { - "__id__": 43 + "__id__": 37 } ], "_prefab": { - "__id__": 45 + "__id__": 39 }, "_lpos": { "__type__": "cc.Vec3", @@ -1012,11 +876,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 40 + "__id__": 34 }, "_enabled": true, "__prefab": { - "__id__": 42 + "__id__": 36 }, "_contentSize": { "__type__": "cc.Size", @@ -1040,11 +904,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 40 + "__id__": 34 }, "_enabled": true, "__prefab": { - "__id__": 44 + "__id__": 38 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1117,13 +981,16 @@ }, { "__type__": "cc.Node", - "_name": "slv", + "_name": "slv-001", "_objFlags": 0, "__editorExtras__": {}, "_parent": { "__id__": 1 }, "_children": [ + { + "__id__": 41 + }, { "__id__": 47 }, @@ -1135,24 +1002,24 @@ }, { "__id__": 65 - }, - { - "__id__": 71 } ], "_active": true, "_components": [ { - "__id__": 77 + "__id__": 71 + }, + { + "__id__": 73 } ], "_prefab": { - "__id__": 79 + "__id__": 75 }, "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -29.78, + "y": -39.084, "z": 0 }, "_lrot": { @@ -1184,10 +1051,146 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 46 + "__id__": 40 }, "_children": [], - "_active": false, + "_active": true, + "_components": [ + { + "__id__": 42 + }, + { + "__id__": 44 + } + ], + "_prefab": { + "__id__": 46 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -50, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 41 + }, + "_enabled": true, + "__prefab": { + "__id__": 43 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "12CFsB/mpF54KmuN75/2Kr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 41 + }, + "_enabled": true, + "__prefab": { + "__id__": 45 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 133, + "g": 133, + "b": 133, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@b3232", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "3bOnySX0VA6LF2tKJ00D6M" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "ddyK0mABhO1pq1B+izyHUx", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "s2", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 40 + }, + "_children": [], + "_active": true, "_components": [ { "__id__": 48 @@ -1201,7 +1204,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 0, + "x": -25, "y": 0, "z": 0 }, @@ -1214,8 +1217,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.15, - "y": 0.15, + "x": 1, + "y": 1, "z": 1 }, "_mobility": 0, @@ -1242,8 +1245,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 116, - "height": 112 + "width": 20, + "height": 20 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1254,7 +1257,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "a4abof1DhP15ecNu9eicKy" + "fileId": "6cdoltg1pOuKRIaAzungdz" }, { "__type__": "cc.Sprite", @@ -1271,6 +1274,695 @@ "_customMaterial": null, "_srcBlendFactor": 2, "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 133, + "g": 133, + "b": 133, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@b3232", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "53Hopx24RA6rXvdYnF5M7c" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "38Q0K1GetOxYxCIDhMhWlY", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "s3", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 40 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 54 + }, + { + "__id__": 56 + } + ], + "_prefab": { + "__id__": 58 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 53 + }, + "_enabled": true, + "__prefab": { + "__id__": 55 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "f30IDgxhBCHoe6mH0uIVzU" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 53 + }, + "_enabled": true, + "__prefab": { + "__id__": 57 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 133, + "g": 133, + "b": 133, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@b3232", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "3f4NwNrvVP5aEJz7ERmYR1" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "e26/HW1alD2rXjwF+qMXcq", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "s4", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 40 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 60 + }, + { + "__id__": 62 + } + ], + "_prefab": { + "__id__": 64 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 25, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 59 + }, + "_enabled": true, + "__prefab": { + "__id__": 61 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "f01kud6w5JC4uLkPgbNIob" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 59 + }, + "_enabled": true, + "__prefab": { + "__id__": 63 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 133, + "g": 133, + "b": 133, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@b3232", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "8208e+fRBGo5g42pCMMQFn" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "2fCMZrcTJCuak5IXFF620a", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "s5", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 40 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 66 + }, + { + "__id__": 68 + } + ], + "_prefab": { + "__id__": 70 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 50, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 65 + }, + "_enabled": true, + "__prefab": { + "__id__": 67 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "87FnSP+8RCzISXYGEZcJ9u" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 65 + }, + "_enabled": true, + "__prefab": { + "__id__": 69 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 133, + "g": 133, + "b": 133, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@b3232", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "d2ckgZeNNPVL1Krh027L2r" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "0fTuUFQmFNRpHJMvwMXMQS", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 40 + }, + "_enabled": true, + "__prefab": { + "__id__": 72 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 120, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4es2cmwn9CjpOVOfpMfRlp" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 40 + }, + "_enabled": true, + "__prefab": { + "__id__": 74 + }, + "_resizeMode": 2, + "_layoutType": 3, + "_cellSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_startAxis": 0, + "_paddingLeft": 0, + "_paddingRight": 0, + "_paddingTop": 0, + "_paddingBottom": 0, + "_spacingX": 5, + "_spacingY": 0, + "_verticalDirection": 1, + "_horizontalDirection": 0, + "_constraint": 0, + "_constraintNum": 2, + "_affectedByScale": false, + "_isAlign": false, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "522gRZCq1B/6qbrsuSrhtO" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "8aJ8q/ShhBW7n2nUC1UE5H", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "slv", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 77 + }, + { + "__id__": 83 + }, + { + "__id__": 89 + }, + { + "__id__": 95 + }, + { + "__id__": 101 + } + ], + "_active": true, + "_components": [ + { + "__id__": 107 + }, + { + "__id__": 109 + } + ], + "_prefab": { + "__id__": 111 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -39.084, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "s1", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 76 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 78 + }, + { + "__id__": 80 + } + ], + "_prefab": { + "__id__": 82 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -50, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 77 + }, + "_enabled": true, + "__prefab": { + "__id__": 79 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a4abof1DhP15ecNu9eicKy" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 77 + }, + "_enabled": true, + "__prefab": { + "__id__": 81 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, "_color": { "__type__": "cc.Color", "r": 255, @@ -1284,7 +1976,7 @@ }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -1320,24 +2012,24 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 46 + "__id__": 76 }, "_children": [], "_active": false, "_components": [ { - "__id__": 54 + "__id__": 84 }, { - "__id__": 56 + "__id__": 86 } ], "_prefab": { - "__id__": 58 + "__id__": 88 }, "_lpos": { "__type__": "cc.Vec3", - "x": 20, + "x": -25, "y": 0, "z": 0 }, @@ -1350,8 +2042,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.15, - "y": 0.15, + "x": 1, + "y": 1, "z": 1 }, "_mobility": 0, @@ -1370,16 +2062,16 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 53 + "__id__": 83 }, "_enabled": true, "__prefab": { - "__id__": 55 + "__id__": 85 }, "_contentSize": { "__type__": "cc.Size", - "width": 116, - "height": 112 + "width": 20, + "height": 20 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1398,11 +2090,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 53 + "__id__": 83 }, "_enabled": true, "__prefab": { - "__id__": 57 + "__id__": 87 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1420,7 +2112,7 @@ }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -1456,24 +2148,24 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 46 + "__id__": 76 }, "_children": [], "_active": false, "_components": [ { - "__id__": 60 + "__id__": 90 }, { - "__id__": 62 + "__id__": 92 } ], "_prefab": { - "__id__": 64 + "__id__": 94 }, "_lpos": { "__type__": "cc.Vec3", - "x": -20, + "x": 0, "y": 0, "z": 0 }, @@ -1486,8 +2178,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.15, - "y": 0.15, + "x": 1, + "y": 1, "z": 1 }, "_mobility": 0, @@ -1506,16 +2198,16 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 59 + "__id__": 89 }, "_enabled": true, "__prefab": { - "__id__": 61 + "__id__": 91 }, "_contentSize": { "__type__": "cc.Size", - "width": 116, - "height": 112 + "width": 20, + "height": 20 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1534,11 +2226,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 59 + "__id__": 89 }, "_enabled": true, "__prefab": { - "__id__": 63 + "__id__": 93 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1556,7 +2248,7 @@ }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -1592,24 +2284,24 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 46 + "__id__": 76 }, "_children": [], "_active": false, "_components": [ { - "__id__": 66 + "__id__": 96 }, { - "__id__": 68 + "__id__": 98 } ], "_prefab": { - "__id__": 70 + "__id__": 100 }, "_lpos": { "__type__": "cc.Vec3", - "x": 40, + "x": 25, "y": 0, "z": 0 }, @@ -1622,8 +2314,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.15, - "y": 0.15, + "x": 1, + "y": 1, "z": 1 }, "_mobility": 0, @@ -1642,16 +2334,16 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 65 + "__id__": 95 }, "_enabled": true, "__prefab": { - "__id__": 67 + "__id__": 97 }, "_contentSize": { "__type__": "cc.Size", - "width": 116, - "height": 112 + "width": 20, + "height": 20 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1670,11 +2362,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 65 + "__id__": 95 }, "_enabled": true, "__prefab": { - "__id__": 69 + "__id__": 99 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1692,7 +2384,7 @@ }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -1728,24 +2420,24 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 46 + "__id__": 76 }, "_children": [], "_active": false, "_components": [ { - "__id__": 72 + "__id__": 102 }, { - "__id__": 74 + "__id__": 104 } ], "_prefab": { - "__id__": 76 + "__id__": 106 }, "_lpos": { "__type__": "cc.Vec3", - "x": -40, + "x": 50, "y": 0, "z": 0 }, @@ -1758,8 +2450,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.15, - "y": 0.15, + "x": 1, + "y": 1, "z": 1 }, "_mobility": 0, @@ -1778,16 +2470,16 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 71 + "__id__": 101 }, "_enabled": true, "__prefab": { - "__id__": 73 + "__id__": 103 }, "_contentSize": { "__type__": "cc.Size", - "width": 116, - "height": 112 + "width": 20, + "height": 20 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1806,11 +2498,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 71 + "__id__": 101 }, "_enabled": true, "__prefab": { - "__id__": 75 + "__id__": 105 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1828,7 +2520,7 @@ }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -1864,15 +2556,15 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 46 + "__id__": 76 }, "_enabled": true, "__prefab": { - "__id__": 78 + "__id__": 108 }, "_contentSize": { "__type__": "cc.Size", - "width": 100, + "width": 120, "height": 20 }, "_anchorPoint": { @@ -1886,6 +2578,44 @@ "__type__": "cc.CompPrefabInfo", "fileId": "d7PBzw7iNPopDV8n4oBAZi" }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 76 + }, + "_enabled": true, + "__prefab": { + "__id__": 110 + }, + "_resizeMode": 2, + "_layoutType": 3, + "_cellSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_startAxis": 0, + "_paddingLeft": 0, + "_paddingRight": 0, + "_paddingTop": 0, + "_paddingBottom": 0, + "_spacingX": 5, + "_spacingY": 0, + "_verticalDirection": 1, + "_horizontalDirection": 0, + "_constraint": 0, + "_constraintNum": 2, + "_affectedByScale": false, + "_isAlign": false, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "3aIvEwoTVOpKs8W2GlO7SA" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -1909,7 +2639,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 81 + "__id__": 113 }, "_contentSize": { "__type__": "cc.Size", @@ -1937,7 +2667,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 83 + "__id__": 115 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1979,7 +2709,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 85 + "__id__": 117 }, "_id": "" }, @@ -1997,11 +2727,11 @@ }, "_enabled": true, "__prefab": { - "__id__": 87 + "__id__": 119 }, "clickEvents": [ { - "__id__": 88 + "__id__": 120 } ], "_interactable": true, diff --git a/assets/script/game/hero/HeroCard.ts b/assets/script/game/hero/HeroCard.ts index 484863fa..639eab6e 100644 --- a/assets/script/game/hero/HeroCard.ts +++ b/assets/script/game/hero/HeroCard.ts @@ -18,20 +18,21 @@ export class HeroCard extends ecs.Entity { var icon_path = "game/heros/herois" var prefab: Prefab = oops.res.get(path, Prefab)!; var node = instantiate(prefab); + let slv = node.getChildByName("slv"); node.parent = parent; node.getChildByName("name").getComponent(Label).string = HeroInfo[uuid].name resources.load(icon_path, SpriteAtlas, (err: any, atlas) => { const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite); sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path); }); - node.getChildByName("lv").getComponent(Label).string = smc.heros[uuid].lv.toString(); - if(smc.heros[uuid].slv>=1) node.getChildByName("slv").getChildByName("s1").active=true; - if(smc.heros[uuid].slv>=2) node.getChildByName("slv").getChildByName("s2").active=true; - if(smc.heros[uuid].slv>=3) node.getChildByName("slv").getChildByName("s3").active=true; - if(smc.heros[uuid].slv>=4) node.getChildByName("slv").getChildByName("s4").active=true; - if(smc.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true; + node.getChildByName("lv").getComponent(Label).string = smc.heros[uuid].lv.toString()+"级"; + if(smc.heros[uuid].slv>=1) {slv.getChildByName("s1").active=true} else {slv.getChildByName("s1").active=false}; + if(smc.heros[uuid].slv>=2) {slv.getChildByName("s2").active=true} else {slv.getChildByName("s2").active=false}; + if(smc.heros[uuid].slv>=3) {slv.getChildByName("s3").active=true} else {slv.getChildByName("s3").active=false}; + if(smc.heros[uuid].slv>=4) {slv.getChildByName("s4").active=true} else {slv.getChildByName("s4").active=false}; + if(smc.heros[uuid].slv>=5) {slv.getChildByName("s5").active=true} else {slv.getChildByName("s5").active=false}; let hcc = node.getComponent(HeroCardComp)!; - hcc.hcc_uuid = uuid; + hcc.h_uuid = uuid; this.add(hcc); } /** 模块资源释放 */ diff --git a/assets/script/game/hero/HeroCardComp.ts b/assets/script/game/hero/HeroCardComp.ts index 33696c02..8972f6c8 100644 --- a/assets/script/game/hero/HeroCardComp.ts +++ b/assets/script/game/hero/HeroCardComp.ts @@ -1,8 +1,9 @@ -import { _decorator } from "cc"; +import { _decorator, Label } 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 { HeroHomeComp } from "../map/HeroHomeComp"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; +import { smc } from "../common/SingletonModuleComp"; const { ccclass, property } = _decorator; @@ -10,11 +11,11 @@ const { ccclass, property } = _decorator; @ccclass('HeroCardComp') @ecs.register('HeroCardComp', false) export class HeroCardComp extends CCComp { - hcc_home: HeroHomeComp = null!; - hcc_uuid: number = 0; + h_uuid: number = 0; onLoad() { oops.message.on("hero_card_show_info", this.check_show, this); + oops.message.on("hero_card_update_info", this.update_data, this); } /** 视图层逻辑代码分离演示 */ start() { @@ -23,19 +24,29 @@ export class HeroCardComp extends CCComp { } show_info(){ - this.hcc_home.hero_show(this.hcc_uuid) - oops.message.dispatchEvent("hero_card_show_info",{uuid:this.hcc_uuid}) + this.hcc_home.hero_show(this.h_uuid) + oops.message.dispatchEvent("hero_card_show_info",{uuid:this.h_uuid}) } check_show(event: string, args: any){ // console.log("hero_card check_show",args) this.show_bg(false) - if(args.uuid==this.hcc_uuid){ + if(args.uuid==this.h_uuid){ this.show_bg(true) } } show_bg(val:boolean){ this.node.getChildByName("show").active=val } + update_data(event: string, args: any){ + if(args.uuid!=this.h_uuid) return + let slv = this.node.getChildByName("slv") + this.node.getChildByName("lv").getComponent(Label).string=smc.heros[this.h_uuid].lv.toString()+"级" + if(smc.heros[this.h_uuid].slv>=1) {slv.getChildByName("s1").active=true} else {slv.getChildByName("s1").active=false}; + if(smc.heros[this.h_uuid].slv>=2) {slv.getChildByName("s2").active=true} else {slv.getChildByName("s2").active=false}; + if(smc.heros[this.h_uuid].slv>=3) {slv.getChildByName("s3").active=true} else {slv.getChildByName("s3").active=false}; + if(smc.heros[this.h_uuid].slv>=4) {slv.getChildByName("s4").active=true} else {slv.getChildByName("s4").active=false}; + if(smc.heros[this.h_uuid].slv>=5) {slv.getChildByName("s5").active=true} else {slv.getChildByName("s5").active=false}; + } /** 全局消息逻辑处理 */ // private onHandler(event: string, args: any) { // switch (event) { diff --git a/assets/script/game/map/HeroHomeComp.ts b/assets/script/game/map/HeroHomeComp.ts index e48413ae..947bf654 100644 --- a/assets/script/game/map/HeroHomeComp.ts +++ b/assets/script/game/map/HeroHomeComp.ts @@ -111,6 +111,8 @@ export class HeroHomeComp extends CCComp { attr2.getChildByName("cep").getChildByName("val").getComponent(Label).string = this.hero.cep attr2.getChildByName("doep").getChildByName("val").getComponent(Label).string = this.hero.doep attr2.getChildByName("dep").getChildByName("val").getComponent(Label).string = this.hero.dep + + oops.message.dispatchEvent("hero_card_update_info",{uuid:this.h_uuid}) } lv_selcet(e:any,val:any){ let active = this.node.getChildByName("menu").getChildByName("active") @@ -151,7 +153,8 @@ export class HeroHomeComp extends CCComp { smc.vmdata.items[1001] -= ((LvUp[0]+this.hero.lvexp)*this.role.lv) smc.vmdata.gold -= (UpGold.LvUp*this.role.lv) this.role.lv++ - this.update_data() + this.update_data() + } slv_up(){ if(this.role.slv>=5){