-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsv_loadingurl.lua
More file actions
154 lines (109 loc) · 3.03 KB
/
Copy pathsv_loadingurl.lua
File metadata and controls
154 lines (109 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
g_ServerName = ""
g_MapName = ""
g_ServerURL = ""
g_MaxPlayers = ""
g_SteamID = ""
local PANEL = {}
function PANEL:Init()
self:SetSize( 1,1 )
self:SetPopupStayAtBack(true)
self:MoveToBack()
end
function PANEL:PerformLayout()
self:SetSize( 1,1 )
self:SetPopupStayAtBack(true)
self:MoveToBack()
end
function PANEL:Paint()
end
local lurl
local lua_loading_screen_hide = CreateClientConVar("lua_loading_screen_hide","1",true,false)
function PANEL:OnActivate()
g_ServerName = ""
g_MapName = ""
g_ServerURL = ""
g_MaxPlayers = ""
g_SteamID = ""
print("LoadingURL",GetConVarString"hostip")
if not lua_loading_screen_hide:GetBool() then return end
RunConsoleCommand "showconsole"
gui.HideGameUI()
gui.ActivateGameUI()
timer.Simple(0,function()
gui.HideGameUI()
gui.ActivateGameUI()
self:SetPopupStayAtBack(true)
self:MoveToBack()
RunConsoleCommand "showconsole"
timer.Simple(1,function()
gui.HideGameUI()
gui.ActivateGameUI()
self:SetPopupStayAtBack(true)
self:MoveToBack()
RunConsoleCommand "showconsole"
end)
end)
end
local lua_loading_screen_transp = CreateClientConVar("lua_loading_screen_transp","0",true,false)
hook.Add("DrawOverlay","loading_screen",function()
if lurl then
lurl:SetPaintedManually(false)
lurl:SetAlpha(lua_loading_screen_transp:GetBool() and 200 or 255)
lurl:PaintManual()
lurl:SetPaintedManually(true)
end
end)
function PANEL:OnDeactivate()
if lurl then
lurl:Remove()
lurl=nil
end
print("Unloading",GetDefaultLoadingHTML())
end
function PANEL:Think()
end
function PANEL:StatusChanged( strStatus )
print("> ",strStatus)
end
local factor = vgui.RegisterTable( PANEL, "EditablePanel" )
local pnl = nil
function GetLoadPanel()
print"GetLoadPanel"
if ( !IsValid( pnl ) ) then
pnl = vgui.CreateFromTable( factor )
end
return pnl
end
-- Uncomment this to make loading panel centered
-- GetLoadPanel=nil
--engine
function UpdateLoadPanel( strJavascript )
print("UpdateLoadPanel",strJavascript)
end
local lua_loading_screen = CreateClientConVar("lua_loading_screen","0",true,false)
function GameDetails( servername, serverurl, mapname, maxplayers, steamid, gamemode )
if ( engine.IsPlayingDemo() ) then return end
g_ServerName = servername
g_MapName = mapname
g_ServerURL = serverurl
g_MaxPlayers = maxplayers
g_SteamID = steamid
g_GameMode = gamemode
MsgN( "servername ",servername )
MsgN( "serverurl ",serverurl )
if not lurl and lua_loading_screen:GetBool() then
lurl = vgui.Create('DHTML',self)
lurl.Paint=function() end
lurl:SetPaintedManually(true)
lurl:SetSize(ScrW(),ScrH())
lurl:MoveToBack()
lurl:OpenURL(g_ServerURL)
end
MsgN( "gamemode ",gamemode )
MsgN( "mapname ",mapname )
MsgN( "maxplayers ",maxplayers )
MsgN( "steamid ",steamid )
serverurl = serverurl:Replace( "%s", steamid )
serverurl = serverurl:Replace( "%m", mapname )
if CreateMenu then CreateMenu() end
end