mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
34
gamemodes/darkrp/plugins/credits/cl_plugin.lua
Normal file
34
gamemodes/darkrp/plugins/credits/cl_plugin.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
--[[
|
||||
| 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 netstream = netstream
|
||||
local vgui = vgui
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
netstream.Hook("EditEventCredits", function(creditsMembers)
|
||||
PLUGIN.creditsMembers = creditsMembers
|
||||
vgui.Create("ixEventCreditsEditor")
|
||||
end)
|
||||
|
||||
netstream.Hook("ShowcaseEventCredits", function(creditsMembers, shouldShowCredits)
|
||||
PLUGIN.creditsMembers = creditsMembers or {}
|
||||
local credits = vgui.Create("ixEventCredits")
|
||||
if !shouldShowCredits then
|
||||
credits:AlphaTo(255, 3, 0, function()
|
||||
credits:FadeInLogo()
|
||||
end)
|
||||
else
|
||||
credits:AlphaTo(255, 3, 0, function()
|
||||
credits:FadeInCredits()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
145
gamemodes/darkrp/plugins/credits/derma/cl_credits.lua
Normal file
145
gamemodes/darkrp/plugins/credits/derma/cl_credits.lua
Normal file
@@ -0,0 +1,145 @@
|
||||
--[[
|
||||
| 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 PANEL = {}
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetAlpha(0)
|
||||
self:MakePopup()
|
||||
self:SetZPos(99999)
|
||||
|
||||
self:PlayMusic()
|
||||
end
|
||||
|
||||
function PANEL:FadeInLogo()
|
||||
local logoPanel = self:Add("Panel")
|
||||
logoPanel:SetAlpha(0)
|
||||
logoPanel:AlphaTo(255, 3, 0, function()
|
||||
logoPanel:AlphaTo(0, 3, 0, function()
|
||||
self:FadeInTitleImage()
|
||||
end)
|
||||
end)
|
||||
|
||||
local willardLabel = logoPanel:Add("DLabel")
|
||||
willardLabel:SetFont("WNMenuTitleNoClamp")
|
||||
willardLabel:SetText("WILLARD NETWORKS")
|
||||
willardLabel:SizeToContents()
|
||||
|
||||
logoPanel:SetSize(willardLabel:GetWide(), SScaleMin(196 / 3) + willardLabel:GetTall() + SScaleMin(20 / 3))
|
||||
logoPanel:Center()
|
||||
|
||||
local logo = logoPanel:Add("DImage")
|
||||
logo:SetImage("willardnetworks/newlogo.png")
|
||||
logo:SetSize(SScaleMin(195 / 3), SScaleMin(196 / 3))
|
||||
logo:Center()
|
||||
local x, _ = logo:GetPos()
|
||||
logo:SetPos(x, 0)
|
||||
|
||||
willardLabel:Center()
|
||||
local x2, _ = willardLabel:GetPos()
|
||||
|
||||
willardLabel:SetPos(x2, SScaleMin(196 / 3) + SScaleMin(20 / 3))
|
||||
end
|
||||
|
||||
function PANEL:FadeInTitleImage()
|
||||
local titleImagePanel = self:Add("DHTML")
|
||||
titleImagePanel:OpenURL(ix.config.Get("eventCreditsImageURL", ""))
|
||||
titleImagePanel:SetSize(ix.config.Get("eventCreditsImageW", 1), ix.config.Get("eventCreditsImageH", 1))
|
||||
titleImagePanel:Center()
|
||||
|
||||
local fadeThing = self:Add("Panel")
|
||||
fadeThing:SetSize(ix.config.Get("eventCreditsImageW", 1), ix.config.Get("eventCreditsImageH", 1))
|
||||
fadeThing:Center()
|
||||
fadeThing:SetAlpha(255)
|
||||
fadeThing:AlphaTo(0, 2, 0)
|
||||
fadeThing.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_black)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
timer.Simple(ix.config.Get("eventCreditsImageShownTimer", 5) + 2, function()
|
||||
fadeThing:AlphaTo(255, 2, 0, function()
|
||||
titleImagePanel:Remove()
|
||||
fadeThing:Remove()
|
||||
self:AlphaTo(0, 3, 0, function()
|
||||
self:Remove()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function PANEL:FadeInCredits()
|
||||
local height = 0
|
||||
local panelMove = self:Add("Panel")
|
||||
panelMove:SetWide(ScrW())
|
||||
|
||||
local thanksTo = panelMove:Add("DLabel")
|
||||
thanksTo:SetFont("WNMenuTitle")
|
||||
thanksTo:SetText("THANKS TO:")
|
||||
thanksTo:Dock(TOP)
|
||||
thanksTo:SizeToContents()
|
||||
thanksTo:DockMargin(0, 0, 0, SScaleMin(20 / 3))
|
||||
thanksTo:SetContentAlignment(5)
|
||||
|
||||
height = height + thanksTo:GetTall() + SScaleMin(20 / 3)
|
||||
|
||||
for _, v in pairs(PLUGIN.creditsMembers) do
|
||||
local member = panelMove:Add("DLabel")
|
||||
member:SetFont("WNSmallerMenuTitleNoBold")
|
||||
member:SetText(v or "")
|
||||
member:Dock(TOP)
|
||||
member:SizeToContents()
|
||||
member:SetContentAlignment(5)
|
||||
member:DockMargin(0, 0, 0, SScaleMin(20 / 3))
|
||||
|
||||
height = height + member:GetTall() + SScaleMin(20 / 3)
|
||||
end
|
||||
|
||||
panelMove:SetTall(height)
|
||||
panelMove:SetPos(0, ScrH())
|
||||
panelMove:MoveTo( 0, -ScrH(), ix.config.Get("eventCreditsSpeedOfRoller", 60), 0, 1, function()
|
||||
self:AlphaTo(0, 3, 0, function()
|
||||
self:Remove()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function PANEL:PlayMusic()
|
||||
self:MoveToFront()
|
||||
self:RequestFocus()
|
||||
|
||||
sound.PlayFile("sound/buttons/combine_button2.wav", "", function()
|
||||
timer.Create("ixEventCreditsStart", 2, 1, function()
|
||||
sound.PlayFile("sound/willardnetworks/wn_forlorn.mp3", "", function(channel, status, error)
|
||||
if (IsValid(channel)) then
|
||||
channel:SetVolume(1)
|
||||
self.channel = channel
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function PANEL:OnRemove()
|
||||
timer.Remove("ixEventCreditsStart")
|
||||
|
||||
if (IsValid(self.channel)) then
|
||||
self.channel:Stop()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(w, h)
|
||||
surface.SetDrawColor(color_black)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
vgui.Register("ixEventCredits", PANEL, "Panel")
|
||||
190
gamemodes/darkrp/plugins/credits/derma/cl_creditseditor.lua
Normal file
190
gamemodes/darkrp/plugins/credits/derma/cl_creditseditor.lua
Normal file
@@ -0,0 +1,190 @@
|
||||
--[[
|
||||
| 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 padding = SScaleMin(10 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
self.titleValues = {}
|
||||
self.titleValues[1] = ix.config.Get("eventCreditsImageW", 1)
|
||||
self.titleValues[2] = ix.config.Get("eventCreditsImageH", 1)
|
||||
self.titleValues[3] = ix.config.Get("eventCreditsImageURL", "URL")
|
||||
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
Derma_DrawBackgroundBlur( this, 1 )
|
||||
end
|
||||
|
||||
self.content = self:Add("EditablePanel")
|
||||
self.content:SetSize(SScaleMin(700 / 3), SScaleMin(600 / 3))
|
||||
self.content:Center()
|
||||
self.content:MakePopup()
|
||||
self.content.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.creditsPanels = {}
|
||||
|
||||
self:CreateTopBar()
|
||||
|
||||
local saveOrEdit = self.content:Add("Panel")
|
||||
saveOrEdit:Dock(BOTTOM)
|
||||
saveOrEdit:SetTall(SScaleMin(50 / 3))
|
||||
|
||||
local save = saveOrEdit:Add("DButton")
|
||||
save:Dock(LEFT)
|
||||
save:SetWide(self.content:GetWide() * 0.5)
|
||||
save:SetText("SAVE")
|
||||
save:SetFont("MenuFontBoldNoClamp")
|
||||
save.DoClick = function()
|
||||
netstream.Start("EventCreditsSaveTitleValues", self.titleValues, PLUGIN.creditsMembers)
|
||||
end
|
||||
|
||||
local add = saveOrEdit:Add("DButton")
|
||||
add:Dock(FILL)
|
||||
add:SetText("ADD")
|
||||
add:SetFont("MenuFontBoldNoClamp")
|
||||
add.DoClick = function()
|
||||
Derma_StringRequest(
|
||||
"Name",
|
||||
"Input the string name of the player to appear on the credits.",
|
||||
"",
|
||||
function(text)
|
||||
PLUGIN.creditsMembers[#PLUGIN.creditsMembers + 1] = text
|
||||
self:CreateCreditsMembers()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
self.innerSelf = self.content:Add("DScrollPanel")
|
||||
self.innerSelf:SetTall(SScaleMin(600 / 3) - SScaleMin(120 / 3))
|
||||
self.innerSelf:Dock(TOP)
|
||||
|
||||
self:CreateTitleImageStuff()
|
||||
self:CreateCreditsMembers()
|
||||
end
|
||||
|
||||
function PANEL:CreateTopBar()
|
||||
self.topbar = self.content:Add("Panel")
|
||||
self.topbar:SetSize(self:GetWide(), SScaleMin(50 / 3))
|
||||
self.topbar:Dock(TOP)
|
||||
self.topbar:DockMargin(0, 0, 0, padding)
|
||||
self.topbar.Paint = function( this, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.titleText = self.topbar:Add("DLabel")
|
||||
self.titleText:SetFont("CharCreationBoldTitleNoClamp")
|
||||
self.titleText:Dock(LEFT)
|
||||
self.titleText:SetText("Event Credits Editor")
|
||||
self.titleText:DockMargin(padding, 0, 0, 0)
|
||||
self.titleText:SetContentAlignment(4)
|
||||
self.titleText:SizeToContents()
|
||||
|
||||
local exit = self.topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
exit:DockMargin(0, SScaleMin(15 / 3), padding, SScaleMin(15 / 3))
|
||||
exit:Dock(RIGHT)
|
||||
exit.DoClick = function()
|
||||
self:Remove()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
local divider = self.topbar:Add("Panel")
|
||||
self:CreateDivider(divider)
|
||||
end
|
||||
|
||||
function PANEL:CreateDivider(parent)
|
||||
parent:SetSize(1, self.topbar:GetTall())
|
||||
parent:Dock(RIGHT)
|
||||
parent:DockMargin(SScaleMin(5 / 3), padding, padding + SScaleMin(5 / 3), padding)
|
||||
parent.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawLine(0, 0, 0, h)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateTitleImageStuff()
|
||||
local title = self.innerSelf:Add("DLabel")
|
||||
title:Dock(TOP)
|
||||
title:SetFont("MenuFontLargerBoldNoFix")
|
||||
title:SetText("Title Image:")
|
||||
title:SizeToContents()
|
||||
title:SetContentAlignment(4)
|
||||
title:DockMargin(padding, 0, 0, padding)
|
||||
|
||||
for i = 1, 3 do
|
||||
local textEntry = self.innerSelf:Add("DTextEntry")
|
||||
textEntry:Dock(TOP)
|
||||
textEntry:SetTall(SScaleMin(30 / 3))
|
||||
textEntry:SetFont("MenuFontNoClamp")
|
||||
textEntry:DockMargin(padding, 0, padding, padding)
|
||||
textEntry:SetText((i == 1 and ix.config.Get("eventCreditsImageW", 1) or i == 2 and ix.config.Get("eventCreditsImageH", 1) or i == 3 and ix.config.Get("eventCreditsImageURL", "URL")))
|
||||
textEntry:SetPlaceholderText((i == 1 and "Title Image Width In Pixels" or i == 2 and "Title Image Height In Pixels" or i == 3 and "Title Image URL") or "")
|
||||
|
||||
textEntry.OnTextChanged = function()
|
||||
self.titleValues[i] = textEntry:GetText()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateCreditsMembers()
|
||||
for _, v in pairs(self.creditsPanels) do
|
||||
v:Remove()
|
||||
end
|
||||
|
||||
self.creditsPanels = {}
|
||||
|
||||
local title = self.innerSelf:Add("DLabel")
|
||||
title:Dock(TOP)
|
||||
title:SetFont("MenuFontLargerBoldNoFix")
|
||||
title:SetText("Credits Members:")
|
||||
title:SizeToContents()
|
||||
title:SetContentAlignment(4)
|
||||
title:DockMargin(padding, 0, 0, padding)
|
||||
table.insert(self.creditsPanels, title)
|
||||
|
||||
for key, name in pairs(PLUGIN.creditsMembers) do
|
||||
local panel = self.innerSelf:Add("Panel")
|
||||
panel:Dock(TOP)
|
||||
panel:SetTall(SScaleMin(25 / 3))
|
||||
panel:DockMargin(padding, 0, 0, padding)
|
||||
|
||||
local label = panel:Add("DLabel")
|
||||
label:Dock(LEFT)
|
||||
label:SetFont("MenuFontBoldNoClamp")
|
||||
label:SetText(name or "")
|
||||
label:SizeToContents()
|
||||
label:SetContentAlignment(4)
|
||||
|
||||
local remove = panel:Add("DImageButton")
|
||||
remove:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
remove:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
remove:DockMargin(padding, SScaleMin(5 / 3) / 2, 0, SScaleMin(5 / 3) / 2)
|
||||
remove:Dock(LEFT)
|
||||
remove.DoClick = function()
|
||||
panel:Remove()
|
||||
PLUGIN.creditsMembers[key] = nil
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
table.insert(self.creditsPanels, panel)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixEventCreditsEditor", PANEL, "Panel")
|
||||
83
gamemodes/darkrp/plugins/credits/sh_plugin.lua
Normal file
83
gamemodes/darkrp/plugins/credits/sh_plugin.lua
Normal file
@@ -0,0 +1,83 @@
|
||||
--[[
|
||||
| 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 ix = ix
|
||||
local CAMI = CAMI
|
||||
local netstream = netstream
|
||||
local pairs = pairs
|
||||
local player = player
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Credits"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "A custom credits plugin for event usage."
|
||||
PLUGIN.creditsMembers = PLUGIN.creditsMembers or {}
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
|
||||
CAMI.RegisterPrivilege({
|
||||
Name = "Helix - Manage Event Credits",
|
||||
MinAccess = "admin"
|
||||
})
|
||||
|
||||
ix.command.Add("EditCredits", {
|
||||
description = "Edit the event credits.",
|
||||
privilege = "Manage Event Credits",
|
||||
OnRun = function(self, client)
|
||||
netstream.Start(client, "EditEventCredits", PLUGIN.creditsMembers)
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("EventIntro", {
|
||||
description = "Showcase the event intro.",
|
||||
privilege = "Manage Event Credits",
|
||||
OnRun = function(self, client)
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
netstream.Start(v, "ShowcaseEventCredits", PLUGIN.creditsMembers)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("EventCredits", {
|
||||
description = "Showcase the event credits.",
|
||||
privilege = "Manage Event Credits",
|
||||
OnRun = function(self, client)
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
netstream.Start(v, "ShowcaseEventCredits", PLUGIN.creditsMembers, true)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.config.Add("eventCreditsImageW", 1, "The width of the event credits title image.", nil, {
|
||||
data = {min = 1, max = 3000},
|
||||
category = "Event Credits"
|
||||
})
|
||||
|
||||
ix.config.Add("eventCreditsImageH", 1, "The height of the event credits title image.", nil, {
|
||||
data = {min = 1, max = 3000},
|
||||
category = "Event Credits"
|
||||
})
|
||||
|
||||
ix.config.Add("eventCreditsImageURL", "URL", "The URL of the event credits title image.", nil, {
|
||||
category = "Event Credits"
|
||||
})
|
||||
|
||||
ix.config.Add("eventCreditsImageShownTimer", 5, "The amount of time the title image is shown.", nil, {
|
||||
data = {min = 1, max = 10},
|
||||
category = "Event Credits"
|
||||
})
|
||||
|
||||
ix.config.Add("eventCreditsSpeedOfRoller", 60, "The amount of time it takes for the credits to reach the top in seconds.", nil, {
|
||||
data = {min = 1, max = 1000},
|
||||
category = "Event Credits"
|
||||
})
|
||||
39
gamemodes/darkrp/plugins/credits/sv_plugin.lua
Normal file
39
gamemodes/darkrp/plugins/credits/sv_plugin.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
--[[
|
||||
| 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 ix = ix
|
||||
local netstream = netstream
|
||||
local isnumber = isnumber
|
||||
local tonumber = tonumber
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PLUGIN:PostLoadData()
|
||||
self.creditsMembers = ix.data.Get("EventCreditsMembers", {})
|
||||
end
|
||||
|
||||
netstream.Hook("EventCreditsSaveTitleValues", function(client, titleValues, creditsMembers)
|
||||
if !client:IsAdmin() then return end
|
||||
|
||||
if !isnumber(tonumber(titleValues[1])) or !isnumber(tonumber(titleValues[2])) then
|
||||
client:NotifyLocalized("Width or height of the title image was invalid.")
|
||||
return false
|
||||
end
|
||||
|
||||
ix.config.Set("eventCreditsImageW", tonumber(titleValues[1]))
|
||||
ix.config.Set("eventCreditsImageH", tonumber(titleValues[2]))
|
||||
ix.config.Set("eventCreditsImageURL", titleValues[3])
|
||||
|
||||
PLUGIN.creditsMembers = creditsMembers
|
||||
ix.data.Set("EventCreditsMembers", creditsMembers)
|
||||
|
||||
client:NotifyLocalized("Updated event credits.")
|
||||
end)
|
||||
Reference in New Issue
Block a user