전투 카드 대상 표시 개선
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
|
||||||
end
|
end
|
||||||
return best`, [{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' }], 0, 'number'),
|
return best`, [{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' }], 0, 'number'),
|
||||||
method('RenderTargetFrames', `local dragActive = self.DragTargetIndex ~= nil and self.DragTargetIndex > 0
|
method('GetCardTargetMode', `if card == nil then
|
||||||
local shownTarget = self.TargetIndex
|
return "none"
|
||||||
if dragActive == true then shownTarget = self.DragTargetIndex end
|
end
|
||||||
for i = 1, #self.Monsters do
|
local shivAoe = card.class == "shiv" and (self.ShivAoeThisCombat == true or self:HasPowerField("shivAoe") == true)
|
||||||
local m = self.Monsters[i]
|
if card.aoe == true or card.affectsAllEnemies == true or shivAoe then
|
||||||
local active = false
|
return "all"
|
||||||
if m ~= nil and m.alive == true and i == shownTarget then active = true end
|
end
|
||||||
self:SetEntityEnabled("/ui/RunUIGroup/CombatHud/MonsterStatus" .. self:IntStr(i) .. "/TargetMarker", active and dragActive)
|
if card.kind == "Attack" then
|
||||||
self:SetEntityEnabled("/ui/RunUIGroup/CombatHud/MonsterStatus" .. self:IntStr(i) .. "/TargetMarker/Label", active and dragActive)
|
return "single"
|
||||||
end`),
|
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
|
method('OnCardDragBegin', `if self.CombatOver == true or self.FxBusy == true or self.TurnBusy == true then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -194,13 +236,16 @@ for i = 1, 10 do
|
|||||||
end
|
end
|
||||||
self.DragSlot = slot
|
self.DragSlot = slot
|
||||||
self.DragTargetIndex = 0
|
self.DragTargetIndex = 0
|
||||||
|
self.DragCanPlay = false
|
||||||
self:RenderTargetFrames()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
|
self:RenderTargetFrames()`, [{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' }]),
|
||||||
method('OnCardDrag', `if self.DragSlot ~= slot then
|
method('OnCardDrag', `if self.DragSlot ~= slot then
|
||||||
return
|
return
|
||||||
end
|
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))
|
local e = _EntityService:GetEntityByPath("/ui/RunUIGroup/CardHand/Card" .. self:IntStr(slot))
|
||||||
if e ~= nil and e.UITransformComponent ~= nil then
|
if e ~= nil and e.UITransformComponent ~= nil then
|
||||||
local ui = _UILogic:ScreenToUIPosition(touchPoint)
|
|
||||||
e.UITransformComponent.anchoredPosition = Vector2(ui.x, ui.y + 360)
|
e.UITransformComponent.anchoredPosition = Vector2(ui.x, ui.y + 360)
|
||||||
end
|
end
|
||||||
local cardId = self.Hand[slot]
|
local cardId = self.Hand[slot]
|
||||||
@@ -210,8 +255,13 @@ if c ~= nil and c.kind == "Attack" then
|
|||||||
local best = self:FindMonsterAtTouch(touchPoint)
|
local best = self:FindMonsterAtTouch(touchPoint)
|
||||||
if best ~= self.DragTargetIndex then
|
if best ~= self.DragTargetIndex then
|
||||||
self.DragTargetIndex = best
|
self.DragTargetIndex = best
|
||||||
self:RenderTargetFrames()
|
|
||||||
end
|
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`, [
|
end`, [
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||||
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' },
|
{ Type: 'any', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'touchPoint' },
|
||||||
@@ -220,6 +270,7 @@ end`, [
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.DragSlot = 0
|
self.DragSlot = 0
|
||||||
|
self.DragCanPlay = false
|
||||||
local e = _EntityService:GetEntityByPath("/ui/RunUIGroup/CardHand/Card" .. self:IntStr(slot))
|
local e = _EntityService:GetEntityByPath("/ui/RunUIGroup/CardHand/Card" .. self:IntStr(slot))
|
||||||
if e ~= nil and e.UITransformComponent ~= nil then
|
if e ~= nil and e.UITransformComponent ~= nil then
|
||||||
e.UITransformComponent.anchoredPosition = Vector2(self:GetHandSlotX(slot), 0)
|
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: 'vuln' },
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'poison' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'poison' },
|
||||||
], 0, 'string'),
|
], 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 base = "/ui/RunUIGroup/CombatHud/MonsterStatus" .. self:IntStr(i)
|
||||||
local m = self.Monsters[i]
|
local m = self.Monsters[i]
|
||||||
if m ~= nil and m.alive == true then
|
if m ~= nil and m.alive == true then
|
||||||
@@ -38,11 +43,17 @@ return table.concat(parts, " ")`, [
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:SetText(base .. "/Intent", t)
|
self:SetText(base .. "/Intent", t)
|
||||||
local dragActive = self.DragTargetIndex ~= nil and self.DragTargetIndex > 0
|
local targeted = targetMode == "all" or (targetMode == "single" and i == shownTarget)
|
||||||
local shownTarget = self.TargetIndex
|
self:SetEntityEnabled(base .. "/TargetMarker", targeted)
|
||||||
if dragActive == true then shownTarget = self.DragTargetIndex end
|
self:SetEntityEnabled(base .. "/TargetMarker/Label", targeted)
|
||||||
self:SetEntityEnabled(base .. "/TargetMarker", i == shownTarget and dragActive)
|
if targeted == true then
|
||||||
self:SetEntityEnabled(base .. "/TargetMarker/Label", i == shownTarget and dragActive)
|
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")
|
local intentEntity = _EntityService:GetEntityByPath(base .. "/Intent")
|
||||||
if intentEntity ~= nil and intentEntity.TextComponent ~= nil and intent ~= nil then
|
if intentEntity ~= nil and intentEntity.TextComponent ~= nil and intent ~= nil then
|
||||||
if intent.kind == "Attack" then
|
if intent.kind == "Attack" then
|
||||||
@@ -98,6 +109,7 @@ if self.PlayerPowers ~= nil and #self.PlayerPowers > 0 then
|
|||||||
pb = pb .. table.concat(names, " ")
|
pb = pb .. table.concat(names, " ")
|
||||||
end
|
end
|
||||||
self:SetText("/ui/RunUIGroup/CombatHud/PlayerPanel/Buffs", pb)
|
self:SetText("/ui/RunUIGroup/CombatHud/PlayerPanel/Buffs", pb)
|
||||||
|
self:RenderPlayerTargetPreview(targetMode == "player")
|
||||||
self:RenderRun()`),
|
self:RenderRun()`),
|
||||||
method('ShowDmgPop', `local slotKey = string.format("%d", math.floor(slot or 0))
|
method('ShowDmgPop', `local slotKey = string.format("%d", math.floor(slot or 0))
|
||||||
if self.DmgPopSlotQueue == nil then
|
if self.DmgPopSlotQueue == nil then
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ self.DmgPopSeq = 0
|
|||||||
self.CombatCameraShakeSeq = 0
|
self.CombatCameraShakeSeq = 0
|
||||||
self.DmgPopSlotQueue = {}
|
self.DmgPopSlotQueue = {}
|
||||||
self.PlayerDmgPopIndex = 0
|
self.PlayerDmgPopIndex = 0
|
||||||
|
self.DragCanPlay = false
|
||||||
self.FirstHpLossDone = false
|
self.FirstHpLossDone = false
|
||||||
self.ClayBlockNext = 0
|
self.ClayBlockNext = 0
|
||||||
self.DiscardSelectRemaining = 0
|
self.DiscardSelectRemaining = 0
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ function writeCodeblocks() {
|
|||||||
prop('boolean', 'ShopRelicBought', 'false'),
|
prop('boolean', 'ShopRelicBought', 'false'),
|
||||||
prop('number', 'DragSlot', '0'),
|
prop('number', 'DragSlot', '0'),
|
||||||
prop('number', 'DragTargetIndex', '0'),
|
prop('number', 'DragTargetIndex', '0'),
|
||||||
|
prop('boolean', 'DragCanPlay', 'false'),
|
||||||
prop('boolean', 'FxBusy', 'false'),
|
prop('boolean', 'FxBusy', 'false'),
|
||||||
prop('boolean', 'TurnBusy', 'false'),
|
prop('boolean', 'TurnBusy', 'false'),
|
||||||
prop('number', 'PlayerStr', '0'),
|
prop('number', 'PlayerStr', '0'),
|
||||||
|
|||||||
Reference in New Issue
Block a user