카드 손패를 화면 하단에 배치 (AlignmentOption BottomCenter 교정) + 단색 카드 배경
MSW가 AlignmentOption으로 앵커를 결정하는 점을 반영해 컨테이너를 BottomCenter(6)로, 카드 내부 텍스트는 Center 기준 오프셋으로 교정. 카드 배경은 단색 채움으로 변경. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,15 +12,16 @@ const cards = [
|
||||
{ name: '방어', cost: '1', desc: '방어도 5', tint: DEFEND },
|
||||
{ name: '강타', cost: '2', desc: '피해 10', tint: ATTACK },
|
||||
];
|
||||
const CARD_BG_RUID = 'cd0560c4fc7f3b14994b90a502f00a21'; // 기존 버튼 스프라이트 재사용
|
||||
const CARD_W = 180, CARD_H = 250, CARD_SPACING = 200;
|
||||
// AlignmentType enum: Center=0, TopLeft=4, BottomCenter=6 (MSW가 이 값으로 앵커를 결정)
|
||||
const ALIGN_CENTER = 0, ALIGN_BOTTOM_CENTER = 6;
|
||||
|
||||
// ---- guid helper (deterministic, hex-safe) ----
|
||||
const guid = (n) =>
|
||||
`cad000${n.toString(16).padStart(2, '0')}-0000-4000-8000-${n.toString(16).padStart(12, '0')}`;
|
||||
|
||||
// ---- component builders ----
|
||||
function transform({ parentW, parentH, anchor, pivot, size, pos }) {
|
||||
function transform({ parentW, parentH, anchor, pivot, size, pos, align = 0 }) {
|
||||
const offMin = { x: pos.x - pivot.x * size.x, y: pos.y - pivot.y * size.y };
|
||||
const offMax = { x: pos.x + (1 - pivot.x) * size.x, y: pos.y + (1 - pivot.y) * size.y };
|
||||
const position = {
|
||||
@@ -31,7 +32,7 @@ function transform({ parentW, parentH, anchor, pivot, size, pos }) {
|
||||
return {
|
||||
'@type': 'MOD.Core.UITransformComponent',
|
||||
ActivePlatform: 255,
|
||||
AlignmentOption: 0,
|
||||
AlignmentOption: align,
|
||||
AnchorsMax: { x: anchor.x, y: anchor.y },
|
||||
AnchorsMin: { x: anchor.x, y: anchor.y },
|
||||
MobileOnly: false,
|
||||
@@ -159,7 +160,7 @@ ents.push(entity({
|
||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
|
||||
displayOrder: 4,
|
||||
components: [
|
||||
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0 }, pivot: { x: 0.5, y: 0 }, size: { x: 1020, y: 280 }, pos: { x: 0, y: 30 } }),
|
||||
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 1020, y: 280 }, pos: { x: 0, y: 180 }, align: ALIGN_BOTTOM_CENTER }),
|
||||
sprite({ color: TRANSPARENT, type: 1, raycast: false }),
|
||||
],
|
||||
}));
|
||||
@@ -175,8 +176,8 @@ cards.forEach((c, i) => {
|
||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
|
||||
displayOrder: i,
|
||||
components: [
|
||||
transform({ parentW: 1020, parentH: 280, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: CARD_W, y: CARD_H }, pos: { x: (i - (cards.length - 1) / 2) * CARD_SPACING, y: 0 } }),
|
||||
sprite({ dataId: CARD_BG_RUID, color: c.tint, type: 0, raycast: true }),
|
||||
transform({ parentW: 1020, parentH: 280, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: CARD_W, y: CARD_H }, pos: { x: (i - (cards.length - 1) / 2) * CARD_SPACING, y: 0 }, align: ALIGN_CENTER }),
|
||||
sprite({ color: c.tint, type: 1, raycast: true }),
|
||||
],
|
||||
}));
|
||||
// cost (top-left)
|
||||
@@ -188,7 +189,7 @@ cards.forEach((c, i) => {
|
||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||
displayOrder: 0,
|
||||
components: [
|
||||
transform({ parentW: CARD_W, parentH: CARD_H, anchor: { x: 0, y: 1 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 50, y: 50 }, pos: { x: 32, y: -32 } }),
|
||||
transform({ parentW: CARD_W, parentH: CARD_H, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 50, y: 50 }, pos: { x: -60, y: 95 } }),
|
||||
sprite({ color: TRANSPARENT, type: 1, raycast: false }),
|
||||
text({ value: c.cost, fontSize: 34, bold: true }),
|
||||
],
|
||||
@@ -202,7 +203,7 @@ cards.forEach((c, i) => {
|
||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||
displayOrder: 1,
|
||||
components: [
|
||||
transform({ parentW: CARD_W, parentH: CARD_H, anchor: { x: 0.5, y: 1 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 160, y: 50 }, pos: { x: 0, y: -70 } }),
|
||||
transform({ parentW: CARD_W, parentH: CARD_H, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 160, y: 50 }, pos: { x: 0, y: 50 } }),
|
||||
sprite({ color: TRANSPARENT, type: 1, raycast: false }),
|
||||
text({ value: c.name, fontSize: 28, bold: true }),
|
||||
],
|
||||
@@ -216,7 +217,7 @@ cards.forEach((c, i) => {
|
||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||
displayOrder: 2,
|
||||
components: [
|
||||
transform({ parentW: CARD_W, parentH: CARD_H, anchor: { x: 0.5, y: 0 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 160, y: 80 }, pos: { x: 0, y: 55 } }),
|
||||
transform({ parentW: CARD_W, parentH: CARD_H, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 160, y: 80 }, pos: { x: 0, y: -80 } }),
|
||||
sprite({ color: TRANSPARENT, type: 1, raycast: false }),
|
||||
text({ value: c.desc, fontSize: 22, bold: false }),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user