feat: 调整游戏界面布局和地平线高度
- 提升游戏地平线高度(GAME_LINE从-140改为-90),优化视觉体验 - 删除未使用的MissionGetsComp组件及相关资源文件 - 调整地图预制体中多个节点的Y坐标位置 - 修改角色控制器UI元素的位置、大小和间距 - 更新UI容器的高度和底部边距以适应新布局
This commit is contained in:
@@ -584,7 +584,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -245.746,
|
||||
"y": -195.746,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -720,7 +720,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 52.571,
|
||||
"y": 102.571,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -856,7 +856,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -228.047,
|
||||
"y": -128.047,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -992,7 +992,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -232.963,
|
||||
"y": -132.963,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -1128,7 +1128,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -530.208,
|
||||
"y": -480.208,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -1267,7 +1267,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -270,
|
||||
"y": -220,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -1383,7 +1383,7 @@
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": -220,
|
||||
"_bottom": -170,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
|
||||
@@ -979,7 +979,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
"y": 65,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -1036,7 +1036,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 53.692,
|
||||
"y": 70,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -1840,12 +1840,12 @@
|
||||
"__prefab": {
|
||||
"__id__": 75
|
||||
},
|
||||
"_alignFlags": 40,
|
||||
"_alignFlags": 44,
|
||||
"_target": null,
|
||||
"_left": -2.4868995751603507e-14,
|
||||
"_right": 2.4868995751603507e-14,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_bottom": 120,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
@@ -1901,7 +1901,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"y": -5,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -1942,7 +1942,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 720,
|
||||
"height": 80
|
||||
"height": 120
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -2134,8 +2134,8 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -150.447,
|
||||
"y": 0,
|
||||
"x": -158.189,
|
||||
"y": -5,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -2674,8 +2674,6 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "a2T+9jtpFDK6TbGmUuF01c",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
@@ -2711,8 +2709,8 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -272.948,
|
||||
"y": 0,
|
||||
"x": -280.69,
|
||||
"y": -5,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -3669,8 +3667,6 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "92fF6VNGhL4KGhc565gFRM",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
@@ -3716,7 +3712,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 201.983,
|
||||
"y": 0,
|
||||
"y": -5,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -4680,7 +4676,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 201.983,
|
||||
"y": 0,
|
||||
"y": -5,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -5597,8 +5593,6 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "24VpHkRBxCuZkdMazUpc/Y",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
@@ -5638,7 +5632,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 106.678,
|
||||
"y": 135,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -6759,7 +6753,7 @@
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 116.678,
|
||||
"_bottom": 160,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
@@ -6822,7 +6816,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 12.888000000000005,
|
||||
"y": 25,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -6879,7 +6873,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"y": -15,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -6972,8 +6966,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 160,
|
||||
"height": 110
|
||||
"width": 190,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -7833,8 +7827,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 160,
|
||||
"height": 110
|
||||
"width": 190,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -7874,8 +7868,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 160,
|
||||
"height": 120
|
||||
"width": 190,
|
||||
"height": 180
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -7943,7 +7937,7 @@
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 1230,
|
||||
"_bottom": 2.8880000000000017,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
@@ -7990,7 +7984,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 720,
|
||||
"height": 100
|
||||
"height": 130
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -8020,7 +8014,7 @@
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": -10,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
@@ -8092,7 +8086,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 307.927,
|
||||
"y": 360,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -8796,7 +8790,7 @@
|
||||
"_left": 5.5,
|
||||
"_right": 5.5,
|
||||
"_top": 0,
|
||||
"_bottom": 157.92700000000002,
|
||||
"_bottom": 210,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
|
||||
@@ -18,7 +18,8 @@ export enum BoxSet {
|
||||
LETF_END = -420,
|
||||
RIGHT_END = 420,
|
||||
//游戏地平线
|
||||
GAME_LINE = -140
|
||||
GAME_LINE = -90
|
||||
|
||||
//攻击距离
|
||||
}
|
||||
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
import { _decorator, Node, Label, PrefabLink, instantiate, Prefab, SpriteAtlas, Sprite, resources } 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";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { CardKind } from "../common/config/GameSet";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MissionGetsCompComp')
|
||||
@ecs.register('MissionGetsComp', false)
|
||||
export class MissionGetsCompComp extends CCComp {
|
||||
debugMode = false;
|
||||
get_datas: { [key: number]: { num: number, node: Node, kind?: number } } = {};
|
||||
get_nodes: Node[] = [];
|
||||
// 图标图集缓存
|
||||
private uiconsAtlas: SpriteAtlas | null = null;
|
||||
|
||||
onLoad() {
|
||||
oops.message.on(GameEvent.UpdateMissionGet, this.onUpdateMissionGet, this);
|
||||
oops.message.on(GameEvent.MissionStart, this.onMissionStart, this);
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
oops.message.off(GameEvent.UpdateMissionGet, this.onUpdateMissionGet, this);
|
||||
oops.message.off(GameEvent.MissionStart, this.onMissionStart, this);
|
||||
}
|
||||
|
||||
onMissionStart(){
|
||||
// 清理旧的节点
|
||||
this.get_nodes.forEach(node => {
|
||||
if (node && node.isValid) {
|
||||
node.destroy();
|
||||
}
|
||||
});
|
||||
this.get_nodes = [];
|
||||
this.get_datas = {};
|
||||
}
|
||||
|
||||
private onUpdateMissionGet(event: string, args: any) {
|
||||
if (!args || !args.uuid) return;
|
||||
const { uuid, icon, kind } = args;
|
||||
this.addGet(uuid, icon, kind);
|
||||
}
|
||||
|
||||
addGet(uuid: number, iconName?: string, kind?: number) {
|
||||
mLogger.log(this.debugMode, 'MissionGetsComp', "[MissionGetsComp]添加获取到的物品:", uuid, iconName, kind);
|
||||
if (this.get_datas[uuid]) {
|
||||
this.get_datas[uuid].num++;
|
||||
this.updateNodeNum(this.get_datas[uuid].node, this.get_datas[uuid].num);
|
||||
} else {
|
||||
this.load_hui(uuid, iconName || uuid.toString(), kind);
|
||||
}
|
||||
}
|
||||
|
||||
load_hui(uuid: number, iconName: string, kind?: number){
|
||||
var path = "game/gui/get";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
if (!prefab) {
|
||||
mLogger.log(this.debugMode, 'MissionGetsComp', "Prefab not found:", path);
|
||||
return;
|
||||
}
|
||||
var node = instantiate(prefab);
|
||||
// 将节点添加到父节点下
|
||||
this.node.addChild(node);
|
||||
|
||||
// 记录数据
|
||||
this.get_datas[uuid] = { num: 1, node: node, kind: kind };
|
||||
this.get_nodes.push(node);
|
||||
|
||||
node.getChildByName("num").getComponent(Label).string = "1";
|
||||
|
||||
// 先隐藏所有类型标识
|
||||
const typeNodes = ["Atk", "Atked", "Buff", "Attr", "Skill", "Hp", "Dead", "Partner"];
|
||||
// 1. 处理 bg 节点
|
||||
typeNodes.forEach(nodeName => {
|
||||
const node_bg = node.getChildByName(nodeName);
|
||||
if (node_bg) node_bg.active = false;
|
||||
});
|
||||
// 根据 kind 激活bg
|
||||
let activeNodeName = "";
|
||||
switch (kind) {
|
||||
case CardKind.Atk:
|
||||
activeNodeName = "Atk";
|
||||
break;
|
||||
case CardKind.Atted:
|
||||
activeNodeName = "Atked";
|
||||
break;
|
||||
case CardKind.Buff:
|
||||
activeNodeName = "Buff";
|
||||
break;
|
||||
case CardKind.Attr:
|
||||
activeNodeName = "Attr";
|
||||
break;
|
||||
case CardKind.Skill:
|
||||
activeNodeName = "Skill";
|
||||
break;
|
||||
case CardKind.Hp:
|
||||
activeNodeName = "Hp";
|
||||
break;
|
||||
case CardKind.Dead:
|
||||
activeNodeName = "Dead";
|
||||
break;
|
||||
case CardKind.Partner:
|
||||
activeNodeName = "Partner";
|
||||
break;
|
||||
}
|
||||
|
||||
if (activeNodeName) {
|
||||
// 激活bg
|
||||
const activeNode = node.getChildByName(activeNodeName);
|
||||
if (activeNode) activeNode.active = true;
|
||||
}
|
||||
|
||||
const sprite = node.getChildByName("icon").getComponent(Sprite);
|
||||
if (!sprite) return;
|
||||
|
||||
if (this.uiconsAtlas) {
|
||||
const frame = this.uiconsAtlas.getSpriteFrame(iconName);
|
||||
if (frame) {
|
||||
sprite.spriteFrame = frame;
|
||||
}
|
||||
} else {
|
||||
// 加载图集
|
||||
resources.load("gui/uicons", SpriteAtlas, (err, atlas) => {
|
||||
if (err) {
|
||||
mLogger.error(this.debugMode, 'MissionGetsComp', "[MissionGetsComp] Failed to load uicons atlas", err);
|
||||
return;
|
||||
}
|
||||
this.uiconsAtlas = atlas;
|
||||
const frame = atlas.getSpriteFrame(iconName);
|
||||
if (frame) {
|
||||
sprite.spriteFrame = frame;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private updateNodeNum(node: Node, num: number) {
|
||||
const label = node.getChildByName("num")?.getComponent(Label);
|
||||
if (label) {
|
||||
label.string = num.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a1707aae-7e2b-4360-b44b-a984f4a6d358",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user