fix(ui): 덱 미리보기에 직업 탭 추가
This commit is contained in:
@@ -950,6 +950,28 @@ function upsertUi() {
|
||||
text({ value: 'X', fontSize: 26, bold: true, color: GOLD, alignment: 4 }),
|
||||
],
|
||||
}));
|
||||
const deckTabs = [
|
||||
{ key: 'Warrior', label: '전사', x: -210 },
|
||||
{ key: 'Thief', label: '도적', x: 0 },
|
||||
{ key: 'Mage', label: '마법사', x: 210 },
|
||||
];
|
||||
for (let i = 0; i < deckTabs.length; i++) {
|
||||
const tab = deckTabs[i];
|
||||
allDeck.push(entity({
|
||||
id: guid('all', 10 + i),
|
||||
path: `/ui/DefaultGroup/DeckAllHud/${tab.key}Tab`,
|
||||
modelId: 'uibutton',
|
||||
entryId: 'UIButton',
|
||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent',
|
||||
displayOrder: 3 + i,
|
||||
components: [
|
||||
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 170, y: 46 }, pos: { x: tab.x, y: 318 } }),
|
||||
sprite({ color: { r: 0.11, g: 0.13, b: 0.16, a: 1 }, type: 1, raycast: true }),
|
||||
button(),
|
||||
text({ value: tab.label, fontSize: 22, bold: true, color: GOLD, alignment: 4 }),
|
||||
],
|
||||
}));
|
||||
}
|
||||
allDeck.push(entity({
|
||||
id: guid('all', 4),
|
||||
path: '/ui/DefaultGroup/DeckAllHud/Empty',
|
||||
@@ -2724,6 +2746,9 @@ function writeCodeblocks() {
|
||||
prop('any', 'WarriorDeckHandler'),
|
||||
prop('any', 'ThiefDeckHandler'),
|
||||
prop('any', 'MageDeckHandler'),
|
||||
prop('any', 'WarriorDeckTabHandler'),
|
||||
prop('any', 'ThiefDeckTabHandler'),
|
||||
prop('any', 'MageDeckTabHandler'),
|
||||
prop('any', 'AscMinusHandler'),
|
||||
prop('any', 'AscPlusHandler'),
|
||||
prop('any', 'JobOpts'),
|
||||
@@ -2745,6 +2770,7 @@ function writeCodeblocks() {
|
||||
prop('boolean', 'ClassDeckMode', 'false'),
|
||||
prop('any', 'ClassDeckCards'),
|
||||
prop('string', 'ClassDeckTitle', '""'),
|
||||
prop('string', 'ClassDeckClass', '""'),
|
||||
prop('any', 'SoulUnlocks'),
|
||||
prop('any', 'SoulShopDef'),
|
||||
prop('boolean', 'SoulShopBound', 'false'),
|
||||
@@ -2971,6 +2997,7 @@ if allDeckClose ~= nil and allDeckClose.ButtonComponent ~= nil then
|
||||
end
|
||||
self.AllDeckCloseHandler = allDeckClose:ConnectEvent(ButtonClickEvent, function() self:CloseAllDeck() end)
|
||||
end
|
||||
self:BindClassDeckTabs()
|
||||
local start = _EntityService:GetEntityByPath("/ui/DefaultGroup/CharacterSelectHud/StartButton")
|
||||
if start ~= nil and start.ButtonComponent ~= nil then
|
||||
if self.StartGameHandler ~= nil then
|
||||
@@ -3461,6 +3488,7 @@ if allDeckClose ~= nil and allDeckClose.ButtonComponent ~= nil then
|
||||
end
|
||||
self.AllDeckCloseHandler = allDeckClose:ConnectEvent(ButtonClickEvent, function() self:CloseAllDeck() end)
|
||||
end
|
||||
self:BindClassDeckTabs()
|
||||
for i = 1, 10 do
|
||||
local cardEntity = _EntityService:GetEntityByPath("/ui/DefaultGroup/CardHand/Card" .. tostring(i))
|
||||
if cardEntity ~= nil and cardEntity.UITouchReceiveComponent ~= nil then
|
||||
@@ -3760,10 +3788,47 @@ end`, [
|
||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
||||
]),
|
||||
method('BindClassDeckTabs', `local warriorTab = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud/WarriorTab")
|
||||
if warriorTab ~= nil and warriorTab.ButtonComponent ~= nil then
|
||||
if self.WarriorDeckTabHandler ~= nil then
|
||||
warriorTab:DisconnectEvent(ButtonClickEvent, self.WarriorDeckTabHandler)
|
||||
self.WarriorDeckTabHandler = nil
|
||||
end
|
||||
self.WarriorDeckTabHandler = warriorTab:ConnectEvent(ButtonClickEvent, function() self:SetClassDeckTab("warrior") end)
|
||||
end
|
||||
local thiefTab = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud/ThiefTab")
|
||||
if thiefTab ~= nil and thiefTab.ButtonComponent ~= nil then
|
||||
if self.ThiefDeckTabHandler ~= nil then
|
||||
thiefTab:DisconnectEvent(ButtonClickEvent, self.ThiefDeckTabHandler)
|
||||
self.ThiefDeckTabHandler = nil
|
||||
end
|
||||
self.ThiefDeckTabHandler = thiefTab:ConnectEvent(ButtonClickEvent, function() self:SetClassDeckTab("bandit") end)
|
||||
end
|
||||
local mageTab = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud/MageTab")
|
||||
if mageTab ~= nil and mageTab.ButtonComponent ~= nil then
|
||||
if self.MageDeckTabHandler ~= nil then
|
||||
mageTab:DisconnectEvent(ButtonClickEvent, self.MageDeckTabHandler)
|
||||
self.MageDeckTabHandler = nil
|
||||
end
|
||||
self.MageDeckTabHandler = mageTab:ConnectEvent(ButtonClickEvent, function() self:SetClassDeckTab("magician") end)
|
||||
end`),
|
||||
method('OpenClassDeck', `self.CodexMode = false
|
||||
self.ClassDeckMode = true
|
||||
self.DeckAllOpen = true
|
||||
self:SetClassDeckTab(className)
|
||||
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('SetClassDeckTab', `if self.ClassDeckMode ~= true then
|
||||
return
|
||||
end
|
||||
self.ClassDeckCards = {}
|
||||
self.ClassDeckTitle = "직업 덱"
|
||||
if className ~= "warrior" and className ~= "magician" and className ~= "bandit" then
|
||||
className = "bandit"
|
||||
end
|
||||
self.ClassDeckClass = className
|
||||
local allowed = {}
|
||||
if className == "warrior" then
|
||||
allowed["warrior"] = true
|
||||
@@ -3799,18 +3864,34 @@ table.sort(self.ClassDeckCards, function(a, b)
|
||||
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' }]),
|
||||
self:RenderClassDeckTabs()`, [{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'className' }]),
|
||||
method('RenderClassDeckTabs', `local tabs = {
|
||||
{ path = "/ui/DefaultGroup/DeckAllHud/WarriorTab", cls = "warrior" },
|
||||
{ path = "/ui/DefaultGroup/DeckAllHud/ThiefTab", cls = "bandit" },
|
||||
{ path = "/ui/DefaultGroup/DeckAllHud/MageTab", cls = "magician" },
|
||||
}
|
||||
for i = 1, #tabs do
|
||||
local e = _EntityService:GetEntityByPath(tabs[i].path)
|
||||
if e ~= nil then
|
||||
e.Enable = self.ClassDeckMode == true
|
||||
if e.SpriteGUIRendererComponent ~= nil then
|
||||
if self.ClassDeckClass == tabs[i].cls then
|
||||
e.SpriteGUIRendererComponent.Color = Color(0.22, 0.28, 0.34, 1)
|
||||
else
|
||||
e.SpriteGUIRendererComponent.Color = Color(0.11, 0.13, 0.16, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end`),
|
||||
method('OpenAllDeck', `local inspectHud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckInspectHud")
|
||||
if inspectHud ~= nil then
|
||||
inspectHud.Enable = false
|
||||
end
|
||||
self.DeckInspectKind = ""
|
||||
self.ClassDeckMode = false
|
||||
self.ClassDeckClass = ""
|
||||
self:RenderClassDeckTabs()
|
||||
self.DeckAllOpen = true
|
||||
self:RenderAllDeck()
|
||||
local hud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud")
|
||||
@@ -3826,7 +3907,9 @@ if self.ClassDeckMode == true then
|
||||
self.ClassDeckMode = false
|
||||
self.ClassDeckCards = {}
|
||||
self.ClassDeckTitle = ""
|
||||
self.ClassDeckClass = ""
|
||||
end
|
||||
self:RenderClassDeckTabs()
|
||||
if self.CodexMode == true then
|
||||
self.CodexMode = false
|
||||
self:ShowLobby()
|
||||
@@ -3842,6 +3925,7 @@ elseif self.CodexMode == true then
|
||||
end
|
||||
local count = #pile
|
||||
self:SetText("/ui/DefaultGroup/DeckAllHud/Title", title .. " (" .. tostring(count) .. ")")
|
||||
self:RenderClassDeckTabs()
|
||||
local empty = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud/Empty")
|
||||
if empty ~= nil then
|
||||
empty.Enable = count <= 0
|
||||
|
||||
Reference in New Issue
Block a user