Added PickX display

This commit is contained in:
Haodong Mo 2021-03-13 22:35:22 +11:00
parent 48442a0ac0
commit 323f35e980
3 changed files with 41 additions and 0 deletions

View File

@ -89,6 +89,9 @@ local translate = ArcCW.GetTranslation
local defaultatticon = Material("hud/atts/default.png", "mips smooth")
local blockedatticon = Material("hud/atts/blocked.png", "mips smooth")
local pickx_empty = Material("hud/pickx_empty.png", "mips smooth")
local pickx_full = Material("hud/pickx_filled.png", "mips smooth")
-- 1: Customize
-- 2: Presets
ArcCW.Inv_SelectedMenu = 1
@ -100,6 +103,8 @@ SWEP.Inv_SelectedSlot = 0
-- 2: Trivia
ArcCW.Inv_SelectedInfo = 1
ArcCW.Inv_Fade = 0
function SWEP:CreateCustomize2HUD()
local col_fg = Color(255, 255, 255, 255)
local col_fg_tr = Color(255, 255, 255, 125)
@ -338,6 +343,42 @@ function SWEP:CreateCustomize2HUD()
DrawTextRot(self2, txt, 0, 0, ss * 6, ss * 14, w - icon_h - ss * 2)
end
end
local pickxpanel = vgui.Create("DPanel", ArcCW.InvHUD)
pickxpanel:SetSize(menu1_w, bottom_zone - airgap_y)
pickxpanel:SetPos(airgap_x, scrh - bottom_zone - airgap_y)
pickxpanel.Paint = function(self2, w, h)
local pickx_amount = self:GetPickX()
local pickedatts = self:CountAttachments()
if pickx_amount == 0 then return end
if pickx_amount > 8 then
surface.SetTextColor(col_fg)
surface.SetTextPos(0, ss * 4)
surface.SetFont("ArcCW_16")
surface.DrawText("Attachments: " .. tostring(pickedatts) .. "/" .. tostring(pickx_amount))
return
end
local x = 0
local y = ss * 4
local s = ss * 20
x = (w - (s * pickx_amount)) / 2
for i = 1, pickx_amount do
surface.SetDrawColor(col_fg)
if i > pickedatts then
surface.SetMaterial(pickx_empty)
else
surface.SetMaterial(pickx_full)
end
surface.DrawTexturedRect(x, y, s, s)
x = x + s
end
end
end
ArcCW.InvHUD_FormAttachments()

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB