Merge pull request 'Add all deck popup' from feature/deck-pile-inspector
This commit is contained in:
@@ -113,6 +113,20 @@
|
|||||||
"Attributes": [],
|
"Attributes": [],
|
||||||
"Name": "DeckInspectCloseHandler"
|
"Name": "DeckInspectCloseHandler"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Type": "any",
|
||||||
|
"DefaultValue": "nil",
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "AllDeckHandler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "any",
|
||||||
|
"DefaultValue": "nil",
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "AllDeckCloseHandler"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Type": "string",
|
"Type": "string",
|
||||||
"DefaultValue": "\"\"",
|
"DefaultValue": "\"\"",
|
||||||
@@ -120,6 +134,13 @@
|
|||||||
"Attributes": [],
|
"Attributes": [],
|
||||||
"Name": "DeckInspectKind"
|
"Name": "DeckInspectKind"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Type": "boolean",
|
||||||
|
"DefaultValue": "false",
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "DeckAllOpen"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Type": "any",
|
"Type": "any",
|
||||||
"DefaultValue": "nil",
|
"DefaultValue": "nil",
|
||||||
@@ -477,7 +498,7 @@
|
|||||||
"Name": null
|
"Name": null
|
||||||
},
|
},
|
||||||
"Arguments": [],
|
"Arguments": [],
|
||||||
"Code": "local endTurn = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckHud/EndTurnButton\")\nif endTurn ~= nil and endTurn.ButtonComponent ~= nil then\n\tif self.EndTurnHandler ~= nil then\n\t\tendTurn:DisconnectEvent(ButtonClickEvent, self.EndTurnHandler)\n\t\tself.EndTurnHandler = nil\n\tend\n\tself.EndTurnHandler = endTurn:ConnectEvent(ButtonClickEvent, function() self:EndPlayerTurn() end)\nend\nlocal drawPile = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckHud/DrawPile\")\nif drawPile ~= nil and drawPile.ButtonComponent ~= nil then\n\tif self.DrawPileHandler ~= nil then\n\t\tdrawPile:DisconnectEvent(ButtonClickEvent, self.DrawPileHandler)\n\t\tself.DrawPileHandler = nil\n\tend\n\tself.DrawPileHandler = drawPile:ConnectEvent(ButtonClickEvent, function() self:OpenDeckInspect(\"draw\") end)\nend\nlocal discardPile = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckHud/DiscardPile\")\nif discardPile ~= nil and discardPile.ButtonComponent ~= nil then\n\tif self.DiscardPileHandler ~= nil then\n\t\tdiscardPile:DisconnectEvent(ButtonClickEvent, self.DiscardPileHandler)\n\t\tself.DiscardPileHandler = nil\n\tend\n\tself.DiscardPileHandler = discardPile:ConnectEvent(ButtonClickEvent, function() self:OpenDeckInspect(\"discard\") end)\nend\nlocal inspectClose = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckInspectHud/Close\")\nif inspectClose ~= nil and inspectClose.ButtonComponent ~= nil then\n\tif self.DeckInspectCloseHandler ~= nil then\n\t\tinspectClose:DisconnectEvent(ButtonClickEvent, self.DeckInspectCloseHandler)\n\t\tself.DeckInspectCloseHandler = nil\n\tend\n\tself.DeckInspectCloseHandler = inspectClose:ConnectEvent(ButtonClickEvent, function() self:CloseDeckInspect() end)\nend\nfor i = 1, 5 do\n\tlocal cardEntity = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CardHand/Card\" .. tostring(i))\n\tif cardEntity ~= nil and cardEntity.ButtonComponent ~= nil then\n\t\tcardEntity:ConnectEvent(ButtonClickEvent, function() self:PlayCard(i) end)\n\tend\nend\nfor i = 1, 3 do\n\tlocal rc = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/RewardHud/Reward\" .. tostring(i))\n\tif rc ~= nil and rc.ButtonComponent ~= nil then\n\t\trc:ConnectEvent(ButtonClickEvent, function() self:PickReward(i) end)\n\tend\nend\nlocal skip = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/RewardHud/Skip\")\nif skip ~= nil and skip.ButtonComponent ~= nil then\n\tskip:ConnectEvent(ButtonClickEvent, function() self:PickReward(0) end)\nend\nlocal mapNodeIds = { \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"BOSS\" }\nfor i = 1, #mapNodeIds do\n\tlocal nid = mapNodeIds[i]\n\tlocal mn = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/MapHud/Node_\" .. nid)\n\tif mn ~= nil and mn.ButtonComponent ~= nil then\n\t\tmn:ConnectEvent(ButtonClickEvent, function() self:PickNode(nid) end)\n\tend\nend\nfor i = 1, 3 do\n\tlocal sc = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/ShopHud/Card\" .. tostring(i))\n\tif sc ~= nil and sc.ButtonComponent ~= nil then\n\t\tsc:ConnectEvent(ButtonClickEvent, function() self:BuyCard(i) end)\n\tend\nend\nlocal shopLeave = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/ShopHud/Leave\")\nif shopLeave ~= nil and shopLeave.ButtonComponent ~= nil then\n\tshopLeave:ConnectEvent(ButtonClickEvent, function() self:LeaveNode() end)\nend\nlocal shopRelic = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/ShopHud/Relic\")\nif shopRelic ~= nil and shopRelic.ButtonComponent ~= nil then\n\tshopRelic:ConnectEvent(ButtonClickEvent, function() self:BuyRelic() end)\nend\nlocal restLeave = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/RestHud/Leave\")\nif restLeave ~= nil and restLeave.ButtonComponent ~= nil then\n\trestLeave:ConnectEvent(ButtonClickEvent, function() self:LeaveNode() end)\nend",
|
"Code": "local endTurn = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckHud/EndTurnButton\")\nif endTurn ~= nil and endTurn.ButtonComponent ~= nil then\n\tif self.EndTurnHandler ~= nil then\n\t\tendTurn:DisconnectEvent(ButtonClickEvent, self.EndTurnHandler)\n\t\tself.EndTurnHandler = nil\n\tend\n\tself.EndTurnHandler = endTurn:ConnectEvent(ButtonClickEvent, function() self:EndPlayerTurn() end)\nend\nlocal drawPile = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckHud/DrawPile\")\nif drawPile ~= nil and drawPile.ButtonComponent ~= nil then\n\tif self.DrawPileHandler ~= nil then\n\t\tdrawPile:DisconnectEvent(ButtonClickEvent, self.DrawPileHandler)\n\t\tself.DrawPileHandler = nil\n\tend\n\tself.DrawPileHandler = drawPile:ConnectEvent(ButtonClickEvent, function() self:OpenDeckInspect(\"draw\") end)\nend\nlocal discardPile = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckHud/DiscardPile\")\nif discardPile ~= nil and discardPile.ButtonComponent ~= nil then\n\tif self.DiscardPileHandler ~= nil then\n\t\tdiscardPile:DisconnectEvent(ButtonClickEvent, self.DiscardPileHandler)\n\t\tself.DiscardPileHandler = nil\n\tend\n\tself.DiscardPileHandler = discardPile:ConnectEvent(ButtonClickEvent, function() self:OpenDeckInspect(\"discard\") end)\nend\nlocal inspectClose = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckInspectHud/Close\")\nif inspectClose ~= nil and inspectClose.ButtonComponent ~= nil then\n\tif self.DeckInspectCloseHandler ~= nil then\n\t\tinspectClose:DisconnectEvent(ButtonClickEvent, self.DeckInspectCloseHandler)\n\t\tself.DeckInspectCloseHandler = nil\n\tend\n\tself.DeckInspectCloseHandler = inspectClose:ConnectEvent(ButtonClickEvent, function() self:CloseDeckInspect() end)\nend\nlocal allDeckButton = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckHud/AllDeckButton\")\nif allDeckButton ~= nil and allDeckButton.ButtonComponent ~= nil then\n\tif self.AllDeckHandler ~= nil then\n\t\tallDeckButton:DisconnectEvent(ButtonClickEvent, self.AllDeckHandler)\n\t\tself.AllDeckHandler = nil\n\tend\n\tself.AllDeckHandler = allDeckButton:ConnectEvent(ButtonClickEvent, function() self:OpenAllDeck() end)\nend\nlocal allDeckClose = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckAllHud/Close\")\nif allDeckClose ~= nil and allDeckClose.ButtonComponent ~= nil then\n\tif self.AllDeckCloseHandler ~= nil then\n\t\tallDeckClose:DisconnectEvent(ButtonClickEvent, self.AllDeckCloseHandler)\n\t\tself.AllDeckCloseHandler = nil\n\tend\n\tself.AllDeckCloseHandler = allDeckClose:ConnectEvent(ButtonClickEvent, function() self:CloseAllDeck() end)\nend\nfor i = 1, 5 do\n\tlocal cardEntity = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/CardHand/Card\" .. tostring(i))\n\tif cardEntity ~= nil and cardEntity.ButtonComponent ~= nil then\n\t\tcardEntity:ConnectEvent(ButtonClickEvent, function() self:PlayCard(i) end)\n\tend\nend\nfor i = 1, 3 do\n\tlocal rc = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/RewardHud/Reward\" .. tostring(i))\n\tif rc ~= nil and rc.ButtonComponent ~= nil then\n\t\trc:ConnectEvent(ButtonClickEvent, function() self:PickReward(i) end)\n\tend\nend\nlocal skip = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/RewardHud/Skip\")\nif skip ~= nil and skip.ButtonComponent ~= nil then\n\tskip:ConnectEvent(ButtonClickEvent, function() self:PickReward(0) end)\nend\nlocal mapNodeIds = { \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"BOSS\" }\nfor i = 1, #mapNodeIds do\n\tlocal nid = mapNodeIds[i]\n\tlocal mn = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/MapHud/Node_\" .. nid)\n\tif mn ~= nil and mn.ButtonComponent ~= nil then\n\t\tmn:ConnectEvent(ButtonClickEvent, function() self:PickNode(nid) end)\n\tend\nend\nfor i = 1, 3 do\n\tlocal sc = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/ShopHud/Card\" .. tostring(i))\n\tif sc ~= nil and sc.ButtonComponent ~= nil then\n\t\tsc:ConnectEvent(ButtonClickEvent, function() self:BuyCard(i) end)\n\tend\nend\nlocal shopLeave = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/ShopHud/Leave\")\nif shopLeave ~= nil and shopLeave.ButtonComponent ~= nil then\n\tshopLeave:ConnectEvent(ButtonClickEvent, function() self:LeaveNode() end)\nend\nlocal shopRelic = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/ShopHud/Relic\")\nif shopRelic ~= nil and shopRelic.ButtonComponent ~= nil then\n\tshopRelic:ConnectEvent(ButtonClickEvent, function() self:BuyRelic() end)\nend\nlocal restLeave = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/RestHud/Leave\")\nif restLeave ~= nil and restLeave.ButtonComponent ~= nil then\n\trestLeave:ConnectEvent(ButtonClickEvent, function() self:LeaveNode() end)\nend",
|
||||||
"Scope": 2,
|
"Scope": 2,
|
||||||
"ExecSpace": 6,
|
"ExecSpace": 6,
|
||||||
"Attributes": [],
|
"Attributes": [],
|
||||||
@@ -664,6 +685,81 @@
|
|||||||
"Attributes": [],
|
"Attributes": [],
|
||||||
"Name": "ApplyInspectCardVisual"
|
"Name": "ApplyInspectCardVisual"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Return": {
|
||||||
|
"Type": "void",
|
||||||
|
"DefaultValue": null,
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": null
|
||||||
|
},
|
||||||
|
"Arguments": [],
|
||||||
|
"Code": "local inspectHud = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckInspectHud\")\nif inspectHud ~= nil then\n\tinspectHud.Enable = false\nend\nself.DeckInspectKind = \"\"\nself.DeckAllOpen = true\nself:RenderAllDeck()\nlocal hud = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckAllHud\")\nif hud ~= nil then\n\thud.Enable = true\nend",
|
||||||
|
"Scope": 2,
|
||||||
|
"ExecSpace": 6,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "OpenAllDeck"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Return": {
|
||||||
|
"Type": "void",
|
||||||
|
"DefaultValue": null,
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": null
|
||||||
|
},
|
||||||
|
"Arguments": [],
|
||||||
|
"Code": "self.DeckAllOpen = false\nlocal hud = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckAllHud\")\nif hud ~= nil then\n\thud.Enable = false\nend",
|
||||||
|
"Scope": 2,
|
||||||
|
"ExecSpace": 6,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "CloseAllDeck"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Return": {
|
||||||
|
"Type": "void",
|
||||||
|
"DefaultValue": null,
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": null
|
||||||
|
},
|
||||||
|
"Arguments": [],
|
||||||
|
"Code": "local pile = self.RunDeck or {}\nlocal count = #pile\nself:SetText(\"/ui/DefaultGroup/DeckAllHud/Title\", \"모든 덱 (\" .. tostring(count) .. \")\")\nlocal empty = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckAllHud/Empty\")\nif empty ~= nil then\n\tempty.Enable = count <= 0\nend\nfor i = 1, 120 do\n\tlocal e = _EntityService:GetEntityByPath(\"/ui/DefaultGroup/DeckAllHud/Grid/Card\" .. tostring(i))\n\tif e ~= nil then\n\t\tlocal cardId = pile[i]\n\t\tif cardId == nil then\n\t\t\te.Enable = false\n\t\telse\n\t\t\te.Enable = true\n\t\t\tself:ApplyAllDeckCardVisual(i, cardId)\n\t\tend\n\tend\nend",
|
||||||
|
"Scope": 2,
|
||||||
|
"ExecSpace": 6,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "RenderAllDeck"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Return": {
|
||||||
|
"Type": "void",
|
||||||
|
"DefaultValue": null,
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": null
|
||||||
|
},
|
||||||
|
"Arguments": [
|
||||||
|
{
|
||||||
|
"Type": "number",
|
||||||
|
"DefaultValue": null,
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "slot"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "string",
|
||||||
|
"DefaultValue": null,
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "cardId"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Code": "local cards = self.Cards or {}\nlocal c = cards[cardId]\nif c == nil then\n\tc = { name = cardId, cost = 0, desc = \"\", kind = \"Skill\" }\nend\nlocal base = \"/ui/DefaultGroup/DeckAllHud/Grid/Card\" .. tostring(slot)\nself:SetText(base .. \"/Cost\", tostring(c.cost))\nself:SetText(base .. \"/Name\", c.name)\nself:SetText(base .. \"/Desc\", c.desc)\nlocal e = _EntityService:GetEntityByPath(base)\nif e ~= nil and e.SpriteGUIRendererComponent ~= nil then\n\tif c.kind == \"Attack\" then\n\t\te.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)\n\telseif c.kind == \"Skill\" then\n\t\te.SpriteGUIRendererComponent.Color = Color(0.42, 0.55, 0.85, 1)\n\telse\n\t\te.SpriteGUIRendererComponent.Color = Color(0.46, 0.68, 0.52, 1)\n\tend\nend",
|
||||||
|
"Scope": 2,
|
||||||
|
"ExecSpace": 6,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "ApplyAllDeckCardVisual"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Return": {
|
"Return": {
|
||||||
"Type": "void",
|
"Type": "void",
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ const ALIGN_BOTTOM_CENTER = 6;
|
|||||||
|
|
||||||
function guid(prefix, n) {
|
function guid(prefix, n) {
|
||||||
// 유효한 8-4-4-4-12 hex GUID 생성. prefix는 충돌 방지용 네임스페이스 바이트로 매핑.
|
// 유효한 8-4-4-4-12 hex GUID 생성. prefix는 충돌 방지용 네임스페이스 바이트로 매핑.
|
||||||
const ns = prefix === 'hud' ? 0xd0 : prefix === 'dck' ? 0xca : prefix === 'cmb' ? 0xcb : prefix === 'rwd' ? 0xcc : prefix === 'map' ? 0xcd : prefix === 'shp' ? 0xce : prefix === 'rst' ? 0xcf : prefix === 'menu' ? 0xe0 : prefix === 'ins' ? 0xe1 : 0xfe;
|
const ns = prefix === 'hud' ? 0xd0 : prefix === 'dck' ? 0xca : prefix === 'cmb' ? 0xcb : prefix === 'rwd' ? 0xcc : prefix === 'map' ? 0xcd : prefix === 'shp' ? 0xce : prefix === 'rst' ? 0xcf : prefix === 'menu' ? 0xe0 : prefix === 'ins' ? 0xe1 : prefix === 'all' ? 0xe2 : 0xfe;
|
||||||
const v = (ns * 0x100000 + n) >>> 0;
|
const v = (ns * 0x100000 + n) >>> 0;
|
||||||
return `${v.toString(16).padStart(8, '0')}-0000-4000-8000-${v.toString(16).padStart(12, '0')}`;
|
return `${v.toString(16).padStart(8, '0')}-0000-4000-8000-${v.toString(16).padStart(12, '0')}`;
|
||||||
}
|
}
|
||||||
@@ -287,7 +287,7 @@ function entity({ id, path, modelId, entryId, componentNames, components, displa
|
|||||||
function upsertUi() {
|
function upsertUi() {
|
||||||
const ui = JSON.parse(readFileSync(UI_FILE, 'utf8'));
|
const ui = JSON.parse(readFileSync(UI_FILE, 'utf8'));
|
||||||
const E = ui.ContentProto.Entities;
|
const E = ui.ContentProto.Entities;
|
||||||
ui.ContentProto.Entities = E.filter((e) => !e.path.startsWith('/ui/DefaultGroup/DeckHud') && !e.path.startsWith('/ui/DefaultGroup/DeckInspectHud') && !e.path.startsWith('/ui/DefaultGroup/CombatHud') && !e.path.startsWith('/ui/DefaultGroup/RewardHud') && !e.path.startsWith('/ui/DefaultGroup/MapHud') && !e.path.startsWith('/ui/DefaultGroup/ShopHud') && !e.path.startsWith('/ui/DefaultGroup/RestHud') && !e.path.startsWith('/ui/DefaultGroup/MainMenu'));
|
ui.ContentProto.Entities = E.filter((e) => !e.path.startsWith('/ui/DefaultGroup/DeckHud') && !e.path.startsWith('/ui/DefaultGroup/DeckInspectHud') && !e.path.startsWith('/ui/DefaultGroup/DeckAllHud') && !e.path.startsWith('/ui/DefaultGroup/CombatHud') && !e.path.startsWith('/ui/DefaultGroup/RewardHud') && !e.path.startsWith('/ui/DefaultGroup/MapHud') && !e.path.startsWith('/ui/DefaultGroup/ShopHud') && !e.path.startsWith('/ui/DefaultGroup/RestHud') && !e.path.startsWith('/ui/DefaultGroup/MainMenu'));
|
||||||
|
|
||||||
const byPath = new Map(ui.ContentProto.Entities.map((e) => [e.path, e]));
|
const byPath = new Map(ui.ContentProto.Entities.map((e) => [e.path, e]));
|
||||||
|
|
||||||
@@ -446,6 +446,21 @@ function upsertUi() {
|
|||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
add(entity({
|
||||||
|
id: guid('hud', hud.length),
|
||||||
|
path: '/ui/DefaultGroup/DeckHud/AllDeckButton',
|
||||||
|
modelId: 'uibutton',
|
||||||
|
entryId: 'UIButton',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent',
|
||||||
|
displayOrder: 4,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 1280, parentH: 330, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 188, y: 58 }, pos: { x: 470, y: 135 }, align: ALIGN_CENTER }),
|
||||||
|
sprite({ color: DARK, type: 1, raycast: true }),
|
||||||
|
button(),
|
||||||
|
text({ value: '모든덱보기', fontSize: 23, bold: true, color: GOLD, alignment: 0 }),
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
|
||||||
ui.ContentProto.Entities.push(...hud);
|
ui.ContentProto.Entities.push(...hud);
|
||||||
|
|
||||||
const inspect = [];
|
const inspect = [];
|
||||||
@@ -570,6 +585,128 @@ function upsertUi() {
|
|||||||
}
|
}
|
||||||
ui.ContentProto.Entities.push(...inspect);
|
ui.ContentProto.Entities.push(...inspect);
|
||||||
|
|
||||||
|
const allDeck = [];
|
||||||
|
const allHud = entity({
|
||||||
|
id: guid('all', 0),
|
||||||
|
path: '/ui/DefaultGroup/DeckAllHud',
|
||||||
|
modelId: 'uisprite',
|
||||||
|
entryId: 'UISprite',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
|
||||||
|
displayOrder: 16,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 1920, y: 1080 }, pos: { x: 0, y: 0 }, align: ALIGN_CENTER }),
|
||||||
|
sprite({ color: { r: 0.04, g: 0.05, b: 0.07, a: 0.78 }, type: 1, raycast: true }),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
allHud.jsonString.enable = false;
|
||||||
|
allDeck.push(allHud);
|
||||||
|
allDeck.push(entity({
|
||||||
|
id: guid('all', 1),
|
||||||
|
path: '/ui/DefaultGroup/DeckAllHud/Panel',
|
||||||
|
modelId: 'uisprite',
|
||||||
|
entryId: 'UISprite',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
|
||||||
|
displayOrder: 0,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 1080, y: 800 }, pos: { x: 0, y: 0 }, align: ALIGN_CENTER }),
|
||||||
|
sprite({ color: { r: 0.08, g: 0.09, b: 0.11, a: 0.96 }, type: 1 }),
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
allDeck.push(entity({
|
||||||
|
id: guid('all', 2),
|
||||||
|
path: '/ui/DefaultGroup/DeckAllHud/Title',
|
||||||
|
modelId: 'uitext',
|
||||||
|
entryId: 'UIText',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||||
|
displayOrder: 1,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 760, y: 54 }, pos: { x: 0, y: 380 } }),
|
||||||
|
sprite({ color: TRANSPARENT }),
|
||||||
|
text({ value: '모든 덱', fontSize: 34, bold: true, color: GOLD, alignment: 4 }),
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
allDeck.push(entity({
|
||||||
|
id: guid('all', 3),
|
||||||
|
path: '/ui/DefaultGroup/DeckAllHud/Close',
|
||||||
|
modelId: 'uibutton',
|
||||||
|
entryId: 'UIButton',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ButtonComponent,MOD.Core.TextComponent',
|
||||||
|
displayOrder: 2,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 78, y: 52 }, pos: { x: 486, y: 380 } }),
|
||||||
|
sprite({ color: { r: 0.16, g: 0.18, b: 0.22, a: 1 }, type: 1, raycast: true }),
|
||||||
|
button(),
|
||||||
|
text({ value: 'X', fontSize: 26, bold: true, color: GOLD, alignment: 4 }),
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
allDeck.push(entity({
|
||||||
|
id: guid('all', 4),
|
||||||
|
path: '/ui/DefaultGroup/DeckAllHud/Empty',
|
||||||
|
modelId: 'uitext',
|
||||||
|
entryId: 'UIText',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||||
|
displayOrder: 3,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 600, y: 50 }, pos: { x: 0, y: 40 } }),
|
||||||
|
sprite({ color: TRANSPARENT }),
|
||||||
|
text({ value: '덱이 없습니다', fontSize: 28, bold: true, color: { r: 0.82, g: 0.86, b: 0.9, a: 1 }, alignment: 4 }),
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
allDeck.push(entity({
|
||||||
|
id: guid('all', 5),
|
||||||
|
path: '/ui/DefaultGroup/DeckAllHud/Grid',
|
||||||
|
modelId: 'uiempty',
|
||||||
|
entryId: 'UIEmpty',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.ScrollLayoutGroupComponent',
|
||||||
|
displayOrder: 4,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 1920, parentH: 1080, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 980, y: 620 }, pos: { x: 0, y: 0 } }),
|
||||||
|
sprite({ color: TRANSPARENT, type: 1, raycast: true }),
|
||||||
|
scrollLayoutGroup({ cellSize: { x: 158, y: 214 }, spacing: { x: 22, y: 22 }, columns: 5 }),
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
let allN = 6;
|
||||||
|
const ALL_DECK_CARD_COUNT = 120;
|
||||||
|
const ALL_DECK_CARD_W = 142;
|
||||||
|
const ALL_DECK_CARD_H = 198;
|
||||||
|
for (let i = 1; i <= ALL_DECK_CARD_COUNT; i++) {
|
||||||
|
const cardPath = `/ui/DefaultGroup/DeckAllHud/Grid/Card${i}`;
|
||||||
|
const card = entity({
|
||||||
|
id: guid('all', allN++),
|
||||||
|
path: cardPath,
|
||||||
|
modelId: 'uisprite',
|
||||||
|
entryId: 'UISprite',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
|
||||||
|
displayOrder: i,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 980, parentH: 620, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: ALL_DECK_CARD_W, y: ALL_DECK_CARD_H }, pos: { x: 0, y: 0 } }),
|
||||||
|
sprite({ color: ATTACK, type: 1 }),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
card.jsonString.enable = false;
|
||||||
|
allDeck.push(card);
|
||||||
|
for (const [suffix, cfg] of [
|
||||||
|
['Cost', { size: { x: 42, y: 38 }, pos: { x: -46, y: 73 }, value: '1', fontSize: 25, bold: true }],
|
||||||
|
['Name', { size: { x: 126, y: 42 }, pos: { x: 0, y: 34 }, value: '', fontSize: 21, bold: true }],
|
||||||
|
['Desc', { size: { x: 126, y: 70 }, pos: { x: 0, y: -58 }, value: '', fontSize: 16, bold: false }],
|
||||||
|
]) {
|
||||||
|
allDeck.push(entity({
|
||||||
|
id: guid('all', allN++),
|
||||||
|
path: `${cardPath}/${suffix}`,
|
||||||
|
modelId: 'uitext',
|
||||||
|
entryId: 'UIText',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||||
|
displayOrder: suffix === 'Cost' ? 0 : suffix === 'Name' ? 1 : 2,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: ALL_DECK_CARD_W, parentH: ALL_DECK_CARD_H, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: cfg.size, pos: cfg.pos }),
|
||||||
|
sprite({ color: TRANSPARENT }),
|
||||||
|
text({ value: cfg.value, fontSize: cfg.fontSize, bold: cfg.bold }),
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui.ContentProto.Entities.push(...allDeck);
|
||||||
|
|
||||||
const PANEL_BG = { r: 0.08, g: 0.09, b: 0.11, a: 0.78 };
|
const PANEL_BG = { r: 0.08, g: 0.09, b: 0.11, a: 0.78 };
|
||||||
const combat = [];
|
const combat = [];
|
||||||
combat.push(entity({
|
combat.push(entity({
|
||||||
@@ -1173,7 +1310,10 @@ function writeCodeblocks() {
|
|||||||
prop('any', 'DrawPileHandler'),
|
prop('any', 'DrawPileHandler'),
|
||||||
prop('any', 'DiscardPileHandler'),
|
prop('any', 'DiscardPileHandler'),
|
||||||
prop('any', 'DeckInspectCloseHandler'),
|
prop('any', 'DeckInspectCloseHandler'),
|
||||||
|
prop('any', 'AllDeckHandler'),
|
||||||
|
prop('any', 'AllDeckCloseHandler'),
|
||||||
prop('string', 'DeckInspectKind', '""'),
|
prop('string', 'DeckInspectKind', '""'),
|
||||||
|
prop('boolean', 'DeckAllOpen', 'false'),
|
||||||
prop('any', 'Cards'),
|
prop('any', 'Cards'),
|
||||||
prop('number', 'PlayerHp', '0'),
|
prop('number', 'PlayerHp', '0'),
|
||||||
prop('number', 'PlayerMaxHp', '80'),
|
prop('number', 'PlayerMaxHp', '80'),
|
||||||
@@ -1309,6 +1449,22 @@ if inspectClose ~= nil and inspectClose.ButtonComponent ~= nil then
|
|||||||
end
|
end
|
||||||
self.DeckInspectCloseHandler = inspectClose:ConnectEvent(ButtonClickEvent, function() self:CloseDeckInspect() end)
|
self.DeckInspectCloseHandler = inspectClose:ConnectEvent(ButtonClickEvent, function() self:CloseDeckInspect() end)
|
||||||
end
|
end
|
||||||
|
local allDeckButton = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckHud/AllDeckButton")
|
||||||
|
if allDeckButton ~= nil and allDeckButton.ButtonComponent ~= nil then
|
||||||
|
if self.AllDeckHandler ~= nil then
|
||||||
|
allDeckButton:DisconnectEvent(ButtonClickEvent, self.AllDeckHandler)
|
||||||
|
self.AllDeckHandler = nil
|
||||||
|
end
|
||||||
|
self.AllDeckHandler = allDeckButton:ConnectEvent(ButtonClickEvent, function() self:OpenAllDeck() 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
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
local cardEntity = _EntityService:GetEntityByPath("/ui/DefaultGroup/CardHand/Card" .. tostring(i))
|
local cardEntity = _EntityService:GetEntityByPath("/ui/DefaultGroup/CardHand/Card" .. tostring(i))
|
||||||
if cardEntity ~= nil and cardEntity.ButtonComponent ~= nil then
|
if cardEntity ~= nil and cardEntity.ButtonComponent ~= nil then
|
||||||
@@ -1460,6 +1616,63 @@ self:SetText(base .. "/Cost", tostring(c.cost))
|
|||||||
self:SetText(base .. "/Name", c.name)
|
self:SetText(base .. "/Name", c.name)
|
||||||
self:SetText(base .. "/Desc", c.desc)
|
self:SetText(base .. "/Desc", c.desc)
|
||||||
local e = _EntityService:GetEntityByPath(base)
|
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: 'string', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'cardId' },
|
||||||
|
]),
|
||||||
|
method('OpenAllDeck', `local inspectHud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckInspectHud")
|
||||||
|
if inspectHud ~= nil then
|
||||||
|
inspectHud.Enable = false
|
||||||
|
end
|
||||||
|
self.DeckInspectKind = ""
|
||||||
|
self.DeckAllOpen = true
|
||||||
|
self:RenderAllDeck()
|
||||||
|
local hud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud")
|
||||||
|
if hud ~= nil then
|
||||||
|
hud.Enable = true
|
||||||
|
end`),
|
||||||
|
method('CloseAllDeck', `self.DeckAllOpen = false
|
||||||
|
local hud = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud")
|
||||||
|
if hud ~= nil then
|
||||||
|
hud.Enable = false
|
||||||
|
end`),
|
||||||
|
method('RenderAllDeck', `local pile = self.RunDeck or {}
|
||||||
|
local count = #pile
|
||||||
|
self:SetText("/ui/DefaultGroup/DeckAllHud/Title", "모든 덱 (" .. tostring(count) .. ")")
|
||||||
|
local empty = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud/Empty")
|
||||||
|
if empty ~= nil then
|
||||||
|
empty.Enable = count <= 0
|
||||||
|
end
|
||||||
|
for i = 1, 120 do
|
||||||
|
local e = _EntityService:GetEntityByPath("/ui/DefaultGroup/DeckAllHud/Grid/Card" .. tostring(i))
|
||||||
|
if e ~= nil then
|
||||||
|
local cardId = pile[i]
|
||||||
|
if cardId == nil then
|
||||||
|
e.Enable = false
|
||||||
|
else
|
||||||
|
e.Enable = true
|
||||||
|
self:ApplyAllDeckCardVisual(i, cardId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end`),
|
||||||
|
method('ApplyAllDeckCardVisual', `local cards = self.Cards or {}
|
||||||
|
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 e ~= nil and e.SpriteGUIRendererComponent ~= nil then
|
||||||
if c.kind == "Attack" then
|
if c.kind == "Attack" then
|
||||||
e.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
e.SpriteGUIRendererComponent.Color = Color(0.86, 0.42, 0.38, 1)
|
||||||
|
|||||||
85923
ui/DefaultGroup.ui
85923
ui/DefaultGroup.ui
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user