feat(ui): 직업별 덱 미리보기 추가

This commit is contained in:
2026-06-14 19:27:40 +09:00
parent 6f436ef3eb
commit 15bc17b351
3 changed files with 886 additions and 9 deletions

View File

@@ -2314,9 +2314,9 @@ function upsertUi() {
],
}));
const classCards = [
{ key: 'Warrior', label: '\uC804\uC0AC', desc: '\uAC15\uD55C \uACF5\uACA9\uACFC \uBC29\uC5B4', x: -360, enabled: true, tint: { r: 0.74, g: 0.32, b: 0.28, a: 1 } },
{ key: 'Thief', label: '\uB3C4\uC801', desc: '\uB3C5\u00B7\uB2E8\uAC80\u00B7\uB4DC\uB85C\uC6B0', x: 0, enabled: true, tint: { r: 0.26, g: 0.5, b: 0.34, a: 1 } },
{ key: 'Mage', label: '\uB9C8\uBC95\uC0AC', desc: '\uB9C8\uBC95 \uC6D0\uAC70\uB9AC \uB51C\uB7EC', x: 360, enabled: true, tint: { r: 0.3, g: 0.4, b: 0.75, a: 1 } },
{ key: 'Warrior', classId: 'warrior', label: '\uC804\uC0AC', desc: '\uAC15\uD55C \uACF5\uACA9\uACFC \uBC29\uC5B4', x: -360, enabled: true, tint: { r: 0.74, g: 0.32, b: 0.28, a: 1 } },
{ key: 'Thief', classId: 'bandit', label: '\uB3C4\uC801', desc: '\uB3C5\u00B7\uB2E8\uAC80\u00B7\uB4DC\uB85C\uC6B0', x: 0, enabled: true, tint: { r: 0.26, g: 0.5, b: 0.34, a: 1 } },
{ key: 'Mage', classId: 'magician', label: '\uB9C8\uBC95\uC0AC', desc: '\uB9C8\uBC95 \uC6D0\uAC70\uB9AC \uB51C\uB7EC', x: 360, enabled: true, tint: { r: 0.3, g: 0.4, b: 0.75, a: 1 } },
];
for (let i = 0; i < classCards.length; i++) {
const cls = classCards[i];
@@ -2398,6 +2398,20 @@ function upsertUi() {
],
}));
}
select.push(entity({
id: guid('menu', 170 + i),
path: `/ui/DefaultGroup/CharacterSelectHud/${cls.key}DeckButton`,
modelId: 'uibutton',
entryId: 'UIButton',
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent',
displayOrder: 18 + i,
components: [
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 160, y: 46 }, pos: { x: cls.x, y: -160 }, align: ALIGN_CENTER }),
sprite({ color: { r: 0.11, g: 0.13, b: 0.16, a: 1 }, type: 1, raycast: true }),
button({ enabled: cls.enabled }),
text({ value: '\uB371 \uBCF4\uAE30', fontSize: 20, bold: true, color: GOLD, alignment: 0 }),
],
}));
}
select.push(entity({
id: guid('menu', 180),
@@ -2707,6 +2721,9 @@ function writeCodeblocks() {
prop('any', 'WarriorSelectHandler'),
prop('any', 'ThiefSelectHandler'),
prop('any', 'MageSelectHandler'),
prop('any', 'WarriorDeckHandler'),
prop('any', 'ThiefDeckHandler'),
prop('any', 'MageDeckHandler'),
prop('any', 'AscMinusHandler'),
prop('any', 'AscPlusHandler'),
prop('any', 'JobOpts'),
@@ -2725,6 +2742,9 @@ function writeCodeblocks() {
prop('number', 'LobbyTpTries', '0'),
prop('boolean', 'CodexMode', 'false'),
prop('any', 'CodexCards'),
prop('boolean', 'ClassDeckMode', 'false'),
prop('any', 'ClassDeckCards'),
prop('string', 'ClassDeckTitle', '""'),
prop('any', 'SoulUnlocks'),
prop('any', 'SoulShopDef'),
prop('boolean', 'SoulShopBound', 'false'),
@@ -2919,6 +2939,38 @@ if mage ~= nil and mage.ButtonComponent ~= nil then
end
self.MageSelectHandler = mage:ConnectEvent(ButtonClickEvent, function() self:SelectClass("magician") end)
end
local warriorDeck = _EntityService:GetEntityByPath("/ui/DefaultGroup/CharacterSelectHud/WarriorDeckButton")
if warriorDeck ~= nil and warriorDeck.ButtonComponent ~= nil then
if self.WarriorDeckHandler ~= nil then
warriorDeck:DisconnectEvent(ButtonClickEvent, self.WarriorDeckHandler)
self.WarriorDeckHandler = nil
end
self.WarriorDeckHandler = warriorDeck:ConnectEvent(ButtonClickEvent, function() self:OpenClassDeck("warrior") end)
end
local thiefDeck = _EntityService:GetEntityByPath("/ui/DefaultGroup/CharacterSelectHud/ThiefDeckButton")
if thiefDeck ~= nil and thiefDeck.ButtonComponent ~= nil then
if self.ThiefDeckHandler ~= nil then
thiefDeck:DisconnectEvent(ButtonClickEvent, self.ThiefDeckHandler)
self.ThiefDeckHandler = nil
end
self.ThiefDeckHandler = thiefDeck:ConnectEvent(ButtonClickEvent, function() self:OpenClassDeck("bandit") end)
end
local mageDeck = _EntityService:GetEntityByPath("/ui/DefaultGroup/CharacterSelectHud/MageDeckButton")
if mageDeck ~= nil and mageDeck.ButtonComponent ~= nil then
if self.MageDeckHandler ~= nil then
mageDeck:DisconnectEvent(ButtonClickEvent, self.MageDeckHandler)
self.MageDeckHandler = nil
end
self.MageDeckHandler = mageDeck:ConnectEvent(ButtonClickEvent, function() self:OpenClassDeck("magician") end)
end
local allDeckClose = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud/Close")
if allDeckClose ~= nil and allDeckClose.ButtonComponent ~= nil then
if self.AllDeckCloseHandler ~= nil then
allDeckClose:DisconnectEvent(ButtonClickEvent, self.AllDeckCloseHandler)
self.AllDeckCloseHandler = nil
end
self.AllDeckCloseHandler = allDeckClose:ConnectEvent(ButtonClickEvent, function() self:CloseAllDeck() end)
end
local start = _EntityService:GetEntityByPath("/ui/DefaultGroup/CharacterSelectHud/StartButton")
if start ~= nil and start.ButtonComponent ~= nil then
if self.StartGameHandler ~= nil then
@@ -2997,6 +3049,7 @@ bindClick("/ui/DefaultGroup/LobbyHud/AscPlus", function() self:AdjustAscension(1
bindClick("/ui/DefaultGroup/BoardHud/Close", function() self:CloseBoard() end)
bindClick("/ui/DefaultGroup/SoulShopHud/Close", function() self:CloseSoulShop() end)`),
method('ShowCodex', `self.CodexMode = true
self.ClassDeckMode = false
local list = {}
for id, c in pairs(self.Cards) do
if c.curse ~= true then
@@ -3707,11 +3760,57 @@ end`, [
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
]),
method('OpenClassDeck', `self.CodexMode = false
self.ClassDeckMode = true
self.ClassDeckCards = {}
self.ClassDeckTitle = "직업 덱"
local allowed = {}
if className == "warrior" then
allowed["warrior"] = true
allowed["fighter"] = true
allowed["page"] = true
allowed["spearman"] = true
self.ClassDeckTitle = "전사 전체 덱"
elseif className == "magician" then
allowed["magician"] = true
allowed["firepoison"] = true
allowed["icelightning"] = true
allowed["cleric"] = true
self.ClassDeckTitle = "마법사 전체 덱"
else
allowed["bandit"] = true
allowed["shiv"] = true
allowed["poisoner"] = true
allowed["trickster"] = true
self.ClassDeckTitle = "도적 전체 덱"
end
for id, c in pairs(self.Cards) do
if c ~= nil and c.curse ~= true and allowed[c.class] == true then
table.insert(self.ClassDeckCards, id)
end
end
table.sort(self.ClassDeckCards, function(a, b)
local ca = self.Cards[a]
local cb = self.Cards[b]
local na = a
local nb = b
if ca ~= nil and ca.name ~= nil then na = ca.name end
if cb ~= nil and cb.name ~= nil then nb = cb.name end
if na == nb then return a < b end
return na < nb
end)
self.DeckAllOpen = true
self:RenderAllDeck()
local hud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud")
if hud ~= nil then
hud.Enable = true
end`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'className' }]),
method('OpenAllDeck', `local inspectHud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckInspectHud")
if inspectHud ~= nil then
inspectHud.Enable = false
end
self.DeckInspectKind = ""
self.ClassDeckMode = false
self.DeckAllOpen = true
self:RenderAllDeck()
local hud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud")
@@ -3723,13 +3822,21 @@ local hud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud")
if hud ~= nil then
hud.Enable = false
end
if self.ClassDeckMode == true then
self.ClassDeckMode = false
self.ClassDeckCards = {}
self.ClassDeckTitle = ""
end
if self.CodexMode == true then
self.CodexMode = false
self:ShowLobby()
end`),
method('RenderAllDeck', `local pile = self.RunDeck or {}
local title = "모든 덱"
if self.CodexMode == true then
if self.ClassDeckMode == true then
pile = self.ClassDeckCards or {}
title = self.ClassDeckTitle
elseif self.CodexMode == true then
pile = self.CodexCards or {}
title = "카드 도감"
end