英雄出战选择 +英雄相关 ui 改变

This commit is contained in:
2025-08-17 20:40:03 +08:00
parent ba61724a08
commit 1a25a566c8
20 changed files with 6674 additions and 2240 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -95,22 +95,25 @@
}, },
{ {
"__id__": 1114 "__id__": 1114
},
{
"__id__": 1131
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 1131 "__id__": 1143
}, },
{ {
"__id__": 1133 "__id__": 1145
}, },
{ {
"__id__": 1135 "__id__": 1147
} }
], ],
"_prefab": { "_prefab": {
"__id__": 1137 "__id__": 1149
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -24823,7 +24826,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "up", "_name": "upBtn",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
@@ -25759,6 +25762,273 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "luck",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 1132
}
],
"_active": true,
"_components": [
{
"__id__": 1138
},
{
"__id__": 1140
}
],
"_prefab": {
"__id__": 1142
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 309.6,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1.8,
"y": 1.8,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Icon_Lock_Gold",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1131
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1133
},
{
"__id__": 1135
}
],
"_prefab": {
"__id__": 1137
},
"_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": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1132
},
"_enabled": true,
"__prefab": {
"__id__": 1134
},
"_contentSize": {
"__type__": "cc.Size",
"width": 58,
"height": 77
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fdOYYwH6tMdKQliN3YLEjj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1132
},
"_enabled": true,
"__prefab": {
"__id__": 1136
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "49c583b3-d566-4c79-9e4c-bd0ca4a4b717@0730b",
"__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": "caghP5hWxAhZjrlUD48xO5"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "1cusyrHKBP/b+UZKvQ3oX6",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1131
},
"_enabled": true,
"__prefab": {
"__id__": 1139
},
"_contentSize": {
"__type__": "cc.Size",
"width": 256,
"height": 256
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "ebBEwJOIJEm7MaizjTyZvV"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1131
},
"_enabled": true,
"__prefab": {
"__id__": 1141
},
"_alignFlags": 17,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 100,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6fe5bFeM1EvJRZx7Y4CXr5"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "2dFHBtfSxJ7ZTbougNhLg5",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -25769,7 +26039,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 1132 "__id__": 1144
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -25797,7 +26067,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 1134 "__id__": 1146
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -25833,7 +26103,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 1136 "__id__": 1148
}, },
"_id": "" "_id": ""
}, },

View File

@@ -0,0 +1,492 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "in_fight",
"_objFlags": 0,
"__editorExtras__": {
"embeddedPlayerGroups": []
},
"_native": "",
"sample": 6,
"speed": 1,
"wrapMode": 2,
"enableTrsBlending": false,
"_duration": 1,
"_hash": 500763545,
"_tracks": [
{
"__id__": 1
},
{
"__id__": 12
}
],
"_exoticAnimation": null,
"_events": [],
"_embeddedPlayers": [],
"_additiveSettings": {
"__id__": 22
},
"_auxiliaryCurveEntries": []
},
{
"__type__": "cc.animation.VectorTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 2
},
"proxy": null
},
"_channels": [
{
"__id__": 4
},
{
"__id__": 6
},
{
"__id__": 8
},
{
"__id__": 10
}
],
"_nComponents": 3
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
{
"__id__": 3
},
"scale"
]
},
{
"__type__": "cc.animation.HierarchyPath",
"path": "ItemFrame_Square_02_White_Glow"
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 5
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.5,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.4,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.5,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.4,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 7
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.5,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.4,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.5,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0.4,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 9
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.5,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 11
}
},
{
"__type__": "cc.RealCurve",
"_times": [],
"_values": [],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.VectorTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 13
},
"proxy": null
},
"_channels": [
{
"__id__": 14
},
{
"__id__": 16
},
{
"__id__": 18
},
{
"__id__": 20
}
],
"_nComponents": 3
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
"scale"
]
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 15
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.5,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1.1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 17
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.5,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1.1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 19
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.5,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 21
}
},
{
"__type__": "cc.RealCurve",
"_times": [],
"_values": [],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.AnimationClipAdditiveSettings",
"enabled": false,
"refClip": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "2.0.3",
"importer": "animation-clip",
"imported": true,
"uuid": "e2d24f24-132a-497d-a120-1aae1c7f2619",
"files": [
".cconb"
],
"subMetas": {},
"userData": {
"name": "in_fight"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "09191ae0-5baf-4746-960f-c233c33a5e18",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "hero_select"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1819,10 +1819,10 @@
"height": 66, "height": 66,
"rawWidth": 64, "rawWidth": 64,
"rawHeight": 66, "rawHeight": 66,
"borderTop": 0, "borderTop": 32,
"borderBottom": 0, "borderBottom": 34,
"borderLeft": 0, "borderLeft": 32,
"borderRight": 0, "borderRight": 32,
"packable": true, "packable": true,
"pixelsToUnit": 100, "pixelsToUnit": 100,
"pivotX": 0.5, "pivotX": 0.5,

View File

@@ -1911,10 +1911,10 @@
"height": 110, "height": 110,
"rawWidth": 160, "rawWidth": 160,
"rawHeight": 110, "rawHeight": 110,
"borderTop": 0, "borderTop": 55,
"borderBottom": 0, "borderBottom": 55,
"borderLeft": 0, "borderLeft": 80,
"borderRight": 0, "borderRight": 80,
"packable": true, "packable": true,
"pixelsToUnit": 100, "pixelsToUnit": 100,
"pivotX": 0.5, "pivotX": 0.5,

View File

@@ -58,3 +58,7 @@ export enum FacSet {
HERO=0, HERO=0,
MON=1, MON=1,
} }
export enum HeroConSet{
INFO=0,
SELECT=1,
}

View File

@@ -18,6 +18,7 @@ export enum UIID {
Role_Controller, Role_Controller,
HeroInfo, HeroInfo,
Victory, Victory,
HeroSelect,
// Shop_Page, // Shop_Page,
// Hero_Page, // Hero_Page,
} }
@@ -30,6 +31,7 @@ export var UIConfigData: { [key: number]: UIConfig } = {
[UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" }, [UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" },
[UIID.HeroInfo]: { layer: LayerType.UI, prefab: "gui/Hinfo" }, [UIID.HeroInfo]: { layer: LayerType.UI, prefab: "gui/Hinfo" },
[UIID.Victory]: { layer: LayerType.UI, prefab: "gui/element/victory" }, [UIID.Victory]: { layer: LayerType.UI, prefab: "gui/element/victory" },
[UIID.HeroSelect]: { layer: LayerType.UI, prefab: "gui/hero_select" },
// [UIID.Shop_Page]: { layer: LayerType.UI, prefab: "gui/shop_page" }, // [UIID.Shop_Page]: { layer: LayerType.UI, prefab: "gui/shop_page" },
// [UIID.Hero_Page]: { layer: LayerType.UI, prefab: "gui/heros_page" }, // [UIID.Hero_Page]: { layer: LayerType.UI, prefab: "gui/heros_page" },
// [UIID.Toast]: { layer: LayerType.PopUp, prefab: "common/prefab/toast" }, // [UIID.Toast]: { layer: LayerType.PopUp, prefab: "common/prefab/toast" },

View File

@@ -1,5 +1,6 @@
import { v3 } from "cc" import { v3 } from "cc"
import { FacSet } from "./BoxSet" import { FacSet } from "./BoxSet"
import { smc } from "../SingletonModuleComp"
/** /**
* kind 1:烈焰 2:寒冰 3:自然 4:暗影 5:神圣 * kind 1:烈焰 2:寒冰 3:自然 4:暗影 5:神圣
**/ **/
@@ -22,18 +23,32 @@ import { FacSet } from "./BoxSet"
* 词条解释: * 词条解释:
* 0:战士 1:远程 2:法师 * 0:战士 1:远程 2:法师
* * */ * * */
export enum HType { export enum HType {
warrior = 0, warrior = 0,
remote = 1, remote = 1,
mage = 2, mage = 2,
} }
//fac:FacSet.HERO //fac:FacSet.HERO
export const getHeroList = (quality:number=0)=>{ export const getHeroList = (quality:number=0)=>{
return Object.values(HeroInfo).filter(item=>{ const filteredHeros = Object.values(HeroInfo).filter(item=>{
const facMatch = item.fac === FacSet.HERO; const facMatch = item.fac === FacSet.HERO;
const qualityMatch = quality === 0 || item.quality === quality; const qualityMatch = quality === 0 || item.quality === quality;
return facMatch && qualityMatch; return facMatch && qualityMatch;
}).map(item=>item.uuid) });
// 分离拥有和未拥有的英雄
const ownedHeros = filteredHeros.filter(item => smc.heros[item.uuid]);
const unownedHeros = filteredHeros.filter(item => !smc.heros[item.uuid]);
// 分别按品质排序(品质高的在前)
ownedHeros.sort((a,b) => b.quality - a.quality);
unownedHeros.sort((a,b) => b.quality - a.quality);
// 合并列表:拥有的在前,未拥有的在后
return [...ownedHeros, ...unownedHeros].map(item => item.uuid);
} }
//fac:FacSet.MON //fac:FacSet.MON
export const getMonList = (quality:number=0)=>{ export const getMonList = (quality:number=0)=>{

View File

@@ -46,6 +46,7 @@ export class BuffComp extends Component {
this.top_node = this.node.getChildByName("top"); this.top_node = this.node.getChildByName("top");
let hp_y=this.node.getComponent(UITransform).height let hp_y=this.node.getComponent(UITransform).height
this.top_node.setPosition(0,hp_y,0) this.top_node.setPosition(0,hp_y,0)
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false) // this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
// this.vmdata_update() // this.vmdata_update()

View File

@@ -145,6 +145,7 @@ export class HeroViewComp extends CCComp {
} }
/* 显示角色血量 */ /* 显示角色血量 */
this.node.getChildByName("top").getChildByName("hp").active = true; this.node.getChildByName("top").getChildByName("hp").active = true;
this.BUFFCOMP.show_shield(this.shield,this.shield_max)
} }
update(dt: number){ update(dt: number){

View File

@@ -3,11 +3,17 @@ import { HeroInfo, HQuality, HType } from '../common/config/heroSet';
import { smc } from '../common/SingletonModuleComp'; import { smc } from '../common/SingletonModuleComp';
import { oops } from 'db://oops-framework/core/Oops'; import { oops } from 'db://oops-framework/core/Oops';
import { UIID } from '../common/config/GameUIConfig'; import { UIID } from '../common/config/GameUIConfig';
import { GameSet, HeroConSet } from '../common/config/BoxSet';
import { HttpReturn } from 'db://oops-framework/libs/network/HttpRequest';
import { GameEvent } from '../common/config/GameEvent';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('HCardUICom') @ccclass('HCardUICom')
export class HCardUICom extends Component { export class HCardUICom extends Component {
h_uuid:number=0 h_uuid:number=0
type:number=0
slot:number=0
start() { start() {
console.log("[HCardUICom]:start") console.log("[HCardUICom]:start")
} }
@@ -15,9 +21,12 @@ export class HCardUICom extends Component {
update(deltaTime: number) { update(deltaTime: number) {
} }
update_data(uuid:number){ update_data(uuid:number,args:any){
console.log("[HCardUICom]:update_data",uuid) this.type=args.type
if(args.slot) this.slot=args.slot
console.log("[HCardUICom]:update_data",uuid,this.type,this.slot,args)
this.h_uuid=uuid this.h_uuid=uuid
this.node.getChildByName("in_fight").active=this.check_in_fight(uuid)
let hero_data = HeroInfo[uuid] let hero_data = HeroInfo[uuid]
let hero= this.node.getChildByName("hero") let hero= this.node.getChildByName("hero")
let anm_path=hero_data.path let anm_path=hero_data.path
@@ -26,7 +35,10 @@ export class HCardUICom extends Component {
hero.getComponent(Animation).play("idle"); hero.getComponent(Animation).play("idle");
}); });
this.node.getChildByName("name").getComponent(Label).string=hero_data.name this.node.getChildByName("name").getComponent(Label).string=hero_data.name
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[uuid].lv.toString() let lv=smc.heros[uuid]?.lv??0
this.node.getChildByName("luck").active=lv==0
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=lv > 0 ? lv.toString() : ""
this.node.getChildByName("lv").active=lv > 0
// this.node.getChildByName("slv").getChildByName("lv1").active=smc.heros[uuid].slv>=1 // 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("lv2").active=smc.heros[uuid].slv>=2
// this.node.getChildByName("slv").getChildByName("lv3").active=smc.heros[uuid].slv>=3 // this.node.getChildByName("slv").getChildByName("lv3").active=smc.heros[uuid].slv>=3
@@ -43,9 +55,37 @@ export class HCardUICom extends Component {
this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior
this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote
this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage
} }
show_info(){ do_click(){
oops.gui.open(UIID.HeroInfo,this.h_uuid) switch(this.type){
case HeroConSet.INFO:
oops.gui.open(UIID.HeroInfo,this.h_uuid)
break
case HeroConSet.SELECT:
if(oops.gui.has(UIID.HeroSelect)) {
this.check_in_slot(this.h_uuid)
smc.setFightHero(this.slot,this.h_uuid,true)
oops.message.dispatchEvent(GameEvent.UpdateHero)
oops.gui.remove(UIID.HeroSelect)
}
break
}
}
check_in_slot(uuid:number){ //如果英雄在出战位,则移除久的出战位
let heros=smc.fight_heros
for(let i=0;i<GameSet.HERO_NUM;i++){
if(heros[i]==uuid) {
smc.setFightHero(i,0,true)
}
}
}
check_in_fight(uuid:number){
let heros=smc.fight_heros
for(let i=0;i<GameSet.HERO_NUM;i++){
if(heros[i]==uuid) return true
}
return false
} }
} }

View File

@@ -1,7 +1,7 @@
import { _decorator, Animation, AnimationClip, Component, Label, Node, resources } from 'cc'; import { _decorator, Animation, AnimationClip, Component, Label, Node, resources } from 'cc';
import { oops } from 'db://oops-framework/core/Oops'; import { oops } from 'db://oops-framework/core/Oops';
import { UIID } from '../common/config/GameUIConfig'; import { UIID } from '../common/config/GameUIConfig';
import { getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType } from '../common/config/heroSet'; import { getHeroList, getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType } from '../common/config/heroSet';
import { smc } from '../common/SingletonModuleComp'; import { smc } from '../common/SingletonModuleComp';
import { GameEvent } from '../common/config/GameEvent'; import { GameEvent } from '../common/config/GameEvent';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -26,7 +26,7 @@ export class HInfoComp extends Component {
this.h_uuid=uuid this.h_uuid=uuid
let hero_data = HeroInfo[uuid] let hero_data = HeroInfo[uuid]
let hero= this.node.getChildByName("hero") let hero= this.node.getChildByName("hero")
let lv=smc.heros[uuid].lv let lv=smc.heros[uuid]?.lv??1
let anm_path=hero_data.path let anm_path=hero_data.path
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => { resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
hero.getComponent(Animation).addClip(clip); hero.getComponent(Animation).addClip(clip);
@@ -48,6 +48,12 @@ export class HInfoComp extends Component {
this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior
this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote
this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage
this.show_luck(smc.heros[uuid]?.lv??0)
}
show_luck(lv:number){
this.node.getChildByName("upBtn").active=lv > 0
this.node.getChildByName("upNeed").active=lv > 0
this.node.getChildByName("luck").active=lv == 0
} }
uplevel(){ uplevel(){
let hero_data = HeroInfo[this.h_uuid] let hero_data = HeroInfo[this.h_uuid]
@@ -64,7 +70,7 @@ export class HInfoComp extends Component {
oops.message.dispatchEvent(GameEvent.UpdateHero, {}) oops.message.dispatchEvent(GameEvent.UpdateHero, {})
} }
next_hero(){ next_hero(){
let heros=smc.getHasHeroUUID() let heros=getHeroList()
let index = heros.indexOf(this.h_uuid); let index = heros.indexOf(this.h_uuid);
index++ index++
if(index==heros.length) index=0 if(index==heros.length) index=0
@@ -72,7 +78,7 @@ export class HInfoComp extends Component {
this.update_data(nextHero) this.update_data(nextHero)
} }
prev_hero(){ prev_hero(){
let heros=smc.getHasHeroUUID() let heros=getHeroList()
let index = heros.indexOf(this.h_uuid); let index = heros.indexOf(this.h_uuid);
index-- index--
if(index==-1) index=heros.length-1 if(index==-1) index=heros.length-1

View File

@@ -1,7 +1,9 @@
import { _decorator, Component, instantiate, Node, Prefab } from 'cc'; import { _decorator, Component, instantiate, Node, Prefab, UITransform } from 'cc';
import { smc } from '../common/SingletonModuleComp'; import { smc } from '../common/SingletonModuleComp';
import { oops } from 'db://oops-framework/core/Oops'; import { oops } from 'db://oops-framework/core/Oops';
import { HCardUICom } from './HCardUICom'; import { HCardUICom } from './HCardUICom';
import { HeroConSet } from '../common/config/BoxSet';
import { getHeroList } from '../common/config/heroSet';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('HeroPageComp') @ccclass('HeroPageComp')
@@ -14,10 +16,12 @@ export class HeroPageComp extends Component {
} }
update_heros(){ update_heros(){
let heros=smc.getHasHeroUUID() let heros=getHeroList()
console.log("[HeroPageComp]:update_heros",heros) console.log("[HeroPageComp]:update_heros",heros)
let height= Math.ceil(heros.length/3)*315+30
this.node.getChildByName("main").getChildByName("view").getChildByName("heros").getComponent(UITransform).height=height
this.clear_heros() this.clear_heros()
for(let i=0;i<3;i++){ for(let i=0;i<heros.length;i++){
let hero=heros[i] let hero=heros[i]
console.log("[HeroPageComp]:hero",hero) console.log("[HeroPageComp]:hero",hero)
if(hero){ if(hero){
@@ -37,7 +41,7 @@ export class HeroPageComp extends Component {
const node = instantiate(prefab); const node = instantiate(prefab);
node.parent=parent node.parent=parent
let hcard=node.getComponent(HCardUICom)! let hcard=node.getComponent(HCardUICom)!
hcard.update_data(uuid) hcard.update_data(uuid,{type:HeroConSet.INFO})
} }
clear_heros(){ clear_heros(){
let parent=this.node.getChildByName("main").getChildByName("view").getChildByName("heros") let parent=this.node.getChildByName("main").getChildByName("view").getChildByName("heros")

View File

@@ -3,16 +3,20 @@ import { smc } from '../common/SingletonModuleComp';
import { HeroInfo } from '../common/config/heroSet'; import { HeroInfo } from '../common/config/heroSet';
import { GameEvent } from '../common/config/GameEvent'; import { GameEvent } from '../common/config/GameEvent';
import { oops } from 'db://oops-framework/core/Oops'; import { oops } from 'db://oops-framework/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
import { GameSet } from '../common/config/BoxSet';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('HeroReadyCom') @ccclass('HeroReadyCom')
export class HeroReadyCom extends Component { export class HeroReadyCom extends Component {
@property(CCInteger) @property(CCInteger)
slot: number=0; slot: number=0;
protected onLoad(): void {
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
}
start() { start() {
this.update_hero() this.update_hero()
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
} }
update(deltaTime: number) { update(deltaTime: number) {
@@ -24,6 +28,7 @@ export class HeroReadyCom extends Component {
this.no_hero() this.no_hero()
return return
} }
this.node.getChildByName("icon").active=true
this.node.getChildByName("add").active=false this.node.getChildByName("add").active=false
let hero_data = HeroInfo[hero] let hero_data = HeroInfo[hero]
console.log("[HeroReadyCom]hero_data",smc.fight_heros,hero,smc.fight_heros[this.slot],this.slot,hero_data) console.log("[HeroReadyCom]hero_data",smc.fight_heros,hero,smc.fight_heros[this.slot],this.slot,hero_data)
@@ -32,6 +37,7 @@ export class HeroReadyCom extends Component {
this.node.getChildByName("icon").getComponent(Animation).addClip(clip); this.node.getChildByName("icon").getComponent(Animation).addClip(clip);
this.node.getChildByName("icon").getComponent(Animation).play("idle"); this.node.getChildByName("icon").getComponent(Animation).play("idle");
}); });
this.node.getChildByName("lv").active=true
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[hero].lv.toString() this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[hero].lv.toString()
// console.log("[HeroReadyCom]clip",this.node.getChildByName("icon").getComponent(Animation)) // console.log("[HeroReadyCom]clip",this.node.getChildByName("icon").getComponent(Animation))
@@ -39,7 +45,13 @@ export class HeroReadyCom extends Component {
no_hero(){ no_hero(){
this.node.getChildByName("lv").active=false this.node.getChildByName("lv").active=false
this.node.getChildByName("add").active=true this.node.getChildByName("add").active=true
this.node.getChildByName("icon").active=false
} }
select_hero(){
if(oops.gui.has(UIID.HeroSelect)) return
oops.gui.open(UIID.HeroSelect,{slot:this.slot})
}
} }

View File

@@ -0,0 +1,67 @@
import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
import { oops } from 'db://oops-framework/core/Oops';
import { HCardUICom } from './HCardUICom';
import { smc } from '../common/SingletonModuleComp';
import { HeroConSet } from '../common/config/BoxSet';
const { ccclass, property } = _decorator;
@ccclass('HeroSelectCom')
export class HeroSelectCom extends Component {
slot:number=0
start() {
}
onAdded(args: any) {
console.log("[HeroSelectCom]:onAdded",args)
this.slot=args.slot
this.update_heros()
}
protected onDisable(): void {
console.log("[HeroSelectCom]:onDisable")
this.clear_heros()
}
update_heros(){
let heros=smc.getHasHeroUUID()
console.log("[HeroPageComp]:update_heros",heros)
let width= heros.length*235+30
for(let i=0;i<heros.length;i++){
let hero=heros[i]
console.log("[HeroPageComp]:hero",hero)
if(hero){
this.load_hero(hero)
}
}
}
clear_heros(){
let parent=this.node.getChildByName("main").getChildByName("view").getChildByName("heros")
let children=parent.children
console.log("[HeroPageComp]:clear_heros",children)
for(let i=0;i<children.length;i++){
children[i].destroy()
}
}
load_hero(uuid:number){
console.log("[HeroPageComp]:load_hero",uuid)
let parent=this.node.getChildByName("main").getChildByName("view").getChildByName("heros")
let path = "game/gui/hcard"
const prefab = oops.res.get(path, Prefab);
if (!prefab) {
console.error("[Skill] 预制体加载失败:", path);
return;
}
const node = instantiate(prefab);
node.parent=parent
let hcard=node.getComponent(HCardUICom)!
hcard.update_data(uuid,{type:HeroConSet.SELECT,slot:this.slot})
}
update(deltaTime: number) {
}
close(){
oops.gui.removeByNode(this.node)
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "0c9b9c74-9486-4b43-b797-f602d26f2f1a",
"files": [],
"subMetas": {},
"userData": {}
}