mirror of
https://github.com/ZionDevelopers/sui-scoreboard.git
synced 2025-03-04 03:03:11 -05:00
Using default Gmod icon set instead of bundled silkicons
Remove unused texRatings stuff
This commit is contained in:
parent
1a6c8d3117
commit
a3397ccdb5
@ -29,27 +29,27 @@ function PANEL:Init()
|
||||
self.InfoLabels[ 1 ] = {}
|
||||
self.InfoLabels[ 2 ] = {}
|
||||
self.InfoLabels[ 3 ] = {}
|
||||
|
||||
|
||||
self.btnKick = vgui.Create( "suiplayerkickbutton", self )
|
||||
self.btnBan = vgui.Create( "suiplayerbanbutton", self )
|
||||
self.btnPBan = vgui.Create( "suiplayerpermbanbutton", self )
|
||||
|
||||
|
||||
self.VoteButtons = {}
|
||||
|
||||
self.VoteButtons[5] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[5]:SetUp( "silkicons/wrench", "builder", "Good at building!" )
|
||||
self.VoteButtons[5]:SetUp( "wrench", "builder", "Good at building!", true )
|
||||
|
||||
self.VoteButtons[4] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[4]:SetUp( "silkicons/star", "gold_star", "Wow! Gold star for you!" )
|
||||
self.VoteButtons[4]:SetUp( "star", "gold_star", "Wow! Gold star for you!", true )
|
||||
|
||||
self.VoteButtons[3] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[3]:SetUp( "silkicons/palette", "artistic", "This player is artistic!" )
|
||||
self.VoteButtons[3]:SetUp( "palette", "artistic", "This player is artistic!", true )
|
||||
|
||||
self.VoteButtons[2] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[2]:SetUp( "silkicons/heart", "love", "I love this player!" )
|
||||
self.VoteButtons[2]:SetUp( "heart", "love", "I love this player!", true )
|
||||
|
||||
self.VoteButtons[1] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[1]:SetUp( "silkicons/emoticon_smile", "smile", "I like this player!" )
|
||||
self.VoteButtons[1]:SetUp( "emoticon_smile", "smile", "I like this player!", true )
|
||||
|
||||
|
||||
self.VoteButtons[10] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
@ -62,24 +62,24 @@ function PANEL:Init()
|
||||
self.VoteButtons[8]:SetUp( "arrow", "best_airvehicle", "This player is awesome with air vehicles" )
|
||||
|
||||
self.VoteButtons[7] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[7]:SetUp( "inv_corner16", "stunter", "Wow! you can do amazing Stunts!" )
|
||||
self.VoteButtons[7]:SetUp( "inv_corner16", "stunter", "Wow! you can do amazing Stunts!" )
|
||||
|
||||
self.VoteButtons[6] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[6]:SetUp( "gmod_logo", "god", "You are my GOD!" )
|
||||
|
||||
|
||||
|
||||
self.VoteButtons[15] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[15]:SetUp( "silkicons/emoticon_smile", "lol", "LOL! You are funny!" )
|
||||
self.VoteButtons[15]:SetUp( "emoticon_smile", "lol", "LOL! You are funny!", true )
|
||||
|
||||
self.VoteButtons[14] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[14]:SetUp( "info", "informative", "This player is very informative!" )
|
||||
|
||||
|
||||
self.VoteButtons[13] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[13]:SetUp( "silkicons/user", "friendly", "This player is very friendly!" )
|
||||
self.VoteButtons[13]:SetUp( "user", "friendly", "This player is very friendly!", true )
|
||||
|
||||
self.VoteButtons[12] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[12]:SetUp( "silkicons/exclamation", "naughty", "This player is naughty!" )
|
||||
|
||||
self.VoteButtons[12]:SetUp( "exclamation", "naughty", "This player is naughty!", true )
|
||||
|
||||
self.VoteButtons[11] = vgui.Create( "suispawnmenuvotebutton", self )
|
||||
self.VoteButtons[11]:SetUp( "gmod_logo", "gay", "This player is GAY!" )
|
||||
end
|
||||
@ -88,16 +88,16 @@ end
|
||||
function PANEL:SetInfo( column, k, v )
|
||||
if not v or v == "" then v = "N/A" end
|
||||
|
||||
if not self.InfoLabels[ column ][ k ] then
|
||||
if not self.InfoLabels[ column ][ k ] then
|
||||
self.InfoLabels[ column ][ k ] = {}
|
||||
self.InfoLabels[ column ][ k ].Key = vgui.Create( "DLabel", self )
|
||||
self.InfoLabels[ column ][ k ].Value = vgui.Create( "DLabel", self )
|
||||
self.InfoLabels[ column ][ k ].Key:SetText( k )
|
||||
self.InfoLabels[ column ][ k ].Key:SetColor(Color(0,0,0,255))
|
||||
self.InfoLabels[ column ][ k ].Key:SetFont("suiscoreboardcardinfo")
|
||||
self:InvalidateLayout()
|
||||
self:InvalidateLayout()
|
||||
end
|
||||
|
||||
|
||||
self.InfoLabels[ column ][ k ].Value:SetText( v )
|
||||
self.InfoLabels[ column ][ k ].Value:SetColor(Color(0,0,0,255))
|
||||
self.InfoLabels[ column ][ k ].Value:SetFont("suiscoreboardcardinfo")
|
||||
@ -114,7 +114,7 @@ end
|
||||
function PANEL:UpdatePlayerData()
|
||||
if not self.Player then return end
|
||||
if not self.Player:IsValid() then return end
|
||||
|
||||
|
||||
self:SetInfo( 1, "Props:", self.Player:GetCount( "props" ) )
|
||||
self:SetInfo( 1, "HoverBalls:", self.Player:GetCount( "hoverballs" ) )
|
||||
self:SetInfo( 1, "Thrusters:", self.Player:GetCount( "thrusters" ) )
|
||||
@ -130,7 +130,7 @@ function PANEL:UpdatePlayerData()
|
||||
self:SetInfo( 2, "Emitters:", self.Player:GetCount( "emitters" ) )
|
||||
self:SetInfo( 2, "Lamps:", self.Player:GetCount( "lamps" ) )
|
||||
self:SetInfo( 2, "Spawners:", self.Player:GetCount( "spawners" ) )
|
||||
|
||||
|
||||
self:InvalidateLayout()
|
||||
end
|
||||
|
||||
@ -139,8 +139,8 @@ function PANEL:ApplySchemeSettings()
|
||||
for _k, column in pairs( self.InfoLabels ) do
|
||||
for k, v in pairs( column ) do
|
||||
v.Key:SetFGColor( 50, 50, 50, 255 )
|
||||
v.Value:SetFGColor( 80, 80, 80, 255 )
|
||||
end
|
||||
v.Value:SetFGColor( 80, 80, 80, 255 )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -148,72 +148,72 @@ end
|
||||
function PANEL:Think()
|
||||
if self.PlayerUpdate and self.PlayerUpdate > CurTime() then return end
|
||||
self.PlayerUpdate = CurTime() + 0.25
|
||||
|
||||
|
||||
self:UpdatePlayerData()
|
||||
end
|
||||
|
||||
--- PerformLayout
|
||||
function PANEL:PerformLayout()
|
||||
function PANEL:PerformLayout()
|
||||
local x = 5
|
||||
|
||||
for column, column in pairs( self.InfoLabels ) do
|
||||
|
||||
|
||||
local y = 0
|
||||
local RightMost = 0
|
||||
|
||||
for k, v in pairs( column ) do
|
||||
|
||||
for k, v in pairs( column ) do
|
||||
v.Key:SetPos( x, y )
|
||||
v.Key:SizeToContents()
|
||||
|
||||
|
||||
v.Value:SetPos( x + 60 , y )
|
||||
v.Value:SizeToContents()
|
||||
|
||||
|
||||
y = y + v.Key:GetTall() + 2
|
||||
|
||||
RightMost = math.max( RightMost, v.Value.x + v.Value:GetWide() )
|
||||
|
||||
RightMost = math.max( RightMost, v.Value.x + v.Value:GetWide() )
|
||||
end
|
||||
|
||||
|
||||
if x<100 then
|
||||
x = x + 205
|
||||
else
|
||||
x = x + 115
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not LocalPlayer():IsAdmin() then
|
||||
|
||||
if not LocalPlayer():IsAdmin() then
|
||||
self.btnKick:SetVisible( false )
|
||||
self.btnBan:SetVisible( false )
|
||||
self.btnPBan:SetVisible( false )
|
||||
else
|
||||
self.btnPBan:SetVisible( false )
|
||||
else
|
||||
self.btnKick:SetVisible( true )
|
||||
self.btnBan:SetVisible( true )
|
||||
self.btnPBan:SetVisible( true )
|
||||
|
||||
|
||||
self.btnKick:SetPos( self:GetWide() - 175, 85 - (22 * 2) )
|
||||
self.btnKick:SetSize( 46, 20 )
|
||||
|
||||
self.btnBan:SetPos( self:GetWide() - 175, 85 - (22 * 1) )
|
||||
self.btnBan:SetSize( 46, 20 )
|
||||
|
||||
|
||||
self.btnPBan:SetPos( self:GetWide() - 175, 85 - (22 * 0) )
|
||||
self.btnPBan:SetSize( 46, 20 )
|
||||
|
||||
self.btnPBan:SetSize( 46, 20 )
|
||||
|
||||
self.btnKick.DoClick = function () Scoreboard.kick( self.Player ) end
|
||||
self.btnPBan.DoClick = function () Scoreboard.pBan( self.Player ) end
|
||||
self.btnBan.DoClick = function () Scoreboard.ban( self.Player ) end
|
||||
self.btnBan.DoClick = function () Scoreboard.ban( self.Player ) end
|
||||
end
|
||||
|
||||
for k, v in ipairs( self.VoteButtons ) do
|
||||
|
||||
for k, v in ipairs( self.VoteButtons ) do
|
||||
v:InvalidateLayout()
|
||||
if k < 6 then
|
||||
v:SetPos( self:GetWide() - k * 25, 0 )
|
||||
elseif k < 11 then
|
||||
v:SetPos( self:GetWide() - (k-5) * 25, 36 )
|
||||
else
|
||||
else
|
||||
v:SetPos( self:GetWide() - (k-10) * 25, 72 )
|
||||
end
|
||||
v:SetSize( 20, 32 )
|
||||
end
|
||||
v:SetSize( 20, 32 )
|
||||
end
|
||||
end
|
||||
|
||||
--- Paint
|
||||
@ -221,4 +221,4 @@ function PANEL:Paint(w,h)
|
||||
return true
|
||||
end
|
||||
|
||||
vgui.Register( "suiscoreplayerinfocard", PANEL, "Panel" )
|
||||
vgui.Register( "suiscoreplayerinfocard", PANEL, "Panel" )
|
||||
|
@ -20,24 +20,6 @@ include( "player_infocard.lua" )
|
||||
|
||||
local texGradient = surface.GetTextureID( "gui/center_gradient" )
|
||||
|
||||
local texRatings = {}
|
||||
texRatings[ 'none' ] = surface.GetTextureID( "gui/silkicons/user" )
|
||||
texRatings[ 'smile' ] = surface.GetTextureID( "gui/silkicons/emoticon_smile" )
|
||||
texRatings[ 'lol' ] = surface.GetTextureID( "gui/silkicons/emoticon_smile" )
|
||||
texRatings[ 'gay' ] = surface.GetTextureID( "gui/gmod_logo" )
|
||||
texRatings[ 'stunter' ] = surface.GetTextureID( "gui/inv_corner16" )
|
||||
texRatings[ 'god' ] = surface.GetTextureID( "gui/gmod_logo" )
|
||||
texRatings[ 'curvey' ] = surface.GetTextureID( "gui/corner16" )
|
||||
texRatings[ 'best_landvehicle' ] = surface.GetTextureID( "gui/faceposer_indicator" )
|
||||
texRatings[ 'best_airvehicle' ] = surface.GetTextureID( "gui/arrow" )
|
||||
texRatings[ 'naughty' ] = surface.GetTextureID( "gui/silkicons/exclamation" )
|
||||
texRatings[ 'friendly' ] = surface.GetTextureID( "gui/silkicons/user" )
|
||||
texRatings[ 'informative' ] = surface.GetTextureID( "gui/info" )
|
||||
texRatings[ 'love' ] = surface.GetTextureID( "gui/silkicons/heart" )
|
||||
texRatings[ 'artistic' ] = surface.GetTextureID( "gui/silkicons/palette" )
|
||||
texRatings[ 'gold_star' ] = surface.GetTextureID( "gui/silkicons/star" )
|
||||
texRatings[ 'builder' ] = surface.GetTextureID( "gui/silkicons/wrench" )
|
||||
|
||||
surface.GetTextureID( "gui/silkicons/emoticon_smile" )
|
||||
local PANEL = {}
|
||||
|
||||
@ -49,67 +31,67 @@ function PANEL:Paint(w,h)
|
||||
if self.Armed then
|
||||
color = Color( 125, 125, 125, 255 )
|
||||
end
|
||||
|
||||
|
||||
if self.Selected then
|
||||
color = Color( 125, 125, 125, 255 )
|
||||
end
|
||||
|
||||
|
||||
ply = self.Player;
|
||||
|
||||
|
||||
if ply:IsValid() then
|
||||
if ply:Team() == TEAM_CONNECTING then
|
||||
color = Color( 100, 100, 100, 155 )
|
||||
elseif ply:IsValid() then
|
||||
if ply:Team() == TEAM_UNASSIGNED then
|
||||
color = Color( 100, 100, 100, 255 )
|
||||
else
|
||||
else
|
||||
if evolve == nil then
|
||||
tcolor = team.GetColor(ply:Team())
|
||||
color = Color(tcolor.r,tcolor.g,tcolor.b,225)
|
||||
color = Color(tcolor.r,tcolor.g,tcolor.b,225)
|
||||
else
|
||||
tcolor = evolve.ranks[ ply:EV_GetRank() ].Color
|
||||
|
||||
tcolor = evolve.ranks[ ply:EV_GetRank() ].Color
|
||||
|
||||
color = Color(tcolor.r,tcolor.g,tcolor.b,225)
|
||||
end
|
||||
end
|
||||
elseif ply:IsAdmin() then
|
||||
color = Color( 255, 155, 0, 255 )
|
||||
end
|
||||
|
||||
if ply == LocalPlayer() then
|
||||
|
||||
if ply == LocalPlayer() then
|
||||
if evolve == nil then
|
||||
tcolor = team.GetColor(ply:Team())
|
||||
color = Color(tcolor.r,tcolor.g,tcolor.b,225)
|
||||
color = Color(tcolor.r,tcolor.g,tcolor.b,225)
|
||||
else
|
||||
tcolor = evolve.ranks[ ply:EV_GetRank() ].Color
|
||||
color = Color(tcolor.r,tcolor.g,tcolor.b,225)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.Open or self.Size ~= self.TargetSize then
|
||||
if self.Open or self.Size ~= self.TargetSize then
|
||||
draw.RoundedBox( 4, 18, 16, self:GetWide()-36, self:GetTall() - 16, color )
|
||||
draw.RoundedBox( 4, 20, 16, self:GetWide()-40, self:GetTall() - 16 - 2, Color( 225, 225, 225, 150 ) )
|
||||
|
||||
|
||||
surface.SetTexture( texGradient )
|
||||
surface.SetDrawColor( 255, 255, 255, 100 )
|
||||
surface.DrawTexturedRect( 20, 16, self:GetWide()-40, self:GetTall() - 16 - 2 )
|
||||
surface.DrawTexturedRect( 20, 16, self:GetWide()-40, self:GetTall() - 16 - 2 )
|
||||
end
|
||||
|
||||
|
||||
draw.RoundedBox( 4, 18, 0, self:GetWide()-36, 38, color )
|
||||
|
||||
|
||||
surface.SetTexture( texGradient )
|
||||
surface.SetDrawColor( 255, 255, 255, 150 )
|
||||
surface.DrawTexturedRect( 0, 0, self:GetWide()-36, 38 )
|
||||
|
||||
surface.DrawTexturedRect( 0, 0, self:GetWide()-36, 38 )
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
--- SetPlayer
|
||||
function PANEL:SetPlayer( ply )
|
||||
self.Player = ply
|
||||
self.infoCard:SetPlayer( ply )
|
||||
self:UpdatePlayerData()
|
||||
self.Player = ply
|
||||
self.infoCard:SetPlayer( ply )
|
||||
self:UpdatePlayerData()
|
||||
self.imgAvatar:SetPlayer( ply )
|
||||
end
|
||||
|
||||
@ -117,15 +99,14 @@ end
|
||||
function PANEL:CheckRating( name, count )
|
||||
if self.Player:GetNetworkedInt( "Rating."..name, 0 ) > count then
|
||||
count = self.Player:GetNetworkedInt( "Rating."..name, 0 )
|
||||
self.texRating = texRatings[ name ]
|
||||
end
|
||||
|
||||
|
||||
return count
|
||||
end
|
||||
|
||||
--- UpdatePlayerData
|
||||
function PANEL:UpdatePlayerData()
|
||||
if not self.Player:IsValid() then
|
||||
if not self.Player:IsValid() then
|
||||
return false
|
||||
end
|
||||
|
||||
@ -137,7 +118,7 @@ function PANEL:UpdatePlayerData()
|
||||
self.lblFrags:SetText( self.Player:Frags() )
|
||||
self.lblDeaths:SetText( self.Player:Deaths() )
|
||||
self.lblPing:SetText( self.Player:Ping() )
|
||||
|
||||
|
||||
-- Change the icon of the mute button based on state
|
||||
if self.Muted == nil or self.Muted ~= self.Player:IsMuted() then
|
||||
self.Muted = self.Player:IsMuted()
|
||||
@ -148,37 +129,33 @@ function PANEL:UpdatePlayerData()
|
||||
end
|
||||
|
||||
self.lblMute.DoClick = function() self.Player:SetMuted( not self.Muted ) end
|
||||
end
|
||||
end
|
||||
|
||||
local k = self.Player:Frags()
|
||||
local d = self.Player:Deaths()
|
||||
local kdr = "-- "
|
||||
|
||||
|
||||
if d ~= 0 then
|
||||
kdr = k/d
|
||||
local y,z = math.modf(kdr)
|
||||
z = string.sub(z, 1, 5)
|
||||
|
||||
|
||||
if y ~= 0 then
|
||||
kdr = string.sub(y+z,1,5)
|
||||
else
|
||||
kdr = z
|
||||
end
|
||||
|
||||
kdr = kdr .. ":1"
|
||||
if k == 0 then
|
||||
|
||||
kdr = kdr .. ":1"
|
||||
if k == 0 then
|
||||
kdr = k .. ":" .. d
|
||||
end
|
||||
end
|
||||
|
||||
self.lblRatio:SetText( kdr )
|
||||
|
||||
-- Work out what icon to draw
|
||||
self.texRating = surface.GetTextureID( "gui/silkicons/emoticon_smile" )
|
||||
|
||||
self.texRating = texRatings[ 'none' ]
|
||||
self.lblRatio:SetText( kdr )
|
||||
|
||||
local count = 0
|
||||
|
||||
|
||||
count = self:CheckRating( 'smile', count )
|
||||
count = self:CheckRating( 'love', count )
|
||||
count = self:CheckRating( 'artistic', count )
|
||||
@ -199,9 +176,9 @@ end
|
||||
--- Int
|
||||
function PANEL:Init()
|
||||
self.Size = 38
|
||||
self:OpenInfo( false )
|
||||
self:OpenInfo( false )
|
||||
self.infoCard = vgui.Create( "suiscoreplayerinfocard", self )
|
||||
|
||||
|
||||
self.lblName = vgui.Create( "DLabel", self )
|
||||
self.lblTeam = vgui.Create( "DLabel", self )
|
||||
self.lblHours = vgui.Create( "DLabel", self )
|
||||
@ -216,7 +193,7 @@ function PANEL:Init()
|
||||
self.lblAvatarFix:SetText("")
|
||||
self.lblAvatarFix:SetCursor( "hand" )
|
||||
self.lblAvatarFix.DoClick = function () self.Player:ShowProfile() end
|
||||
|
||||
|
||||
-- If you don't do this it'll block your clicks
|
||||
self.lblName:SetMouseInputEnabled( false )
|
||||
self.lblTeam:SetMouseInputEnabled( false )
|
||||
@ -241,10 +218,10 @@ function PANEL:ApplySchemeSettings()
|
||||
self.lblDeaths:SetFont( "suiscoreboardplayername" )
|
||||
self.lblRatio:SetFont( "suiscoreboardplayername" )
|
||||
self.lblPing:SetFont( "suiscoreboardplayername" )
|
||||
self.lblAvatarFix:SetFont( "suiscoreboardplayername" )
|
||||
|
||||
self.lblAvatarFix:SetFont( "suiscoreboardplayername" )
|
||||
|
||||
local namecolor = Color(0,0,0,255)
|
||||
|
||||
|
||||
self.lblName:SetColor( namecolor )
|
||||
self.lblTeam:SetColor( namecolor )
|
||||
self.lblHours:SetColor( namecolor )
|
||||
@ -254,7 +231,7 @@ function PANEL:ApplySchemeSettings()
|
||||
self.lblRatio:SetColor( namecolor )
|
||||
self.lblPing:SetColor( namecolor)
|
||||
self.lblAvatarFix:SetColor( namecolor)
|
||||
|
||||
|
||||
self.lblName:SetFGColor( Color( 0, 0, 0, 255 ) )
|
||||
self.lblTeam:SetFGColor( Color( 0, 0, 0, 255 ) )
|
||||
self.lblHours:SetFGColor( Color( 0, 0, 0, 255 ) )
|
||||
@ -284,41 +261,41 @@ function PANEL:OpenInfo( bool )
|
||||
else
|
||||
self.TargetSize = 38
|
||||
end
|
||||
|
||||
|
||||
self.Open = bool
|
||||
end
|
||||
|
||||
--- Think
|
||||
function PANEL:Think()
|
||||
if self.Size ~= self.TargetSize then
|
||||
if self.Size ~= self.TargetSize then
|
||||
self.Size = math.Approach( self.Size, self.TargetSize, (math.abs( self.Size - self.TargetSize ) + 1) * 10 * FrameTime() )
|
||||
self:PerformLayout()
|
||||
Scoreboard.vgui:InvalidateLayout()
|
||||
end
|
||||
|
||||
if not self.PlayerUpdate or self.PlayerUpdate < CurTime() then
|
||||
|
||||
if not self.PlayerUpdate or self.PlayerUpdate < CurTime() then
|
||||
self.PlayerUpdate = CurTime() + 0.5
|
||||
self:UpdatePlayerData()
|
||||
self:UpdatePlayerData()
|
||||
end
|
||||
end
|
||||
|
||||
--- PerformLayout
|
||||
function PANEL:PerformLayout()
|
||||
self:SetSize( self:GetWide(), self.Size )
|
||||
|
||||
self:SetSize( self:GetWide(), self.Size )
|
||||
|
||||
self.lblName:SizeToContents()
|
||||
self.lblName:SetPos( 60, 3 )
|
||||
self.lblTeam:SizeToContents()
|
||||
self.lblTeam:SizeToContents()
|
||||
self.lblMute:SetSize(32,32)
|
||||
self.lblHours:SizeToContents()
|
||||
|
||||
self.imgAvatar:SetPos( 21, 4 )
|
||||
|
||||
self.imgAvatar:SetPos( 21, 4 )
|
||||
self.imgAvatar:SetSize( 32, 32 )
|
||||
self.lblAvatarFix:SetPos( 21, 4 )
|
||||
self.lblAvatarFix:SetPos( 21, 4 )
|
||||
self.lblAvatarFix:SetSize( 32, 32 )
|
||||
|
||||
local COLUMN_SIZE = 45
|
||||
|
||||
|
||||
self.lblMute:SetPos( self:GetWide() - COLUMN_SIZE - 8, 0 )
|
||||
self.lblPing:SetPos( self:GetWide() - COLUMN_SIZE * 2, 0 )
|
||||
self.lblRatio:SetPos( self:GetWide() - COLUMN_SIZE * 3.4, 0 )
|
||||
@ -327,31 +304,31 @@ function PANEL:PerformLayout()
|
||||
self.lblHealth:SetPos( self:GetWide() - COLUMN_SIZE * 6.4, 0 )
|
||||
self.lblHours:SetPos( self:GetWide() - COLUMN_SIZE * 10.3, 0 )
|
||||
self.lblTeam:SetPos( self:GetWide() - COLUMN_SIZE * 13.2, 3 )
|
||||
|
||||
if self.Open or self.Size ~= self.TargetSize then
|
||||
|
||||
if self.Open or self.Size ~= self.TargetSize then
|
||||
self.infoCard:SetVisible( true )
|
||||
self.infoCard:SetPos( 18, self.lblName:GetTall() + 27 )
|
||||
self.infoCard:SetSize( self:GetWide() - 36, self:GetTall() - self.lblName:GetTall() + 5 )
|
||||
else
|
||||
self.infoCard:SetVisible( false )
|
||||
self.infoCard:SetSize( self:GetWide() - 36, self:GetTall() - self.lblName:GetTall() + 5 )
|
||||
else
|
||||
self.infoCard:SetVisible( false )
|
||||
end
|
||||
end
|
||||
|
||||
--- HigherOrLower
|
||||
function PANEL:HigherOrLower( row )
|
||||
if self.Player:Team() == TEAM_CONNECTING then
|
||||
if self.Player:Team() == TEAM_CONNECTING then
|
||||
return false
|
||||
end
|
||||
|
||||
if self.Player:Team() ~= row.Player:Team() then
|
||||
return self.Player:Team() < row.Player:Team()
|
||||
end
|
||||
|
||||
if self.Player:Frags() == row.Player:Frags() then
|
||||
return self.Player:Deaths() < row.Player:Deaths()
|
||||
|
||||
if self.Player:Frags() == row.Player:Frags() then
|
||||
return self.Player:Deaths() < row.Player:Deaths()
|
||||
end
|
||||
|
||||
return self.Player:Frags() > row.Player:Frags()
|
||||
end
|
||||
|
||||
vgui.Register( "suiscoreplayerrow", PANEL, "Button" )
|
||||
vgui.Register( "suiscoreplayerrow", PANEL, "Button" )
|
||||
|
@ -19,13 +19,13 @@ Version 2.6.2 - 12-06-2014 05:33 PM(UTC -03:00)
|
||||
local PANEL = {}
|
||||
|
||||
PANEL.VoteName = "none"
|
||||
PANEL.MaterialName = "exclamation"
|
||||
PANEL.MaterialName = "icon16/exclamation.png"
|
||||
|
||||
--- Init
|
||||
function PANEL:Init()
|
||||
self.Label = vgui.Create( "DLabel", self )
|
||||
self:ApplySchemeSettings()
|
||||
self:SetCursor( "hand" )
|
||||
self:SetCursor( "hand" )
|
||||
end
|
||||
|
||||
--- DoClick
|
||||
@ -34,12 +34,12 @@ function PANEL:DoClick()
|
||||
if not ply or not ply:IsValid() or ply == LocalPlayer() then
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
LocalPlayer():ConCommand( "sui_rateuser ".. ply:EntIndex().. " "..self.VoteName.."\n" )
|
||||
end
|
||||
|
||||
---ApplySchemeSettings
|
||||
function PANEL:ApplySchemeSettings()
|
||||
function PANEL:ApplySchemeSettings()
|
||||
self.Label:SetFont( "suiscoreboardcardinfo" )
|
||||
self.Label:SetColor( Color(0,0,0,255) )
|
||||
self.Label:SetFGColor( 0, 0, 0, 150 )
|
||||
@ -47,29 +47,32 @@ function PANEL:ApplySchemeSettings()
|
||||
end
|
||||
|
||||
--- PerformLayout
|
||||
function PANEL:PerformLayout()
|
||||
function PANEL:PerformLayout()
|
||||
if self:GetParent().Player and self:GetParent().Player:IsValid() then
|
||||
self.Label:SetText( self:GetParent().Player:GetNetworkedInt( "SuiRating."..self.VoteName, 0 ) )
|
||||
end
|
||||
|
||||
|
||||
self.Label:SizeToContents()
|
||||
self.Label:SetPos( (self:GetWide() - self.Label:GetWide()) / 2, self:GetTall() - self.Label:GetTall() )
|
||||
end
|
||||
|
||||
--- SetUp
|
||||
function PANEL:SetUp( mat, votename, nicename )
|
||||
function PANEL:SetUp( mat, votename, nicename, ispng )
|
||||
self.MaterialName = mat
|
||||
self.VoteName = votename
|
||||
self.NiceName = nicename
|
||||
self:SetToolTip( self.NiceName )
|
||||
self.ispng = ispng or false
|
||||
|
||||
if not self.Material then
|
||||
self.Material = self.ispng
|
||||
and Material( "icon16/" .. self.MaterialName .. ".png" )
|
||||
or surface.GetTextureID( "gui/" .. self.MaterialName )
|
||||
end
|
||||
end
|
||||
|
||||
--- Paint
|
||||
function PANEL:Paint(w,h)
|
||||
if not self.Material then
|
||||
self.Material = surface.GetTextureID( "gui/" .. self.MaterialName )
|
||||
end
|
||||
|
||||
function PANEL:Paint(w,h)
|
||||
local bgColor = Color( 200,200,200,100 )
|
||||
|
||||
if self.Selected then
|
||||
@ -77,35 +80,40 @@ function PANEL:Paint(w,h)
|
||||
elseif self.Armed then
|
||||
bgColor = Color( 175, 175, 175, 100 )
|
||||
end
|
||||
|
||||
|
||||
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), bgColor )
|
||||
|
||||
|
||||
local alpha = 225
|
||||
if self.Armed then
|
||||
alpha = 255
|
||||
end
|
||||
|
||||
surface.SetTexture( self.Material )
|
||||
|
||||
if self.ispng then
|
||||
surface.SetMaterial( self.Material )
|
||||
else
|
||||
surface.SetTexture( self.Material )
|
||||
end
|
||||
|
||||
if self.VoteName == "best_airvehicle" then
|
||||
surface.SetDrawColor( 100, 100, 255, alpha )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 8, self:GetWide()/2 - 8, 16, 16 )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 8, self:GetWide()/2 - 8, 16, 16 )
|
||||
elseif self.VoteName == "lol" then
|
||||
surface.SetDrawColor( 255, 155, 0, alpha )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 8, self:GetWide()/2 - 8, 16, 16 )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 8, self:GetWide()/2 - 8, 16, 16 )
|
||||
elseif self.VoteName == "best_landvehicle" then
|
||||
surface.SetDrawColor( 0, 0, 0, alpha )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 12, self:GetWide()/2 - 12, 24, 24 )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 12, self:GetWide()/2 - 12, 24, 24 )
|
||||
elseif self.VoteName == "god" then
|
||||
surface.SetDrawColor( 255, 255, 255, alpha )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 13, self:GetWide()/2 - 8, 26, 26 )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 13, self:GetWide()/2 - 8, 26, 26 )
|
||||
elseif self.VoteName == "gay" then
|
||||
surface.SetDrawColor( 255, 0, 215, alpha )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 13, self:GetWide()/2 - 8, 26, 26 )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 13, self:GetWide()/2 - 8, 26, 26 )
|
||||
else
|
||||
surface.SetDrawColor( 255, 255, 255, alpha )
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 8, self:GetWide()/2 - 8, 16, 16 )
|
||||
end
|
||||
|
||||
surface.DrawTexturedRect( self:GetWide()/2 - 8, self:GetWide()/2 - 8, 16, 16 )
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@ -113,25 +121,25 @@ local TooltipText = nil
|
||||
|
||||
--- OnCursorEntered
|
||||
function PANEL:OnCursorEntered()
|
||||
TooltipText = self.NiceName
|
||||
TooltipText = self.NiceName
|
||||
end
|
||||
|
||||
--- OnCursorExited
|
||||
function PANEL:OnCursorExited()
|
||||
TooltipText = nil
|
||||
TooltipText = nil
|
||||
end
|
||||
|
||||
vgui.Register( "suispawnmenuvotebutton", PANEL, "Button" )
|
||||
|
||||
local _GetTooltipText = GetTooltipText
|
||||
|
||||
--- GetTooltipText
|
||||
--- GetTooltipText
|
||||
-- @return string
|
||||
function GetTooltipText()
|
||||
|
||||
if TooltipText then
|
||||
if TooltipText then
|
||||
return TooltipText
|
||||
end
|
||||
|
||||
return _GetTooltipText()
|
||||
end
|
||||
return _GetTooltipText()
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user