mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
176
gamemodes/helix/plugins/cinematictext/derma/cl_splashmenu.lua
Normal file
176
gamemodes/helix/plugins/cinematictext/derma/cl_splashmenu.lua
Normal file
@@ -0,0 +1,176 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
local PANEL = {}
|
||||
|
||||
local ScrW, ScrH = ScrW(), ScrH()
|
||||
|
||||
function PANEL:Init()
|
||||
if not LocalPlayer():IsAdmin() then return end
|
||||
|
||||
if IsValid(ix.gui.cinematicSplashTextMenu) then
|
||||
ix.gui.cinematicSplashTextMenu:Remove()
|
||||
end
|
||||
ix.gui.cinematicSplashTextMenu = self
|
||||
|
||||
self.contents = {
|
||||
text = "",
|
||||
bigText = "",
|
||||
duration = 3,
|
||||
blackBars = true,
|
||||
music = true,
|
||||
color = color_white
|
||||
}
|
||||
|
||||
local textEntryTall = ScrH*0.045
|
||||
|
||||
self:SetSize(ScrW*0.6, ScrH*0.6)
|
||||
self:Center()
|
||||
self:MakePopup()
|
||||
self:SetTitle("Cinematic Splash Text Menu")
|
||||
|
||||
local textLabel = self:Add("DLabel")
|
||||
textLabel:SetText("Splash Text")
|
||||
textLabel:SetFont("cinematicSplashFontSmall")
|
||||
textLabel:SetTextColor(ix.config.Get("color", Color(75, 119, 190)))
|
||||
textLabel:Dock(TOP)
|
||||
textLabel:DockMargin( 20, 5, 20, 0 )
|
||||
textLabel:SizeToContents()
|
||||
|
||||
local textEntry = self:Add("DTextEntry")
|
||||
textEntry:SetFont("cinematicSplashFontSmall")
|
||||
textEntry:Dock(TOP)
|
||||
textEntry:DockMargin( 20, 5, 20, 0 )
|
||||
textEntry:SetUpdateOnType(true)
|
||||
textEntry.OnValueChange = function(this, value)
|
||||
self.contents.text = value
|
||||
end
|
||||
textEntry:SetTall(textEntryTall)
|
||||
|
||||
local bigTextLabel = self:Add("DLabel")
|
||||
bigTextLabel:SetText("Big Splash Text (Appears under normal text)")
|
||||
bigTextLabel:SetFont("cinematicSplashFontSmall")
|
||||
bigTextLabel:SetTextColor(ix.config.Get("color", Color(75, 119, 190)))
|
||||
bigTextLabel:Dock(TOP)
|
||||
bigTextLabel:DockMargin( 20, 5, 20, 0 )
|
||||
bigTextLabel:SizeToContents()
|
||||
|
||||
local bigTextEntry = self:Add("DTextEntry")
|
||||
bigTextEntry:SetFont("cinematicSplashFontSmall")
|
||||
bigTextEntry:Dock(TOP)
|
||||
bigTextEntry:DockMargin( 20, 5, 20, 0 )
|
||||
bigTextEntry:SetUpdateOnType(true)
|
||||
bigTextEntry.OnValueChange = function(this, value)
|
||||
self.contents.bigText = value
|
||||
end
|
||||
bigTextEntry:SetTall(textEntryTall)
|
||||
|
||||
local durationLabel = self:Add("DLabel")
|
||||
durationLabel:SetText("Splash Text Duration")
|
||||
durationLabel:SetFont("cinematicSplashFontSmall")
|
||||
durationLabel:SetTextColor(ix.config.Get("color", Color(75, 119, 190)))
|
||||
durationLabel:Dock(TOP)
|
||||
durationLabel:DockMargin( 20, 5, 20, 0 )
|
||||
durationLabel:SizeToContents()
|
||||
|
||||
local durationSlider = self:Add("DNumSlider")
|
||||
durationSlider:Dock(TOP)
|
||||
durationSlider:SetMin(1) -- Set the minimum number you can slide to
|
||||
durationSlider:SetMax(30) -- Set the maximum number you can slide to
|
||||
durationSlider:SetDecimals(0) -- Decimal places - zero for whole number
|
||||
durationSlider:SetValue(self.contents.duration)
|
||||
|
||||
durationSlider:DockMargin(10, 0, 0, 5)
|
||||
durationSlider.OnValueChanged = function(_, val)
|
||||
self.contents.duration = math.Round(val)
|
||||
end
|
||||
|
||||
local blackBarBool = self:Add("DCheckBoxLabel")
|
||||
blackBarBool:SetText("Draw Black Bars")
|
||||
blackBarBool:SetFont("cinematicSplashFontSmall")
|
||||
blackBarBool:SetValue(self.contents.blackBars)
|
||||
blackBarBool.OnChange = function(this, bValue)
|
||||
self.contents.blackBars = bValue
|
||||
end
|
||||
blackBarBool:Dock(TOP)
|
||||
blackBarBool:DockMargin( 20, 5, 20, 0 )
|
||||
blackBarBool:SizeToContents()
|
||||
|
||||
local musicBool = self:Add("DCheckBoxLabel")
|
||||
musicBool:SetText("Play audio")
|
||||
musicBool:SetFont("cinematicSplashFontSmall")
|
||||
musicBool:SetValue(self.contents.music)
|
||||
musicBool.OnChange = function(this, bValue)
|
||||
self.contents.music = bValue
|
||||
end
|
||||
musicBool:Dock(TOP)
|
||||
musicBool:DockMargin( 20, 5, 20, 0 )
|
||||
musicBool:SizeToContents()
|
||||
|
||||
local Mixer = self:Add("DColorMixer")
|
||||
Mixer:Dock(TOP) -- Make Mixer fill place of Frame
|
||||
Mixer:SetPalette(true) -- Show/hide the palette DEF:true
|
||||
Mixer:SetAlphaBar(true) -- Show/hide the alpha bar DEF:true
|
||||
Mixer:SetWangs(true) -- Show/hide the R G B A indicators DEF:true
|
||||
Mixer:SetColor(Color(30,100,160)) -- Set the default color
|
||||
Mixer:SetTall(textEntryTall*3.5)
|
||||
Mixer:DockMargin( 20, 5, 20, 0 )
|
||||
|
||||
local quitButton = self:Add("DButton")
|
||||
quitButton:Dock(BOTTOM)
|
||||
quitButton:DockMargin( 20, 5, 20, 0 )
|
||||
quitButton:SetText("CANCEL")
|
||||
quitButton:SetTextColor(Color(255,0,0))
|
||||
quitButton:SetFont("cinematicSplashFontSmall")
|
||||
quitButton:SetTall(ScrH*0.05)
|
||||
quitButton.DoClick = function()
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
local postButton = self:Add("DButton")
|
||||
postButton:Dock(BOTTOM)
|
||||
postButton:DockMargin( 20, 5, 20, 0 )
|
||||
postButton:SetText("POST")
|
||||
postButton:SetTextColor(color_white)
|
||||
postButton:SetFont("cinematicSplashFontSmall")
|
||||
postButton:SetTall(ScrH*0.05)
|
||||
postButton.DoClick = function()
|
||||
if not (self.contents and (self.contents.text or self.contents.bigText)) then ix.util.Notify("Something went horribly wrong. Try reloading this panel") return end
|
||||
if self.contents.text == "" and self.contents.bigText == "" then ix.util.Notify("Text is missing. Enter some text to display") return end
|
||||
|
||||
net.Start("triggerCinematicSplashMenu")
|
||||
net.WriteString(self.contents.text) -- the normal text
|
||||
net.WriteString(self.contents.bigText) -- the big text
|
||||
net.WriteUInt(self.contents.duration,6) -- the duration of the splash
|
||||
net.WriteBool(self.contents.blackBars) -- whether to draw blackBars
|
||||
net.WriteBool(self.contents.music) -- whether to play a sound
|
||||
net.WriteColor(self.contents.color)
|
||||
net.SendToServer()
|
||||
self:Remove()
|
||||
end
|
||||
self:SizeToContents()
|
||||
|
||||
Mixer.ValueChanged = function(this, col) -- this is here because it needs to reference panels that are defined after mixer
|
||||
local newColor = Color(col.r, col.g, col.b)
|
||||
self.contents.color = newColor --ValueChanged doesn't include the color metatable, so we just define it here. Also remove any alpha changes
|
||||
textLabel:SetTextColor(newColor)
|
||||
bigTextLabel:SetTextColor(newColor)
|
||||
durationLabel:SetTextColor(newColor)
|
||||
postButton:SetTextColor(newColor)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("cinematicSplashTextMenu", PANEL, "DFrame")
|
||||
|
||||
net.Receive("openCinematicSplashMenu", function()
|
||||
vgui.Create("cinematicSplashTextMenu")
|
||||
end)
|
||||
150
gamemodes/helix/plugins/cinematictext/derma/cl_splashtext.lua
Normal file
150
gamemodes/helix/plugins/cinematictext/derma/cl_splashtext.lua
Normal file
@@ -0,0 +1,150 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
local PANEL = {}
|
||||
local ScrW, ScrH = ScrW(), ScrH()
|
||||
local music
|
||||
|
||||
local contents = {
|
||||
text = "",
|
||||
bigText = "",
|
||||
color = color_white,
|
||||
duration = 6,
|
||||
music = true
|
||||
}
|
||||
|
||||
function PANEL:Init()
|
||||
if ix.gui.cinematicSplashText then
|
||||
ix.gui.cinematicSplashText:Remove()
|
||||
end
|
||||
|
||||
ix.gui.cinematicSplashText = self
|
||||
|
||||
self:SetSize(ScrW, ScrH)
|
||||
self.barSize = ScrH*(ix.config.Get("cinematicBarSize", 0.18))
|
||||
end
|
||||
|
||||
function PANEL:Paint()
|
||||
end
|
||||
|
||||
function PANEL:DrawBlackBars()
|
||||
self.topBar = self:Add("DPanel")
|
||||
self.topBar:SetSize(ScrW, self.barSize + 10) -- +10 in to make sure it covers the top
|
||||
self.topBar:SetPos(0, -self.barSize) -- set it to be outside of the screen
|
||||
self.topBar.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0,0,0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.bottomBar = self:Add("DPanel")
|
||||
self.bottomBar:SetSize(ScrW, self.barSize + 10) -- +10 in to make sure it covers the bottom
|
||||
self.bottomBar:SetPos(0, ScrH) -- set it to be outside of the screen
|
||||
self.bottomBar.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0,0,0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:TriggerBlackBars()
|
||||
if not (IsValid(self.topBar) and IsValid(self.bottomBar)) then return end -- dont do anything if the bars dont exist
|
||||
|
||||
self.topBar:MoveTo(0, 0, 2, 0, 0.5)
|
||||
self.bottomBar:MoveTo(0, ScrH - self.barSize, 2, 0, 0.5, function() self:TriggerText() end)
|
||||
end
|
||||
|
||||
function PANEL:TriggerText()
|
||||
local textPanel = self:Add("DPanel")
|
||||
textPanel.Paint = function() end
|
||||
local panelWide, panelTall = 300, 300
|
||||
textPanel:SetSize(panelWide, panelTall)
|
||||
if contents.text and contents.text ~= "" then
|
||||
textPanel.text = textPanel:Add("DLabel")
|
||||
textPanel.text:SetFont("cinematicSplashFont")
|
||||
textPanel.text:SetTextColor(contents.color or color_white)
|
||||
textPanel.text:SetText(contents.text)
|
||||
textPanel.text:SetAutoStretchVertical(true)
|
||||
textPanel.text:Dock(TOP)
|
||||
textPanel.text:SetAlpha(0)
|
||||
textPanel.text:AlphaTo(255, 2, 0, function()
|
||||
if not contents.bigText then self:TriggerCountdown() end
|
||||
end)
|
||||
|
||||
surface.SetFont("cinematicSplashFont")
|
||||
textPanel.text.textWide, textPanel.text.textTall = surface.GetTextSize(contents.text)
|
||||
panelWide = panelWide > textPanel.text.textWide and panelWide or textPanel.text.textWide
|
||||
panelTall = panelTall + textPanel.text.textTall
|
||||
textPanel:SetSize(panelWide, panelTall)
|
||||
end
|
||||
|
||||
if contents.bigText and contents.bigText ~= "" then
|
||||
textPanel.bigText = textPanel:Add("DLabel")
|
||||
textPanel.bigText:SetFont("cinematicSplashFontBig")
|
||||
textPanel.bigText:SetTextColor(contents.color or color_white)
|
||||
textPanel.bigText:SetText(contents.bigText)
|
||||
textPanel.bigText:SetAutoStretchVertical(true)
|
||||
textPanel.bigText:Dock(TOP)
|
||||
textPanel.bigText:SetAlpha(0)
|
||||
textPanel.bigText:AlphaTo(255, 2, 1, function()
|
||||
self:TriggerCountdown()
|
||||
end)
|
||||
|
||||
surface.SetFont("cinematicSplashFontBig")
|
||||
textPanel.bigText.textWide, textPanel.bigText.textTall = surface.GetTextSize(contents.bigText)
|
||||
panelWide = panelWide > textPanel.bigText.textWide and panelWide or textPanel.bigText.textWide
|
||||
panelTall = panelTall + textPanel.bigText.textTall
|
||||
textPanel:SetSize(panelWide, panelTall)
|
||||
end
|
||||
|
||||
if textPanel.text then textPanel.text:DockMargin((panelWide/2) - (textPanel.text.textWide/2), 0, 0, 20) end
|
||||
if textPanel.bigText then textPanel.bigText:DockMargin((panelWide/2) - (textPanel.bigText.textWide/2), 0, 0, 20) end
|
||||
textPanel:InvalidateLayout(true)
|
||||
|
||||
textPanel:SetPos(ScrW - textPanel:GetWide() - ScrW*0.05, ScrH*0.58)
|
||||
|
||||
if contents.music then
|
||||
music = CreateSound(LocalPlayer(), ix.config.Get("cinematicTextMusic","music/stingers/industrial_suspense2.wav"))
|
||||
music:PlayEx(0, 100)
|
||||
music:ChangeVolume(1, 2)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:TriggerCountdown()
|
||||
self:AlphaTo(0, 4, contents.duration, function()
|
||||
self:Remove()
|
||||
end)
|
||||
timer.Simple(contents.duration, function()
|
||||
if music then music:FadeOut(4) end
|
||||
end)
|
||||
end
|
||||
|
||||
vgui.Register("cinematicSplashText", PANEL, "DPanel")
|
||||
|
||||
net.Receive("triggerCinematicSplashMenu", function()
|
||||
contents.text = net.ReadString()
|
||||
contents.bigText = net.ReadString()
|
||||
contents.duration = net.ReadUInt(6)
|
||||
local blackbars = net.ReadBool()
|
||||
contents.music = net.ReadBool()
|
||||
contents.color = net.ReadColor()
|
||||
|
||||
if contents.text == "" then contents.text = nil end
|
||||
if contents.bigText == "" then contents.bigText = nil end
|
||||
|
||||
local splashText = vgui.Create("cinematicSplashText")
|
||||
if blackbars then
|
||||
splashText:DrawBlackBars()
|
||||
splashText:TriggerBlackBars()
|
||||
else
|
||||
splashText:TriggerText()
|
||||
end
|
||||
end)
|
||||
94
gamemodes/helix/plugins/cinematictext/sh_plugin.lua
Normal file
94
gamemodes/helix/plugins/cinematictext/sh_plugin.lua
Normal file
@@ -0,0 +1,94 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Cinematic Splash Text"
|
||||
PLUGIN.description = "Cinematic looking splash text for that extra flair."
|
||||
PLUGIN.author = "76561198070441753 (TovarischPootis), ported to IX by mixed.dev"
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
|
||||
ix.config.Add("cinematicTextFont", "Arial", "The font used to display cinematic splash texts.", function()
|
||||
if (CLIENT) then
|
||||
hook.Run("LoadCinematicSplashTextFonts")
|
||||
end
|
||||
end, {category = PLUGIN.name})
|
||||
|
||||
ix.config.Add("cinematicTextSize", 18, "The font size multiplier used by cinematic splash texts.", function()
|
||||
if (CLIENT) then
|
||||
hook.Run("LoadCinematicSplashTextFonts")
|
||||
end
|
||||
end, {
|
||||
category = PLUGIN.name,
|
||||
data = {min = 10, max = 50},
|
||||
}
|
||||
)
|
||||
|
||||
ix.config.Add("cinematicTextSizeBig", 30, "The big font size multiplier used by cinematic splash texts.", function()
|
||||
if (CLIENT) then
|
||||
hook.Run("LoadCinematicSplashTextFonts")
|
||||
end
|
||||
end, {
|
||||
category = PLUGIN.name,
|
||||
data = {min = 10, max = 50},
|
||||
}
|
||||
)
|
||||
|
||||
ix.config.Add("cinematicBarSize", 0.18, "How big the black bars are during cinematic.", nil, {
|
||||
category = PLUGIN.name,
|
||||
data = {min = 0.1, max = 0.2, decimals = 2}
|
||||
})
|
||||
|
||||
ix.config.Add("cinematicTextMusic","music/stingers/industrial_suspense2.wav","The music played upon cinematic splash text appearance.",nil,
|
||||
{category = PLUGIN.name})
|
||||
|
||||
|
||||
ix.command.Add("CinematicMenu", {
|
||||
description = "Open a menu to setup the cinematic.",
|
||||
adminOnly = true,
|
||||
OnRun = function(self, client)
|
||||
net.Start("openCinematicSplashMenu")
|
||||
net.Send(client)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
if CLIENT then
|
||||
function PLUGIN:LoadCinematicSplashTextFonts()
|
||||
local font = ix.config.Get("cinematicTextFont", "Arial")
|
||||
local fontSizeBig = ix.config.Get("cinematicTextSizeBig", 30)
|
||||
local fontSizeNormal = ix.config.Get("cinematicTextSize", 18)
|
||||
surface.CreateFont("cinematicSplashFontBig", {
|
||||
font = font,
|
||||
size = ScreenScale(fontSizeBig),
|
||||
extended = true,
|
||||
weight = 1000
|
||||
})
|
||||
|
||||
surface.CreateFont("cinematicSplashFont", {
|
||||
font = font,
|
||||
size = ScreenScale(fontSizeNormal),
|
||||
extended = true,
|
||||
weight = 800
|
||||
})
|
||||
|
||||
surface.CreateFont("cinematicSplashFontSmall", {
|
||||
font = font,
|
||||
size = ScreenScale(10),
|
||||
extended = true,
|
||||
weight = 800
|
||||
})
|
||||
end
|
||||
|
||||
function PLUGIN:LoadFonts()
|
||||
self:LoadCinematicSplashTextFonts() -- this will create the fonts upon initial load.
|
||||
end
|
||||
end
|
||||
27
gamemodes/helix/plugins/cinematictext/sv_plugin.lua
Normal file
27
gamemodes/helix/plugins/cinematictext/sv_plugin.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
util.AddNetworkString("openCinematicSplashMenu")
|
||||
util.AddNetworkString("triggerCinematicSplashMenu")
|
||||
|
||||
net.Receive("triggerCinematicSplashMenu", function(_, client)
|
||||
if not client:IsAdmin() then return end
|
||||
|
||||
net.Start("triggerCinematicSplashMenu")
|
||||
net.WriteString(net.ReadString()) -- text
|
||||
net.WriteString(net.ReadString()) --bigtext
|
||||
net.WriteUInt(net.ReadUInt(6), 6) --duration
|
||||
net.WriteBool(net.ReadBool()) -- blackBars
|
||||
net.WriteBool(net.ReadBool()) -- music
|
||||
net.WriteColor(net.ReadColor()) -- color
|
||||
net.Broadcast()
|
||||
end)
|
||||
Reference in New Issue
Block a user