Merge pull request '전투 카드 대상 표시 개선' (#117) from codex/combat-target-indicators into main
Reviewed-on: #117
This commit was merged in pull request #117.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -165,16 +165,58 @@ for i = 1, #self.Monsters do
|
||||
end
|
||||
end
|
||||
return best`, [{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' }], 0, 'number'),
|
||||
method('RenderTargetFrames', `local dragActive = self.DragTargetIndex ~= nil and self.DragTargetIndex > 0
|
||||
local shownTarget = self.TargetIndex
|
||||
if dragActive == true then shownTarget = self.DragTargetIndex end
|
||||
for i = 1, #self.Monsters do
|
||||
local m = self.Monsters[i]
|
||||
local active = false
|
||||
if m ~= nil and m.alive == true and i == shownTarget then active = true end
|
||||
self:SetEntityEnabled("/ui/RunUIGroup/CombatHud/MonsterStatus" .. self:IntStr(i) .. "/TargetMarker", active and dragActive)
|
||||
self:SetEntityEnabled("/ui/RunUIGroup/CombatHud/MonsterStatus" .. self:IntStr(i) .. "/TargetMarker/Label", active and dragActive)
|
||||
end`),
|
||||
method('GetCardTargetMode', `if card == nil then
|
||||
return "none"
|
||||
end
|
||||
local shivAoe = card.class == "shiv" and (self.ShivAoeThisCombat == true or self:HasPowerField("shivAoe") == true)
|
||||
if card.aoe == true or card.affectsAllEnemies == true or shivAoe then
|
||||
return "all"
|
||||
end
|
||||
if card.kind == "Attack" then
|
||||
return "single"
|
||||
end
|
||||
if card.weak ~= nil or card.vuln ~= nil or card.poison ~= nil or card.xWeakPerEnergy ~= nil or card.removeEnemyBlock == true or card.removeEnemyArtifact == true or (card.enemyStrengthLossThisTurn ~= nil and card.enemyStrengthLossThisTurn > 0) then
|
||||
return "single"
|
||||
end
|
||||
return "player"`, [{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'card' }]),
|
||||
method('GetDragTargetMode', `if self.DragSlot == nil or self.DragSlot <= 0 or self.Hand == nil or self.Cards == nil then
|
||||
return "none"
|
||||
end
|
||||
return self:GetCardTargetMode(self.Cards[self.Hand[self.DragSlot]])`),
|
||||
method('RenderPlayerTargetPreview', `local panel = _EntityService:GetEntityByPath("/ui/RunUIGroup/CombatHud/PlayerPanel")
|
||||
if panel ~= nil and panel.UITransformComponent ~= nil then
|
||||
if active == true then
|
||||
panel.UITransformComponent.UIScale = Vector3(1.06, 1.06, 1)
|
||||
else
|
||||
panel.UITransformComponent.UIScale = Vector3(1, 1, 1)
|
||||
end
|
||||
end
|
||||
local name = _EntityService:GetEntityByPath("/ui/RunUIGroup/CombatHud/PlayerPanel/Name")
|
||||
if name ~= nil and name.TextComponent ~= nil then
|
||||
if active == true then
|
||||
name.TextComponent.FontColor = Color(1, 0.84, 0.3, 1)
|
||||
else
|
||||
name.TextComponent.FontColor = Color(1, 1, 1, 1)
|
||||
end
|
||||
end
|
||||
local marker = _EntityService:GetEntityByPath("/ui/RunUIGroup/CombatHud/PlayerTargetMarker")
|
||||
local player = _UserService.LocalPlayer
|
||||
if active == true and marker ~= nil and player ~= nil and player.TransformComponent ~= nil then
|
||||
if marker.SpriteGUIRendererComponent ~= nil then
|
||||
marker.SpriteGUIRendererComponent.ImageRUID = "f86110df71ce48dbbcbc8d38bd1076ad"
|
||||
marker.SpriteGUIRendererComponent.AnimClipPlayType = SpriteAnimClipPlayType.Loop
|
||||
marker.SpriteGUIRendererComponent.PlayRate = 1
|
||||
end
|
||||
if marker.UITransformComponent ~= nil then
|
||||
local worldPos = player.TransformComponent.WorldPosition
|
||||
local screenPos = _UILogic:WorldToScreenPosition(Vector2(worldPos.x, worldPos.y + 1.15))
|
||||
marker.UITransformComponent.anchoredPosition = _UILogic:ScreenToUIPosition(screenPos)
|
||||
end
|
||||
marker.Enable = true
|
||||
elseif marker ~= nil then
|
||||
marker.Enable = false
|
||||
end`, [{ Type: 'boolean', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'active' }]),
|
||||
method('RenderTargetFrames', `self:RenderCombat()`),
|
||||
method('OnCardDragBegin', `if self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then
|
||||
return
|
||||
end
|
||||
@@ -194,13 +236,16 @@ for i = 1, 10 do
|
||||
end
|
||||
self.DragSlot = slot
|
||||
self.DragTargetIndex = 0
|
||||
self.DragCanPlay = false
|
||||
self:RenderTargetFrames()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
|
||||
method('OnCardDrag', `if self.DragSlot ~= slot then
|
||||
return
|
||||
end
|
||||
local oldTarget = self.DragTargetIndex
|
||||
local oldCanPlay = self.DragCanPlay
|
||||
local ui = _UILogic:ScreenToUIPosition(touchPoint)
|
||||
local e = _EntityService:GetEntityByPath("/ui/RunUIGroup/CardHand/Card" .. self:IntStr(slot))
|
||||
if e ~= nil and e.UITransformComponent ~= nil then
|
||||
local ui = _UILogic:ScreenToUIPosition(touchPoint)
|
||||
e.UITransformComponent.anchoredPosition = Vector2(ui.x, ui.y + 360)
|
||||
end
|
||||
local cardId = self.Hand[slot]
|
||||
@@ -210,8 +255,13 @@ if c ~= nil and c.kind == "Attack" then
|
||||
local best = self:FindMonsterAtTouch(touchPoint)
|
||||
if best ~= self.DragTargetIndex then
|
||||
self.DragTargetIndex = best
|
||||
self:RenderTargetFrames()
|
||||
end
|
||||
self.DragCanPlay = self.DragTargetIndex > 0
|
||||
else
|
||||
self.DragCanPlay = ui.y > -180
|
||||
end
|
||||
if oldTarget ~= self.DragTargetIndex or oldCanPlay ~= self.DragCanPlay then
|
||||
self:RenderTargetFrames()
|
||||
end`, [
|
||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' },
|
||||
@@ -220,6 +270,7 @@ end`, [
|
||||
return
|
||||
end
|
||||
self.DragSlot = 0
|
||||
self.DragCanPlay = false
|
||||
local e = _EntityService:GetEntityByPath("/ui/RunUIGroup/CardHand/Card" .. self:IntStr(slot))
|
||||
if e ~= nil and e.UITransformComponent ~= nil then
|
||||
e.UITransformComponent.anchoredPosition = Vector2(self:GetHandSlotX(slot), 0)
|
||||
|
||||
@@ -14,7 +14,12 @@ return table.concat(parts, " ")`, [
|
||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'vuln' },
|
||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'poison' },
|
||||
], 0, 'string'),
|
||||
method('RenderCombat', `for i = 1, ${MAX_MONSTERS} do
|
||||
method('RenderCombat', `local targetMode = self:GetDragTargetMode()
|
||||
local targetMarkerRuid = "f86110df71ce48dbbcbc8d38bd1076ad"
|
||||
local shownTarget = self.TargetIndex
|
||||
if self.DragTargetIndex ~= nil and self.DragTargetIndex > 0 then shownTarget = self.DragTargetIndex end
|
||||
if self.DragCanPlay ~= true then targetMode = "none" end
|
||||
for i = 1, ${MAX_MONSTERS} do
|
||||
local base = "/ui/RunUIGroup/CombatHud/MonsterStatus" .. self:IntStr(i)
|
||||
local m = self.Monsters[i]
|
||||
if m ~= nil and m.alive == true then
|
||||
@@ -38,11 +43,17 @@ return table.concat(parts, " ")`, [
|
||||
end
|
||||
end
|
||||
self:SetText(base .. "/Intent", t)
|
||||
local dragActive = self.DragTargetIndex ~= nil and self.DragTargetIndex > 0
|
||||
local shownTarget = self.TargetIndex
|
||||
if dragActive == true then shownTarget = self.DragTargetIndex end
|
||||
self:SetEntityEnabled(base .. "/TargetMarker", i == shownTarget and dragActive)
|
||||
self:SetEntityEnabled(base .. "/TargetMarker/Label", i == shownTarget and dragActive)
|
||||
local targeted = targetMode == "all" or (targetMode == "single" and i == shownTarget)
|
||||
self:SetEntityEnabled(base .. "/TargetMarker", targeted)
|
||||
self:SetEntityEnabled(base .. "/TargetMarker/Label", targeted)
|
||||
if targeted == true then
|
||||
local marker = _EntityService:GetEntityByPath(base .. "/TargetMarker")
|
||||
if marker ~= nil and marker.SpriteGUIRendererComponent ~= nil then
|
||||
marker.SpriteGUIRendererComponent.ImageRUID = targetMarkerRuid
|
||||
marker.SpriteGUIRendererComponent.AnimClipPlayType = SpriteAnimClipPlayType.Loop
|
||||
marker.SpriteGUIRendererComponent.PlayRate = 1
|
||||
end
|
||||
end
|
||||
local intentEntity = _EntityService:GetEntityByPath(base .. "/Intent")
|
||||
if intentEntity ~= nil and intentEntity.TextComponent ~= nil and intent ~= nil then
|
||||
if intent.kind == "Attack" then
|
||||
@@ -98,6 +109,7 @@ if self.PlayerPowers ~= nil and #self.PlayerPowers > 0 then
|
||||
pb = pb .. table.concat(names, " ")
|
||||
end
|
||||
self:SetText("/ui/RunUIGroup/CombatHud/PlayerPanel/Buffs", pb)
|
||||
self:RenderPlayerTargetPreview(targetMode == "player")
|
||||
self:RenderRun()`),
|
||||
method('ShowDmgPop', `local slotKey = string.format("%d", math.floor(slot or 0))
|
||||
if self.DmgPopSlotQueue == nil then
|
||||
|
||||
@@ -109,6 +109,7 @@ self.DmgPopSeq = 0
|
||||
self.CombatCameraShakeSeq = 0
|
||||
self.DmgPopSlotQueue = {}
|
||||
self.PlayerDmgPopIndex = 0
|
||||
self.DragCanPlay = false
|
||||
self.FirstHpLossDone = false
|
||||
self.ClayBlockNext = 0
|
||||
self.DiscardSelectRemaining = 0
|
||||
|
||||
@@ -121,6 +121,7 @@ function writeCodeblocks() {
|
||||
prop('boolean', 'ShopRelicBought', 'false'),
|
||||
prop('number', 'DragSlot', '0'),
|
||||
prop('number', 'DragTargetIndex', '0'),
|
||||
prop('boolean', 'DragCanPlay', 'false'),
|
||||
prop('boolean', 'FxBusy', 'false'),
|
||||
prop('boolean', 'TurnBusy', 'false'),
|
||||
prop('number', 'PlayerStr', '0'),
|
||||
|
||||
Reference in New Issue
Block a user