aboutsummaryrefslogtreecommitdiff
path: root/gamemode/hud
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2015-12-31 22:49:46 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2015-12-31 22:49:46 -0500
commit883acbee6022f5ba311db805584c96d0006a484a (patch)
tree9109962721225689a34b11e95f02c57323ca39ef /gamemode/hud
parentbaee063606856f5b01bd13e44e19880e6c607052 (diff)
downloadwintersurvival2-883acbee6022f5ba311db805584c96d0006a484a.tar.gz
wintersurvival2-883acbee6022f5ba311db805584c96d0006a484a.tar.bz2
wintersurvival2-883acbee6022f5ba311db805584c96d0006a484a.zip
Added new scoreboard
Diffstat (limited to 'gamemode/hud')
-rw-r--r--gamemode/hud/draw_scoreboard.lua62
1 files changed, 60 insertions, 2 deletions
diff --git a/gamemode/hud/draw_scoreboard.lua b/gamemode/hud/draw_scoreboard.lua
index 8062c56..6ad71cb 100644
--- a/gamemode/hud/draw_scoreboard.lua
+++ b/gamemode/hud/draw_scoreboard.lua
@@ -4,12 +4,68 @@ local SCOREBOARD_OFF = 101
local SCOREBOARD_WIDTH = 700
local SCOREBOARD_X = ScrW() / 2 - SCOREBOARD_WIDTH / 2
+local scoreboard = nil
+
function GM:ScoreboardShow()
- self.ShowSB = true
+ local NPly = #player.GetAll()
+ local Tall = SCOREBOARD_OFF + 20 * NPly
+ local y = ScrH() / 2 - Tall / 2
+ local by = y + SCOREBOARD_OFF
+
+ scoreboard = vgui.Create("MBFrame")
+ if(!scoreboard) then return end
+ scoreboard:SetPos(SCOREBOARD_X,y)
+ scoreboard:SetSize(SCOREBOARD_WIDTH,Tall)
+ scoreboard:SetTitle("Scoreboard")
+ scoreboard:ShowCloseButton(false)
+
+ for i,v in pairs(player.GetAll()) do
+ print("Makeing label for " .. v:Nick())
+ local ypos = (20*(i-1))+24
+ local playerlabel = vgui.Create("MBLabel")
+ playerlabel:SetParent(scoreboard)
+ playerlabel:SetPos(2, ypos)
+ local ptext = v:Nick()
+ if(v:IsPigeon()) then
+ ptext = ptext .. " (Dead)"
+ end
+ playerlabel:AddText(ptext)
+ playerlabel:SetupLines()
+
+ local pinglabel = vgui.Create("MBLabel")
+ pinglabel:SetParent(scoreboard)
+ pinglabel:SetPos(SCOREBOARD_WIDTH-100,ypos)
+ pinglabel:AddText(v:Ping())
+ pinglabel:SetupLines()
+
+ --if(v == LocalPlayer()) then continue end
+
+ local mutebutton = vgui.Create("MBButton")
+ mutebutton:SetParent(scoreboard)
+ mutebutton:SetPos(SCOREBOARD_X,ypos)
+ if(v:IsMuted()) then
+ mutebutton.Text = "Mute"
+ mutebutton.OnClick = function()
+ v:SetMuted(true)
+ end
+ else
+ mutebutton.Text = "Unmute"
+ mutebutton.OnClick = function()
+ v:SetMuted(false)
+ end
+ end
+
+ end
+
+ scoreboard:MakePopup()
+ --self.ShowSB = true
end
function GM:ScoreboardHide()
- self.ShowSB = false
+ if(scoreboard) then
+ scoreboard:SetVisible(false)
+ end
+ --self.ShowSB = false
end
function GM:HUDDrawScoreBoard()
@@ -29,6 +85,8 @@ function GM:HUDDrawScoreBoard()
for k,v in pairs( player.GetAll() ) do
local Y = by + 20 * (k-1)
+ DrawText("")
+
if (v:IsPigeon()) then
DrawText(v:Nick(), "Trebuchet18", SCOREBOARD_X + 2, Y, MAIN_GREYCOLOR)
DrawText(v:Ping(), "Trebuchet18", SCOREBOARD_X + SCOREBOARD_WIDTH - 30, Y, MAIN_GREYCOLOR)