cb/*.mjs의 /ui/DefaultGroup/<Section> 리터럴을 메이커 재편 UIGroup으로 일괄 remap: - SelectUIGroup(charselect/job), LobbyUIGroup(lobby/board/soulshop), RunUIGroup(combat/map/shop/rest/treasure/reward/cardhand/deck), DeckUIGroup(덱 도감). MainMenu·월드조작은 DefaultGroup 잔류. - 몬스터 슬롯 CombatHud/MonsterSlot → RunUIGroup/CombatHud/MonsterStatus - 검증: cbgap GAP 0 (참조 경로 전부 새 .ui에 실재), 이동섹션 DefaultGroup 잔여 0 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
115 lines
5.7 KiB
JavaScript
115 lines
5.7 KiB
JavaScript
import { method, RUN_LENGTH, GOLD_PER_WIN, CARD_PRICE, REST_HEAL, RELIC_PRICE, ACT_COUNT, ACT_MAPS, LOBBY_MAP, LOBBY_SPAWN } from '../lib/codeblock.mjs';
|
|
import { CARDS, ENEMIES, CLASSES, JOBS, SOUL_UNLOCKS, CARDFRAMES, RARITIES, MAP_ROWS, MAP_COLS, CHEST_CLOSED_RUID, CHEST_OPEN_RUID, NODEICONS, CHARS, CAM, RELICS, POTIONS, luaSoulShopTable, frameRuid, luaFramesTable, luaNodeIconsTable, luaRelicsTable, luaPotionsTable, luaIntentsArray, luaEnemiesTable, luaStr, luaJobsTable, luaCardsTable, luaDeckTable } from '../lib/data.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';
|
|
|
|
export const soulMethods = [
|
|
method('ShowSoulShop', `self:RenderSoulLabel()
|
|
self:RenderSoulShop()
|
|
self:BindSoulShopButtons()
|
|
self:SetEntityEnabled("/ui/LobbyUIGroup/SoulShopHud", true)`),
|
|
method('CloseSoulShop', `self:SetEntityEnabled("/ui/LobbyUIGroup/SoulShopHud", false)`),
|
|
method('ReqLoadSouls', `local ds = _DataStorageService:GetUserDataStorage(userId)
|
|
local e1, pts = ds:GetAndWait("soulPoints")
|
|
local e2, unl = ds:GetAndWait("soulUnlocks")
|
|
local p = 0
|
|
if e1 == 0 and pts ~= nil and pts ~= "" then p = tonumber(pts) or 0 end
|
|
local u = ""
|
|
if e2 == 0 and unl ~= nil then u = unl end
|
|
self:RecvSouls(p, u, userId)`, [{ Type: "string", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "userId" }], 5),
|
|
method('RecvSouls', `self.SoulPoints = p
|
|
self.SoulUnlocks = {}
|
|
if u ~= nil and u ~= "" then
|
|
for key in string.gmatch(u, "([^,]+)") do
|
|
self.SoulUnlocks[key] = true
|
|
end
|
|
end
|
|
self:RenderSoulLabel()`, [{ Type: "number", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "p" }, { Type: "string", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "u" }, { Type: "string", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "userId" }], 6),
|
|
method('SaveSouls', `local ds = _DataStorageService:GetUserDataStorage(userId)
|
|
ds:SetAndWait("soulPoints", tostring(p))
|
|
ds:SetAndWait("soulUnlocks", u)`, [{ Type: "number", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "p" }, { Type: "string", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "u" }, { Type: "string", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "userId" }], 5),
|
|
method('SerializeUnlocks', `local parts = {}
|
|
if self.SoulUnlocks ~= nil then
|
|
for k, v in pairs(self.SoulUnlocks) do
|
|
if v == true then table.insert(parts, k) end
|
|
end
|
|
end
|
|
return table.concat(parts, ",")`, [], 0, 'string'),
|
|
method('AwardSouls', `self.SoulPoints = (self.SoulPoints or 0) + n
|
|
local lp = _UserService.LocalPlayer
|
|
if lp ~= nil then
|
|
self:SaveSouls(self.SoulPoints, self:SerializeUnlocks(), lp.PlayerComponent.UserId)
|
|
end
|
|
self:RenderSoulLabel()`, [{ Type: "number", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "n" }]),
|
|
method('BuySoulUnlock', `local d = nil
|
|
if self.SoulShopDef ~= nil then d = self.SoulShopDef[slot] end
|
|
if d == nil then return end
|
|
if self.SoulUnlocks ~= nil and self.SoulUnlocks[d.key] == true then
|
|
self:Toast("이미 보유 중입니다")
|
|
return
|
|
end
|
|
if (self.SoulPoints or 0) < d.cost then
|
|
self:Toast("영혼이 부족합니다")
|
|
return
|
|
end
|
|
self.SoulPoints = self.SoulPoints - d.cost
|
|
if self.SoulUnlocks == nil then self.SoulUnlocks = {} end
|
|
self.SoulUnlocks[d.key] = true
|
|
local lp = _UserService.LocalPlayer
|
|
if lp ~= nil then
|
|
self:SaveSouls(self.SoulPoints, self:SerializeUnlocks(), lp.PlayerComponent.UserId)
|
|
end
|
|
self:Toast(d.name .. " 해금!")
|
|
self:RenderSoulLabel()
|
|
self:RenderSoulShop()`, [{ Type: "number", DefaultValue: null, SyncDirection: 0, Attributes: [], Name: "slot" }]),
|
|
method('RenderSoulShop', `local defs = self.SoulShopDef or {}
|
|
for i = 1, 4 do
|
|
local base = "/ui/LobbyUIGroup/SoulShopHud/Item" .. tostring(i)
|
|
local d = defs[i]
|
|
if d == nil then
|
|
self:SetEntityEnabled(base, false)
|
|
else
|
|
self:SetEntityEnabled(base, true)
|
|
self:SetText(base .. "/Name", d.name)
|
|
self:SetText(base .. "/Desc", d.desc)
|
|
local owned = self.SoulUnlocks ~= nil and self.SoulUnlocks[d.key] == true
|
|
if owned then
|
|
self:SetText(base .. "/Status", "보유 중")
|
|
elseif (self.SoulPoints or 0) >= d.cost then
|
|
self:SetText(base .. "/Status", tostring(d.cost) .. " 영혼 · 구매")
|
|
else
|
|
self:SetText(base .. "/Status", tostring(d.cost) .. " 영혼 · 부족")
|
|
end
|
|
end
|
|
end`),
|
|
method('BindSoulShopButtons', `if self.SoulShopBound == true then
|
|
return
|
|
end
|
|
self.SoulShopBound = true
|
|
for i = 1, 4 do
|
|
local idx = i
|
|
local e = _EntityService:GetEntityByPath("/ui/LobbyUIGroup/SoulShopHud/Item" .. tostring(i))
|
|
if e ~= nil and e.ButtonComponent ~= nil then
|
|
e:ConnectEvent(ButtonClickEvent, function() self:BuySoulUnlock(idx) end)
|
|
end
|
|
end`),
|
|
method('ApplySoulUnlocks', `if self.SoulUnlocks == nil then return end
|
|
if self.SoulUnlocks["meso"] == true then self.Gold = self.Gold + 60 end
|
|
if self.SoulUnlocks["hp"] == true then
|
|
self.PlayerMaxHp = self.PlayerMaxHp + 15
|
|
self.PlayerHp = self.PlayerMaxHp
|
|
end
|
|
if self.SoulUnlocks["trim"] == true then
|
|
for i = 1, #self.RunDeck do
|
|
local cid = self.RunDeck[i]
|
|
if cid == "Defend" or cid == "MagicGuard" or cid == "DarkSight" then
|
|
table.remove(self.RunDeck, i)
|
|
break
|
|
end
|
|
end
|
|
end
|
|
if self.SoulUnlocks["relic"] == true then
|
|
local nid = self:PickNewRelic()
|
|
if nid ~= "" then self:AddRelic(nid) end
|
|
end`),
|
|
];
|