---- Help screen --include("cl_help_text.lua") CreateConVar("ttt_spectator_mode", "0") CreateConVar("ttt_mute_team_check", "0") HELPSCRN = {} function HELPSCRN:Show() local margin = 15 local dframe = vgui.Create("DFrame") local w, h = 620, 470 dframe:SetSize(w, h) dframe:Center() dframe:SetTitle("Help and Settings") dframe:ShowCloseButton(true) local dbut = vgui.Create("DButton", dframe) local bw, bh = 50, 25 dbut:SetSize(bw, bh) dbut:SetPos(w - bw - margin, h - bh - margin/2) dbut:SetText("Close") dbut.DoClick = function() dframe:Close() end local dtabs = vgui.Create("DPropertySheet", dframe) dtabs:SetPos(margin, margin * 2) dtabs:SetSize(w - margin*2, h - margin*3 - bh) local padding = dtabs:GetPadding() padding = padding * 2 local tutparent = vgui.Create("DPanel", dtabs) tutparent:SetPaintBackground(false) tutparent:StretchToParent(0, 0, 0, 0) self:CreateTutorial(tutparent) dtabs:AddSheet("Tutorial", tutparent, "gui/silkicons/add", false, false, "How TTT works, in 5 steps") local dfretta = vgui.Create("DPanel", dtabs) dfretta:StretchToParent(padding,padding,padding,padding) dfretta:SetPaintBackground(false) dtabs:AddSheet("Fretta", dfretta, "gui/silkicons/page", false, false, "Pick what to do") local dsettings = vgui.Create("Panel", dtabs) dsettings:StretchToParent(0,0,padding,0) local dgui = vgui.Create("DForm", dsettings) dgui:StretchToParent(padding,padding,padding,padding) dgui:SetName("Interface settings") local cb = nil dgui:CheckBox("Show gameplay tips at the bottom of the screen while spectating", "ttt_tips_enable") dgui:CheckBox("Show voicechat indicators in the top-left", "ttt_voicechat_topleft") cb = dgui:NumSlider("Start of round info popup duration", "ttt_startpopup_duration", 0, 60, 0) cb:SetTooltip("When the round starts, a small popup appears at the bottom of your screen for a few seconds. Change the time it displays for here.") dgui:NumSlider("Crosshair opacity while using ironsights", "ttt_ironsights_crosshair_opacity", 0, 1, 1) dgui:CheckBox("Disable crosshair completely", "ttt_disable_crosshair") dgui:CheckBox("Minimalist Target ID under crosshair (no karma text, hints, etc)", "ttt_minimal_targetid") cb = dgui:CheckBox("Fast weapon switch", "ttt_weaponswitcher_fast") cb:SetTooltip("Enable to cycle through weapons when you scroll without opening the weapon switcher menu.") cb = dgui:CheckBox("Disable weapon switch menu auto-closing", "ttt_weaponswitcher_stay") cb:SetTooltip("By default the weapon switcher automatically closes a few seconds after you last scroll. Enable this to make it stay up.") cb = dgui:CheckBox("Play sound cue when a round begins or ends", "ttt_cl_soundcues") cb = dgui:CheckBox("Use fire graphics fallback", "ttt_fire_fallback") cb:SetTooltip("Fire sometimes doesn't work on old graphics cards. This option will at least let you void walking into it if fire is invisible to you.") dgui:PerformLayout() local gw, gh = dgui:GetSize() local dplay = vgui.Create("DForm", dsettings) dplay:SetPos(padding, gh + padding) dplay:SetName("Gameplay settings") cb = dplay:CheckBox("Spectate-only mode (always stay spectator)", "ttt_spectator_mode") cb:SetTooltip("Spectate-only mode will prevent you from respawning when a new round starts, instead you stay Spectator.") -- For some reason this one defaulted to on, unlike other checkboxes, so -- force it to the actual value of the cvar (which defaults to off) local mute = dplay:CheckBox("Mute living players when dead", "ttt_mute_team_check") mute:SetValue(GetConVar("ttt_mute_team_check"):GetBool()) mute:SetTooltip("Enable to mute living players while you are dead/spectator.") dplay:CopyWidth(dgui) dtabs:AddSheet("Settings", dsettings, "gui/silkicons/wrench", false, false, "Client-side settings") local dform_fretta = vgui.Create("DForm", dfretta) dform_fretta:SetName("Fretta") dform_fretta:StretchToParent(padding*2,padding,padding,padding) local dmodevote = vgui.Create("DButton", dform_fretta) dmodevote:SetFont("Trebuchet22") dmodevote:SetText("Vote to change the Fretta gamemode") dmodevote:SizeToContents() dmodevote:SetSize(dmodevote:GetWide() + margin * 2, dmodevote:GetTall() + margin*2) dmodevote.ApplySchemeSettings = function() end dmodevote.DoClick = function(s) RunConsoleCommand("voteforchange") dframe:Close() end local voting = LocalPlayer():GetNWBool("WantsVote", false) or GetConVarNumber( "fretta_voting" ) == 0 dmodevote:SetDisabled(voting) dform_fretta:AddItem(dmodevote) dframe:MakePopup() end local function ShowTTTHelp(ply, cmd, args) HELPSCRN:Show() end concommand.Add("ttt_helpscreen", ShowTTTHelp) -- Some spectator mode bookkeeping local function SpectateCallback(cv, old, new) local num = tonumber(new) if num and (num == 0 or num == 1) then RunConsoleCommand("ttt_spectate", num) end end cvars.AddChangeCallback("ttt_spectator_mode", SpectateCallback) local function MuteTeamCallback(cv, old, new) local num = tonumber(new) if num and (num == 0 or num == 1) then RunConsoleCommand("ttt_mute_team", num) end end cvars.AddChangeCallback("ttt_mute_team_check", MuteTeamCallback) --- Tutorial local imgpath = "VGUI/ttt/help/tut0%d" local tutorial_pages = 6 function HELPSCRN:CreateTutorial(parent) local w, h = parent:GetSize() local m = 5 local bg = vgui.Create("DColouredBox", parent) bg:StretchToParent(0,0,0,0) bg:SetTall(330) bg:SetColor(COLOR_BLACK) --local tut = vgui.Create("HTML", parent) local tut = vgui.Create("DImage", parent) tut:StretchToParent(0, 0, 0, 0) --tut:SetHTML(help.quick[1] or "Not found") tut:SetVerticalScrollbarEnabled(false) tut:SetImage(Format(imgpath, 1)) tut:SetWide(1024) tut:SetTall(512) tut.current = 1 local bw, bh = 100, 30 local bar = vgui.Create("TTTProgressBar", parent) bar:SetSize(200, bh) bar:SetPos(0, 330) bar:CenterHorizontal() bar:SetMin(1) bar:SetMax(tutorial_pages) bar:SetValue(1) bar:SetColor(Color(0,200,0)) -- fixing your panels... bar.UpdateText = function(s) s.Label:SetText(Format("%i / %i", s.m_iValue, s.m_iMax)) end bar:UpdateText() local bnext = vgui.Create("DButton", parent) bnext:SetFont("Trebuchet22") bnext:SetSize(bw, bh) bnext:SetText("Next") bnext:SetPos(w - bw - 10, 330) local bprev = vgui.Create("DButton", parent) bprev:SetFont("Trebuchet22") bprev:SetSize(bw, bh) bprev:SetText("Previous") bprev:SetPos(0, 330) bnext.DoClick = function() if tut.current < tutorial_pages then tut.current = tut.current + 1 tut:SetImage(Format(imgpath, tut.current)) bar:SetValue(tut.current) end end bprev.DoClick = function() if tut.current > 1 then tut.current = tut.current - 1 tut:SetImage(Format(imgpath, tut.current)) bar:SetValue(tut.current) end end bnext.ApplySchemeSettings = function() end bprev.ApplySchemeSettings = function() end end