From 42eb33b5792f3fdff48f3179c52270176da1afb3 Mon Sep 17 00:00:00 2001 From: gahusb Date: Tue, 16 Jun 2026 07:58:55 +0900 Subject: [PATCH] =?UTF-8?q?refactor(cb):=20lib/codeblock.mjs=EB=A1=9C=20?= =?UTF-8?q?=ED=97=AC=ED=8D=BC=C2=B7=EC=83=81=EC=88=98=20=EC=B6=94=EC=B6=9C?= =?UTF-8?q?=20(codeblock=20=EB=B0=94=EC=9D=B4=ED=8A=B8=20=EB=8F=99?= =?UTF-8?q?=EC=9D=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/deck/gen-slaydeck.mjs | 59 +---------------------------------- tools/deck/lib/codeblock.mjs | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 58 deletions(-) create mode 100644 tools/deck/lib/codeblock.mjs diff --git a/tools/deck/gen-slaydeck.mjs b/tools/deck/gen-slaydeck.mjs index 8cbaf28..264cdda 100644 --- a/tools/deck/gen-slaydeck.mjs +++ b/tools/deck/gen-slaydeck.mjs @@ -1,6 +1,7 @@ import { readFileSync, writeFileSync } from 'node:fs'; import { CARDS, ENEMIES, CLASSES, JOBS, SOUL_UNLOCKS, luaSoulShopTable, CARDFRAMES, RARITIES, frameRuid, luaFramesTable, luaNodeIconsTable, MAP_ROWS, MAP_COLS, CHEST_CLOSED_RUID, CHEST_OPEN_RUID, NODEICONS, CHARS, CAM, RELICS, luaRelicsTable, POTIONS, luaPotionsTable, luaIntentsArray, luaEnemiesTable, luaStr, luaJobsTable, luaCardsTable, luaDeckTable } from './lib/data.mjs'; +import { prop, method, codeblock, RUN_LENGTH, GOLD_PER_WIN, CARD_PRICE, REST_HEAL, RELIC_PRICE, ACT_COUNT, ACT_MAPS, LOBBY_MAP, LOBBY_SPAWN } from './lib/codeblock.mjs'; import { UI_FILE, COMMON_FILE, UI_ROOT, GENERATED_UI_SECTIONS, UI_APPEND_ORDER, DISABLED_STOCK_CONTROLS, TRANSPARENT, DARK, GOLD, ATTACK, DEFEND, SKILL, DAMAGE_DIGIT_RUIDS, DAMAGE_POP_MAX_DIGITS, DAMAGE_POP_DIGIT_W, DAMAGE_POP_DIGIT_H, DAMAGE_POP_DIGIT_SPACING, MAX_MONSTERS, HEAD_OFFSET_Y, HP_BAR_W, WHITE, CARD_NAME_TEXT, CARD_DESC_TEXT, cardFaceLayout, CARD_W, CARD_H, CARD_SPACING, CARD_XS, ALIGN_CENTER, ALIGN_BOTTOM_CENTER, guid, transform, sprite, button, text, scrollLayoutGroup, popupLayerFor, uiOrderFor, displayOrderFor, applySortingOverride, entity, uiPath, sectionRoot, isGeneratedUiEntity, appendUiSection } from './lib/ui-helpers.mjs'; import { buildDeckHud } from './hud/deckhud.mjs'; import { buildDeckInspect } from './hud/deckinspect.mjs'; @@ -239,65 +240,7 @@ function upsertUi() { writeFileSync(UI_FILE, JSON.stringify(ui, null, 2), 'utf8'); } -function prop(Type, Name, DefaultValue = 'nil') { - return { Type, DefaultValue, SyncDirection: 0, Attributes: [], Name }; -} - -function method(Name, Code, Arguments = [], ExecSpace = 0, ReturnType = 'void') { - return { - Return: { Type: ReturnType, DefaultValue: null, SyncDirection: 0, Attributes: [], Name: null }, - Arguments, - Code, - Scope: 2, - ExecSpace, - Attributes: [], - Name, - }; -} - -function codeblock(id, name, properties, methods) { - return { - Id: '', - GameId: '', - EntryKey: `codeblock://${id}`, - ContentType: 'x-mod/codeblock', - Content: '', - Usage: 0, - UsePublish: 1, - UseService: 0, - CoreVersion: '26.5.0.0', - StudioVersion: '', - DynamicLoading: 0, - ContentProto: { - Use: 'Json', - Json: { - CoreVersion: { Major: 0, Minor: 2 }, - ScriptVersion: { Major: 1, Minor: 0 }, - Description: '', - Id: id, - Language: 1, - Name: name, - Type: 1, - Source: 0, - Target: null, - Properties: properties, - Methods: methods, - EntityEventHandlers: [], - }, - }, - }; -} - function writeCodeblocks() { - const RUN_LENGTH = 5; - const GOLD_PER_WIN = 25; - const CARD_PRICE = 30; - const REST_HEAL = 30; - const RELIC_PRICE = 60; - const ACT_COUNT = 5; - const ACT_MAPS = ['map01', 'map02', 'map03', 'map04', 'map05']; - const LOBBY_MAP = 'lobby'; - const LOBBY_SPAWN = 'Vector3(-5, 0.03, 0)'; // 정찰: map01 지면 좌측 const combat = codeblock('SlayDeckController', 'SlayDeckController', [ prop('any', 'DrawPile'), prop('any', 'DiscardPile'), diff --git a/tools/deck/lib/codeblock.mjs b/tools/deck/lib/codeblock.mjs new file mode 100644 index 0000000..6127768 --- /dev/null +++ b/tools/deck/lib/codeblock.mjs @@ -0,0 +1,60 @@ +function prop(Type, Name, DefaultValue = 'nil') { + return { Type, DefaultValue, SyncDirection: 0, Attributes: [], Name }; +} + +function method(Name, Code, Arguments = [], ExecSpace = 0, ReturnType = 'void') { + return { + Return: { Type: ReturnType, DefaultValue: null, SyncDirection: 0, Attributes: [], Name: null }, + Arguments, + Code, + Scope: 2, + ExecSpace, + Attributes: [], + Name, + }; +} + +function codeblock(id, name, properties, methods) { + return { + Id: '', + GameId: '', + EntryKey: `codeblock://${id}`, + ContentType: 'x-mod/codeblock', + Content: '', + Usage: 0, + UsePublish: 1, + UseService: 0, + CoreVersion: '26.5.0.0', + StudioVersion: '', + DynamicLoading: 0, + ContentProto: { + Use: 'Json', + Json: { + CoreVersion: { Major: 0, Minor: 2 }, + ScriptVersion: { Major: 1, Minor: 0 }, + Description: '', + Id: id, + Language: 1, + Name: name, + Type: 1, + Source: 0, + Target: null, + Properties: properties, + Methods: methods, + EntityEventHandlers: [], + }, + }, + }; +} + +const RUN_LENGTH = 5; +const GOLD_PER_WIN = 25; +const CARD_PRICE = 30; +const REST_HEAL = 30; +const RELIC_PRICE = 60; +const ACT_COUNT = 5; +const ACT_MAPS = ['map01', 'map02', 'map03', 'map04', 'map05']; +const LOBBY_MAP = 'lobby'; +const LOBBY_SPAWN = 'Vector3(-5, 0.03, 0)'; // 정찰: map01 지면 좌측 + +export { prop, method, codeblock, RUN_LENGTH, GOLD_PER_WIN, CARD_PRICE, REST_HEAL, RELIC_PRICE, ACT_COUNT, ACT_MAPS, LOBBY_MAP, LOBBY_SPAWN };