feat(card-visuals): ApplyCardFace 렌더 일원화 + Cards image 직렬화
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,7 @@ function luaCardsTable(cards) {
|
|||||||
const fields = [`name = ${luaStr(c.name)}`, `cost = ${c.cost}`, `desc = ${luaStr(c.desc)}`, `kind = ${luaStr(c.kind)}`];
|
const fields = [`name = ${luaStr(c.name)}`, `cost = ${c.cost}`, `desc = ${luaStr(c.desc)}`, `kind = ${luaStr(c.kind)}`];
|
||||||
if (c.damage != null) fields.push(`damage = ${c.damage}`);
|
if (c.damage != null) fields.push(`damage = ${c.damage}`);
|
||||||
if (c.block != null) fields.push(`block = ${c.block}`);
|
if (c.block != null) fields.push(`block = ${c.block}`);
|
||||||
|
if (c.image != null) fields.push(`image = ${luaStr(c.image)}`);
|
||||||
return `\t${id} = { ${fields.join(', ')} },`;
|
return `\t${id} = { ${fields.join(', ')} },`;
|
||||||
});
|
});
|
||||||
return `self.Cards = {\n${lines.join('\n')}\n}`;
|
return `self.Cards = {\n${lines.join('\n')}\n}`;
|
||||||
@@ -2111,24 +2112,7 @@ end`, [
|
|||||||
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'pile' },
|
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'pile' },
|
||||||
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'title' },
|
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'title' },
|
||||||
]),
|
]),
|
||||||
method('ApplyInspectCardVisual', `local c = self.Cards[cardId]
|
method('ApplyInspectCardVisual', `self:ApplyCardFace("/ui/DefaultGroup/DeckInspectHud/Grid/Card" .. tostring(slot), cardId)`, [
|
||||||
if c == nil then
|
|
||||||
c = { name = cardId, cost = 0, desc = "", kind = "Skill" }
|
|
||||||
end
|
|
||||||
local base = "/ui/DefaultGroup/DeckInspectHud/Grid/Card" .. tostring(slot)
|
|
||||||
self:SetText(base .. "/Cost", tostring(c.cost))
|
|
||||||
self:SetText(base .. "/Name", c.name)
|
|
||||||
self:SetText(base .. "/Desc", c.desc)
|
|
||||||
local e = _EntityService:GetEntityByPath(base)
|
|
||||||
if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
|
|
||||||
if c.kind == "Attack" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
|
||||||
elseif c.kind == "Skill" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.42, 0.55, 0.85, 1)
|
|
||||||
else
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.46, 0.68, 0.52, 1)
|
|
||||||
end
|
|
||||||
end`, [
|
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||||
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
||||||
]),
|
]),
|
||||||
@@ -2167,25 +2151,7 @@ for i = 1, 120 do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end`),
|
end`),
|
||||||
method('ApplyAllDeckCardVisual', `local cards = self.Cards or {}
|
method('ApplyAllDeckCardVisual', `self:ApplyCardFace("/ui/DefaultGroup/DeckAllHud/Grid/Card" .. tostring(slot), cardId)`, [
|
||||||
local c = cards[cardId]
|
|
||||||
if c == nil then
|
|
||||||
c = { name = cardId, cost = 0, desc = "", kind = "Skill" }
|
|
||||||
end
|
|
||||||
local base = "/ui/DefaultGroup/DeckAllHud/Grid/Card" .. tostring(slot)
|
|
||||||
self:SetText(base .. "/Cost", tostring(c.cost))
|
|
||||||
self:SetText(base .. "/Name", c.name)
|
|
||||||
self:SetText(base .. "/Desc", c.desc)
|
|
||||||
local e = _EntityService:GetEntityByPath(base)
|
|
||||||
if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
|
|
||||||
if c.kind == "Attack" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
|
||||||
elseif c.kind == "Skill" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.42, 0.55, 0.85, 1)
|
|
||||||
else
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.46, 0.68, 0.52, 1)
|
|
||||||
end
|
|
||||||
end`, [
|
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||||
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
||||||
]),
|
]),
|
||||||
@@ -2206,23 +2172,38 @@ for i = 1, 5 do
|
|||||||
\tend
|
\tend
|
||||||
end
|
end
|
||||||
self:RenderPiles()`, [{ Type: 'boolean', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'animate' }]),
|
self:RenderPiles()`, [{ Type: 'boolean', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'animate' }]),
|
||||||
method('ApplyCardVisual', `local c = self.Cards[cardId]
|
method('ApplyCardFace', `local c = self.Cards[cardId]
|
||||||
if c == nil then
|
if c == nil then
|
||||||
c = { name = cardId, cost = 0, desc = "", kind = "Skill" }
|
c = { name = cardId, cost = 0, desc = "", kind = "Skill" }
|
||||||
end
|
end
|
||||||
self:SetText("/ui/DefaultGroup/CardHand/Card" .. tostring(slot) .. "/Cost", tostring(c.cost))
|
local e = _EntityService:GetEntityByPath(base)
|
||||||
self:SetText("/ui/DefaultGroup/CardHand/Card" .. tostring(slot) .. "/Name", c.name)
|
if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
|
||||||
self:SetText("/ui/DefaultGroup/CardHand/Card" .. tostring(slot) .. "/Desc", c.desc)
|
|
||||||
local cardEntity = _EntityService:GetEntityByPath("/ui/DefaultGroup/CardHand/Card" .. tostring(slot))
|
|
||||||
if cardEntity ~= nil and cardEntity.SpriteGUIRendererComponent ~= nil then
|
|
||||||
if c.kind == "Attack" then
|
if c.kind == "Attack" then
|
||||||
cardEntity.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
e.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
||||||
elseif c.kind == "Skill" then
|
elseif c.kind == "Skill" then
|
||||||
cardEntity.SpriteGUIRendererComponent.Color = Color(0.42, 0.55, 0.85, 1)
|
e.SpriteGUIRendererComponent.Color = Color(0.42, 0.55, 0.85, 1)
|
||||||
else
|
else
|
||||||
cardEntity.SpriteGUIRendererComponent.Color = Color(0.46, 0.68, 0.52, 1)
|
e.SpriteGUIRendererComponent.Color = Color(0.46, 0.68, 0.52, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:SetText(base .. "/Cost", string.format("%d", c.cost))
|
||||||
|
self:SetText(base .. "/Name", c.name)
|
||||||
|
self:SetText(base .. "/Desc", c.desc)
|
||||||
|
local art = _EntityService:GetEntityByPath(base .. "/Art")
|
||||||
|
if art ~= nil then
|
||||||
|
if c.image ~= nil and c.image ~= "" then
|
||||||
|
art.Enable = true
|
||||||
|
if art.SpriteGUIRendererComponent ~= nil then
|
||||||
|
art.SpriteGUIRendererComponent.ImageRUID = c.image
|
||||||
|
end
|
||||||
|
else
|
||||||
|
art.Enable = false
|
||||||
end
|
end
|
||||||
end`, [
|
end`, [
|
||||||
|
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'base' },
|
||||||
|
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
||||||
|
]),
|
||||||
|
method('ApplyCardVisual', `self:ApplyCardFace("/ui/DefaultGroup/CardHand/Card" .. tostring(slot), cardId)`, [
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||||
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
||||||
]),
|
]),
|
||||||
@@ -2473,24 +2454,7 @@ local hud = _EntityService:GetEntityByPath("/ui/DefaultGroup/RewardHud")
|
|||||||
if hud ~= nil then
|
if hud ~= nil then
|
||||||
hud.Enable = true
|
hud.Enable = true
|
||||||
end`),
|
end`),
|
||||||
method('ApplyRewardVisual', `local c = self.Cards[cardId]
|
method('ApplyRewardVisual', `self:ApplyCardFace("/ui/DefaultGroup/RewardHud/Reward" .. tostring(slot), cardId)`, [
|
||||||
if c == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local base = "/ui/DefaultGroup/RewardHud/Reward" .. tostring(slot)
|
|
||||||
self:SetText(base .. "/Name", c.name)
|
|
||||||
self:SetText(base .. "/Cost", tostring(c.cost))
|
|
||||||
self:SetText(base .. "/Desc", c.desc)
|
|
||||||
local e = _EntityService:GetEntityByPath(base)
|
|
||||||
if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
|
|
||||||
if c.kind == "Attack" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
|
||||||
elseif c.kind == "Skill" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.42, 0.55, 0.85, 1)
|
|
||||||
else
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.46, 0.68, 0.52, 1)
|
|
||||||
end
|
|
||||||
end`, [
|
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||||
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
{ Type: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
||||||
]),
|
]),
|
||||||
@@ -2623,20 +2587,12 @@ for i = 1, 3 do
|
|||||||
local c = self.Cards[cid]
|
local c = self.Cards[cid]
|
||||||
local base = "/ui/DefaultGroup/ShopHud/Card" .. tostring(i)
|
local base = "/ui/DefaultGroup/ShopHud/Card" .. tostring(i)
|
||||||
if c ~= nil then
|
if c ~= nil then
|
||||||
self:SetText(base .. "/Name", c.name)
|
self:ApplyCardFace(base, cid)
|
||||||
self:SetText(base .. "/Cost", tostring(c.cost))
|
|
||||||
self:SetText(base .. "/Desc", c.desc)
|
|
||||||
self:SetText(base .. "/Price", string.format("%d", ${CARD_PRICE}) .. " 골드")
|
self:SetText(base .. "/Price", string.format("%d", ${CARD_PRICE}) .. " 골드")
|
||||||
local e = _EntityService:GetEntityByPath(base)
|
local e = _EntityService:GetEntityByPath(base)
|
||||||
if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
|
if e ~= nil and e.SpriteGUIRendererComponent ~= nil then
|
||||||
if self.ShopBought[i] == true then
|
if self.ShopBought[i] == true then
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.2, 0.22, 0.26, 0.6)
|
e.SpriteGUIRendererComponent.Color = Color(0.2, 0.22, 0.26, 0.6)
|
||||||
elseif c.kind == "Attack" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
|
||||||
elseif c.kind == "Skill" then
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.42, 0.55, 0.85, 1)
|
|
||||||
else
|
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.46, 0.68, 0.52, 1)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user