Open siobhan-saoirse opened 4 years ago
I apologize for no explanation when i made this issue. I need help with the project most of the time to fix some issues.
I did once make the GUI, but i cancelled development on it because i had no idea how to make it just like the TF2 vgui, and other reasons.
Civilian 2 1.0 just released, but it still needs work. Wearables are broken. the "table" of "model_player_per_class" is no longer a table, eyelander viewmodel is broken, incorrect loop on some taunts, and such more.
Civilian 2 is still in early development, and most of the code is written by myself, Lead, and such others.
Working on a legacy gamemode like Team Fortress 2 Gamemode can be hard at such times.
function UpgradeGUI()
if !string.find(game.GetMap(), "mvm_") then return end
-- code goes here
end
The easiest way I know of to create an interactive TF2 styled menu is to use a Derma Frame or Panel.
.Paint
and use the width and height parameters with surface.DrawTexturedRect
to use the correct vgui textures in the back.surface.DrawText
using Team Fortress 2 fonts and being able to customize them using the default font system.resource/ui/
folder contains most VGUI elements which can be easily read by humans.resource/ui/hudupgradepanel.res
.resource/sourcescheme.res
is also important to know which colors and fonts you should use.Thanks.
local PANEL = {}
local W = ScrW()
local H = ScrH()
local WScale = W/0
local Scale = H/480
function PANEL:Init()
self:SetPaintBackgroundEnabled(false)
self:SetVisible(true)
end
function PANEL:PerformLayout()
self:SetPos(0,0)
self:SetSize(W,H)
end
function PANEL:Paint()
local param
if not LocalPlayer():Alive() or (LocalPlayer():IsHL2() and !GetConVar("hud_show_ctf_as_hl2"):GetBool()) or GetConVar("hud_forcehl2hud"):GetBool() or GetConVarNumber("cl_drawhud")==0 or GAMEMODE.ShowScoreboard or !string.find(game.GetMap(), "ctf_") then return end
surface.SetDrawColor(255,255,255,255)
surface.SetTexture(objectives_flagpanel_bg_left)
surface.DrawTexturedRect(320*WScale-140*Scale, (480-75)*Scale, 280*Scale, 80*Scale)
surface.SetTexture(objectives_flagpanel_bg_right)
surface.DrawTexturedRect(320*WScale-140*Scale, (480-75)*Scale, 280*Scale, 80*Scale)
surface.SetTexture(objectives_flagpanel_bg_outline)
surface.DrawTexturedRect(320*WScale-140*Scale, (480-75)*Scale, 280*Scale, 80*Scale)
surface.SetTexture(objectives_flagpanel_bg_playingto)
surface.DrawTexturedRect(320*WScale-75*Scale, (480-31)*Scale, 150*Scale, 38*Scale)
-- Blue score
param = {
text=team.GetScore(TEAM_BLU),
font="HudFontBig",
pos={320*WScale-128*Scale, (480-46+17.5)*Scale},
color=Colors.Black,
xalign=TEXT_ALIGN_LEFT,
yalign=TEXT_ALIGN_CENTER,
}
draw.Text(param)
param.pos[1] = param.pos[1]-2*WScale
param.pos[2] = param.pos[2]-Scale
param.color=Colors.TanLight
draw.Text(param)
-- Red score
param = {
text=team.GetScore(TEAM_RED),
font="HudFontBig",
pos={320*WScale+132*Scale, (480-46+17.5)*Scale},
color=Colors.Black,
xalign=TEXT_ALIGN_RIGHT,
yalign=TEXT_ALIGN_CENTER,
}
draw.Text(param)
param.pos[1] = param.pos[1]-2*WScale
param.pos[2] = param.pos[2]-Scale
param.color=Colors.TanLight
draw.Text(param)
-- Playing to :
param = {
text="Playing to: ∞",
font="HudFontSmall",
pos={320*WScale, (480-28+15)*Scale},
color=Colors.TanLight,
xalign=TEXT_ALIGN_CENTER,
yalign=TEXT_ALIGN_CENTER,
}
draw.Text(param)
end
if HudUpgradePanel then HudUpgradePanel:Remove() end
HudUpgradePanel = vgui.CreateFromTable(vgui.RegisterTable(PANEL, "DPanel"))
I've read the hudupgradepanel.res
file, and i don't think i can do much about it.
It's been months since i've asked a question about this. Neither have i still implemented the Upgrade VGUI.
Since i don't really know the VGUI language, i don't think i could do much about it. It's very confusing to look at and i never thought i would be very confused like this.
The way it's designed is confusing for me and i don't think it's possible to implement this without any support.
Meanwhile Civilian 2 does have instant upgrade, but it needs to be just like TF2, when you go in the upgrade station, it only upgrades the weapon your holding instantly. It should be like this: