feat(map): 新增任务卡片组件及UI布局

添加 MissionCardComp.ts 组件用于处理任务卡片逻辑
在 card.prefab 中新增名称标签及相关UI组件
组件支持卡片数据更新和显示控制
This commit is contained in:
walkpan
2026-01-04 18:42:57 +08:00
parent 30b62f1c33
commit f7622202f8
4 changed files with 1386 additions and 1066 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -35,19 +35,22 @@
},
{
"__id__": 40
},
{
"__id__": 56
}
],
"_active": true,
"_components": [
{
"__id__": 56
"__id__": 64
},
{
"__id__": 58
"__id__": 66
}
],
"_prefab": {
"__id__": 60
"__id__": 68
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1291,6 +1294,204 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "name",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 57
},
{
"__id__": 59
},
{
"__id__": 61
}
],
"_prefab": {
"__id__": 63
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 30.826,
"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__": 56
},
"_enabled": true,
"__prefab": {
"__id__": 58
},
"_contentSize": {
"__type__": "cc.Size",
"width": 140,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5dQYmqYYJHLpc1xcwyas4Y"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 56
},
"_enabled": true,
"__prefab": {
"__id__": 60
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "名称",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 31,
"_fontSize": 30,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 2,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_enableOutline": true,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6bfuLK/8VER4qubR8ZLq68"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 56
},
"_enabled": true,
"__prefab": {
"__id__": 62
},
"_alignFlags": 40,
"_target": null,
"_left": 10,
"_right": 10,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 140,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "28XYCB76tOIogUI2LVTgNB"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "7d/tbgttdAXbLj144ca4ZW",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -1301,7 +1502,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 57
"__id__": 65
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1329,7 +1530,7 @@
},
"_enabled": false,
"__prefab": {
"__id__": 59
"__id__": 67
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -1373,6 +1574,7 @@
"__id__": 0
},
"fileId": "c3ePn06YJC6YTe2BxAPPm2",
"instance": null
"instance": null,
"targetOverrides": null
}
]

View File

@@ -0,0 +1,76 @@
import { _decorator, Label, Node } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('ModuleViewComp')
@ecs.register('ModuleView', false)
export class ModuleViewComp extends CCComp {
/** 视图层逻辑代码分离演示 */
@property(Node)
card1:Node = null
@property(Node)
card2:Node = null
@property(Node)
card3:Node = null
@property(Node)
card4:Node = null
card1_data:any = {}
card2_data:any = {}
card3_data:any = {}
card4_data:any = {}
start() {
this.card1.active=true
this.card2.active=true
this.card3.active=true
this.card4.active=true
}
refCards(){
}
updateCardInfo(card:Node,data:any){
if(!card) return
let name = card.getChildByName("name")
if(name){
name.getComponent(Label).string = data.name
}
let info = card.getChildByName("info").getChildByName("Label")
if(info){
info.getComponent(Label).string = data.info
}
}
updateCardData(index:number,data:any){
switch (index) {
case 1:
this.card1_data = data
break;
case 2:
this.card2_data = data
break;
case 3:
this.card3_data = data
break;
case 4:
this.card4_data = data
break;
}
}
selectCard(index:number){
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "b3d6e490-f2e9-4f3f-bf64-3e93c8cada94",
"files": [],
"subMetas": {},
"userData": {}
}