feat(ui): style monster damage numbers
This commit is contained in:
@@ -3061,7 +3061,7 @@
|
|||||||
"Name": "amount"
|
"Name": "amount"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Code": "local base = \"/ui/DefaultGroup/CombatHud/MonsterSlot\" .. tostring(slot) .. \"/DmgPop\"\nself:SetText(base, \"-\" .. string.format(\"%d\", amount))\nself:SetEntityEnabled(base, true)\n_TimerService:SetTimerOnce(function() self:SetEntityEnabled(base, false) end, 0.6)",
|
"Code": "local base = \"/ui/DefaultGroup/CombatHud/MonsterSlot\" .. tostring(slot) .. \"/DmgPop\"\nlocal pop = _EntityService:GetEntityByPath(base)\nself:SetText(base, string.format(\"%d\", amount))\nself:SetEntityEnabled(base, true)\nself:SetEntityEnabled(base .. \"/Accent\", true)\nif pop ~= nil and pop.UITransformComponent ~= nil then\n\tpop.UITransformComponent.anchoredPosition = Vector2(0, 76)\nend\nlocal startY = 76\nfor i = 1, 6 do\n\t_TimerService:SetTimerOnce(function()\n\t\tlocal p = _EntityService:GetEntityByPath(base)\n\t\tif p ~= nil and p.UITransformComponent ~= nil then\n\t\t\tp.UITransformComponent.anchoredPosition = Vector2(0, startY + i * 7)\n\t\tend\n\tend, 0.045 * i)\nend\n_TimerService:SetTimerOnce(function()\n\tself:SetEntityEnabled(base, false)\n\tself:SetEntityEnabled(base .. \"/Accent\", false)\nend, 0.48)",
|
||||||
"Scope": 2,
|
"Scope": 2,
|
||||||
"ExecSpace": 6,
|
"ExecSpace": 6,
|
||||||
"Attributes": [],
|
"Attributes": [],
|
||||||
|
|||||||
@@ -1188,15 +1188,27 @@ function upsertUi() {
|
|||||||
const dmgPop = entity({
|
const dmgPop = entity({
|
||||||
id: guid('cmb', 250 + i), path: `${base}/DmgPop`, modelId: 'uitext', entryId: 'UIText',
|
id: guid('cmb', 250 + i), path: `${base}/DmgPop`, modelId: 'uitext', entryId: 'UIText',
|
||||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||||
displayOrder: 9,
|
displayOrder: 11,
|
||||||
components: [
|
components: [
|
||||||
transform({ parentW: SLOT_W, parentH: SLOT_H, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 120, y: 30 }, pos: { x: 0, y: 60 } }),
|
transform({ parentW: SLOT_W, parentH: SLOT_H, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 170, y: 52 }, pos: { x: 0, y: 76 } }),
|
||||||
sprite({ color: TRANSPARENT }),
|
sprite({ color: { r: 0.12, g: 0.02, b: 0.02, a: 0.72 }, type: 1 }),
|
||||||
text({ value: '', fontSize: 24, bold: true, color: { r: 1, g: 0.35, b: 0.3, a: 1 }, alignment: 4 }),
|
text({ value: '', fontSize: 36, bold: true, color: { r: 1, g: 0.9, b: 0.18, a: 1 }, alignment: 4, outlineWidth: 5 }),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
dmgPop.jsonString.enable = false;
|
dmgPop.jsonString.enable = false;
|
||||||
combat.push(dmgPop);
|
combat.push(dmgPop);
|
||||||
|
const dmgAccent = entity({
|
||||||
|
id: guid('cmb', 380 + i), path: `${base}/DmgPop/Accent`, modelId: 'uitext', entryId: 'UIText',
|
||||||
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent,MOD.Core.TextComponent',
|
||||||
|
displayOrder: 12,
|
||||||
|
components: [
|
||||||
|
transform({ parentW: 170, parentH: 52, anchor: { x: 0.5, y: 0.5 }, pivot: { x: 0.5, y: 0.5 }, size: { x: 170, y: 20 }, pos: { x: 0, y: -22 } }),
|
||||||
|
sprite({ color: TRANSPARENT }),
|
||||||
|
text({ value: 'DAMAGE', fontSize: 14, bold: true, color: { r: 1, g: 0.28, b: 0.16, a: 1 }, alignment: 4, outlineWidth: 2 }),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
dmgAccent.jsonString.enable = false;
|
||||||
|
combat.push(dmgAccent);
|
||||||
const mBlockBadge = entity({
|
const mBlockBadge = entity({
|
||||||
id: guid('cmb', 270 + i), path: `${base}/BlockBadge`, modelId: 'uisprite', entryId: 'UISprite',
|
id: guid('cmb', 270 + i), path: `${base}/BlockBadge`, modelId: 'uisprite', entryId: 'UISprite',
|
||||||
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
|
componentNames: 'MOD.Core.UITransformComponent,MOD.Core.SpriteGUIRendererComponent',
|
||||||
@@ -5001,9 +5013,26 @@ end
|
|||||||
self:SetText("/ui/DefaultGroup/CombatHud/PlayerPanel/Buffs", pb)
|
self:SetText("/ui/DefaultGroup/CombatHud/PlayerPanel/Buffs", pb)
|
||||||
self:RenderRun()`),
|
self:RenderRun()`),
|
||||||
method('ShowDmgPop', `local base = "/ui/DefaultGroup/CombatHud/MonsterSlot" .. tostring(slot) .. "/DmgPop"
|
method('ShowDmgPop', `local base = "/ui/DefaultGroup/CombatHud/MonsterSlot" .. tostring(slot) .. "/DmgPop"
|
||||||
self:SetText(base, "-" .. string.format("%d", amount))
|
local pop = _EntityService:GetEntityByPath(base)
|
||||||
|
self:SetText(base, string.format("%d", amount))
|
||||||
self:SetEntityEnabled(base, true)
|
self:SetEntityEnabled(base, true)
|
||||||
_TimerService:SetTimerOnce(function() self:SetEntityEnabled(base, false) end, 0.6)`, [
|
self:SetEntityEnabled(base .. "/Accent", true)
|
||||||
|
if pop ~= nil and pop.UITransformComponent ~= nil then
|
||||||
|
pop.UITransformComponent.anchoredPosition = Vector2(0, 76)
|
||||||
|
end
|
||||||
|
local startY = 76
|
||||||
|
for i = 1, 6 do
|
||||||
|
_TimerService:SetTimerOnce(function()
|
||||||
|
local p = _EntityService:GetEntityByPath(base)
|
||||||
|
if p ~= nil and p.UITransformComponent ~= nil then
|
||||||
|
p.UITransformComponent.anchoredPosition = Vector2(0, startY + i * 7)
|
||||||
|
end
|
||||||
|
end, 0.045 * i)
|
||||||
|
end
|
||||||
|
_TimerService:SetTimerOnce(function()
|
||||||
|
self:SetEntityEnabled(base, false)
|
||||||
|
self:SetEntityEnabled(base .. "/Accent", false)
|
||||||
|
end, 0.48)`, [
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'slot' },
|
||||||
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' },
|
{ Type: 'number', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'amount' },
|
||||||
]),
|
]),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user