This commit is contained in:
lifestorm
2024-08-04 22:55:00 +03:00
parent 0e770b2b49
commit 94063e4369
7342 changed files with 1718932 additions and 14 deletions

View File

@@ -0,0 +1,113 @@
--[[
| 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/
--]]
--luacheck: ignore global Derma_Select
function Derma_Select(text, title, list, defaultText, confirmText, confirmCallback, cancelText, cancelCallback)
local panel = vgui.Create("DFrame")
panel:SetTitle(title or "Titre de la sélection")
panel:SetDraggable(false)
panel:ShowCloseButton(false)
panel:SetDrawOnTop(true)
DFrameFixer(panel)
local innerPanel = vgui.Create("DPanel", panel)
innerPanel:SetPaintBackground(false)
local textPanel = vgui.Create("DLabel", innerPanel)
textPanel:SetText(text or "Texte de sélection")
textPanel:SetFont("MenuFontNoClamp")
textPanel:SizeToContents()
textPanel:SetContentAlignment(5)
textPanel:SetTextColor(color_white)
local buttonPanel = vgui.Create("DPanel", panel)
buttonPanel:SetTall(SScaleMin(30 / 3))
buttonPanel:SetPaintBackground(false)
local button = vgui.Create("DButton", buttonPanel)
button:SetText(confirmText or "OK")
button:SetFont("MenuFontNoClamp")
button:SizeToContents()
button:SetTall(SScaleMin(25 / 3))
button:SetWide(button:GetWide() + SScaleMin(20 / 3))
button:SetPos(SScaleMin(5 / 3), SScaleMin(5 / 3))
button:SetDisabled(true)
button:SetTextColor(Color(255, 255, 255, 30))
button.DoClick = function()
local text1, value = panel.comboBox:GetSelected()
if (confirmCallback) then
confirmCallback(value, text1)
end
panel:Close()
end
local comboBox = vgui.Create("DComboBox", innerPanel)
comboBox:SetValue(defaultText)
comboBox:SetTall(SScaleMin(25 / 3))
comboBox:SetTextInset( SScaleMin(8 / 3), 0 )
comboBox:SetFont("MenuFontNoClamp")
comboBox.OnSelect = function()
panel.button:SetDisabled(false)
panel.button:SetTextColor(Color(255, 255, 255, 255))
end
comboBox.PerformLayout = function(self)
self.DropButton:SetSize( SScaleMin(15 / 3), SScaleMin(15 / 3))
self.DropButton:AlignRight( 4 )
self.DropButton:CenterVertical()
-- Make sure the text color is updated
DButton.PerformLayout( self, self:GetWide(), self:GetTall() )
end
for _, v in pairs(list) do
comboBox:AddChoice(v.text, v.value)
end
local buttonCancel = vgui.Create("DButton", buttonPanel)
buttonCancel:SetText(cancelText or "Annuler")
buttonCancel:SizeToContents()
buttonCancel:SetTall(SScaleMin(25 / 3))
buttonCancel:SetFont("MenuFontNoClamp")
buttonCancel:SetWide(button:GetWide() + SScaleMin(20 / 3))
buttonCancel:SetPos(SScaleMin(5 / 3), SScaleMin(5 / 3))
buttonCancel.DoClick = function()
local text1, value = panel.comboBox:GetSelected()
if (cancelCallback) then
cancelCallback(text1, value)
end
panel:Close()
end
buttonCancel:MoveRightOf(button, SScaleMin(5 / 3))
buttonPanel:SetWide(button:GetWide() + SScaleMin(5 / 3) + buttonCancel:GetWide() + SScaleMin(10 / 3))
local w, h = textPanel:GetSize()
w = math.max(w, SScaleMin(400 / 3))
panel:SetSize(w + SScaleMin(50 / 3), h + SScaleMin(25 / 3) + SScaleMin(75 / 3) + SScaleMin(10 / 3))
panel:Center()
innerPanel:StretchToParent(SScaleMin(5 / 3), SScaleMin(25 / 3), SScaleMin(5 / 3), SScaleMin(45 / 3))
textPanel:StretchToParent(SScaleMin(5 / 3), SScaleMin(5 / 3), SScaleMin(5 / 3), SScaleMin(35 / 3))
comboBox:StretchToParent(SScaleMin(5 / 3), nil, SScaleMin(5 / 3), nil)
comboBox:AlignBottom(5)
comboBox:RequestFocus()
comboBox:MoveToFront()
buttonPanel:CenterHorizontal()
buttonPanel:AlignBottom(8)
panel.button = button
panel.comboBox = comboBox
end

View File

@@ -0,0 +1,97 @@
--[[
| 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/
--]]
DEFINE_BASECLASS("Panel")
surface.CreateFont( "ObjectiveUpdateFont", {
font = "Open Sans Bold",
extended = false,
size = math.Clamp(SScaleMin(24), 0, 72),
weight = 550,
antialias = true,
scanlines = 4,
shadow = true
} )
surface.CreateFont( "ObjectiveUpdateFontBackground", {
font = "Open Sans Bold",
extended = false,
size = math.Clamp(SScaleMin(24), 0, 72),
weight = 550,
antialias = true,
scanlines = 4,
blursize = 10
} )
local redClr = Color(205, 11, 11)
local PANEL = {}
function PANEL:DrawCorners(x, y, w, h)
local length = 12
local thickness = 3
surface.DrawRect(x, y, length, thickness) -- Top Left
surface.DrawRect(x, y, thickness, length)
surface.DrawRect(x + (w - length), y, length, thickness) -- Top Right
surface.DrawRect(x + (w - thickness), y, thickness, length)
surface.DrawRect(x, y + (h - length), thickness, length) -- Bottom Left
surface.DrawRect(x, y + (h - thickness), length, thickness)
surface.DrawRect(x + (w - thickness), y + (h - length), thickness, length) -- Bottom Right
surface.DrawRect(x + (w - length), y + (h - thickness), length, thickness)
end
function PANEL:Init()
self:SetSize(SScaleMin(800 / 3), 1)
self:Center()
self:CenterVertical(0.25)
surface.PlaySound("ambience/3d-sounds/ota/otachatter1.mp3")
surface.PlaySound("willardnetworks/datapad/open.wav")
self.objectiveText = self:Add("DLabel")
self.objectiveText:Dock(FILL)
self.objectiveText:SetFont("ObjectiveUpdateFont")
self.objectiveText:SetContentAlignment(5)
self.objectiveText:SetTextColor(redClr)
self.objectiveText:SetText("NEW OBJECTIVE RECEIVED")
self.secondObjectiveText = self:Add("DLabel")
self.secondObjectiveText:Dock(FILL)
self.secondObjectiveText:SetFont("ObjectiveUpdateFontBackground")
self.secondObjectiveText:SetContentAlignment(5)
self.secondObjectiveText:SetTextColor(redClr)
self.secondObjectiveText:SetText("NEW OBJECTIVE RECEIVED")
self:SizeTo(-1, SScaleMin(80 / 3), 0.4, 0, nil, function()
self:SizeTo(1, -1, 0.5, 2, nil, function()
surface.PlaySound("willardnetworks/datapad/close.wav")
self:Remove()
end)
end)
end
function PANEL:Paint(w, h)
if (!LocalPlayer():HasActiveCombineMask() and !LocalPlayer():IsDispatch()) then
return
end
surface.SetDrawColor(31, 30, 30, 75) -- Background
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(245, 138, 138, 75)
self:DrawCorners(0, 0, w, h)
end
vgui.Register("ixObjectiveUpdate", PANEL, "Panel")

View File

@@ -0,0 +1,137 @@
--[[
| 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/
--]]
hook.Add("LoadFonts", "ixCombineViewObjectives", function()
surface.CreateFont("ixCombineViewObjectives", {
font = "Courier New",
size = SScaleMin(16 / 3),
antialias = true,
weight = 400
})
end)
DEFINE_BASECLASS("DFrame")
local PANEL = {}
local animationTime = 1
AccessorFunc(PANEL, "bCommitOnClose", "CommitOnClose", FORCE_BOOL)
function PANEL:Init()
self:SetCommitOnClose(true)
self:SetSize(ScrW() / 4 > SScaleMin(200 / 3) and ScrW() / 4 or ScrW() / 2, ScrH() / 2 > SScaleMin(300 / 3) and ScrH() / 2 or ScrH())
self:Center()
DFrameFixer(self)
self.nameLabel = vgui.Create("DLabel", self)
self.nameLabel:SetFont("DebugFixedRadio")
self.nameLabel:SizeToContents()
self.nameLabel:Dock(TOP)
self.nameLabel:DockMargin(SScaleMin(5 / 3), SScaleMin(5 / 3), 0, 0)
self.dateLabel = vgui.Create("DLabel", self)
self.dateLabel:SetFont("DebugFixedRadio")
self.dateLabel:SizeToContents()
self.dateLabel:Dock(TOP)
self.dateLabel:DockMargin(SScaleMin(5 / 3), SScaleMin(5 / 3), 0, SScaleMin(5 / 3))
self.textEntry = vgui.Create("DTextEntry", self)
self.textEntry:SetMultiline(true)
self.textEntry:Dock(FILL)
self.textEntry:SetFont("ixCombineViewObjectives")
self.textEntry:SetTextColor(Color(200, 200, 200, 255))
self.textEntry:SetCursorColor(Color(200, 200, 200, 255))
self.textEntry.Paint = function(self, w, h)
surface.SetDrawColor(Color(0, 0, 0, 100))
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
surface.DrawOutlinedRect(0, 0, w, h)
self:DrawTextEntryText( self:GetTextColor(), self:GetHighlightColor(), self:GetCursorColor() )
end
end
function PANEL:Populate(data, bDontShow)
data = data or {}
self.oldText = data.text or ""
self.alpha = 255
local date = data.lastEditDate and ix.date.Construct(data.lastEditDate):format("%Y/%m/%d - %H:%M:%S") or L("unknown")
self:SetTitle(L("objectivesTitle"))
self.nameLabel:SetText(string.format("%s: %s", L("lastEdit"), data.lastEditPlayer or L("unknown")):utf8upper())
self.dateLabel:SetText(string.format("%s: %s", L("lastEditDate"), date):utf8upper())
self.textEntry:SetText(data.text or "")
if (!hook.Run("CanPlayerEditObjectives", LocalPlayer())) then
self.textEntry:SetEnabled(false)
end
if (!bDontShow) then
self.alpha = 0
self:SetAlpha(0)
self:MakePopup()
self:CreateAnimation(animationTime, {
index = 1,
target = {alpha = 255},
easing = "outQuint",
Think = function(animation, panel)
panel:SetAlpha(panel.alpha)
end
})
end
end
function PANEL:CommitChanges()
local text = string.Trim(self.textEntry:GetValue():utf8sub(1, 2000))
-- only update if there's something different so we can preserve the last editor if nothing changed
if (self.oldText != text) then
netstream.Start("ViewObjectivesUpdate", text)
if (IsValid(ix.gui.combine)) then
ix.gui.combine:AddLine("@cViewObjectivesUpdate")
end
end
end
function PANEL:Close()
if (self.bClosing) then
return
end
self.bClosing = true
if (self:GetCommitOnClose()) then
self:CommitChanges()
end
self:SetMouseInputEnabled(false)
self:SetKeyboardInputEnabled(false)
self:CreateAnimation(animationTime, {
target = {alpha = 0},
easing = "outQuint",
Think = function(animation, panel)
panel:SetAlpha(panel.alpha)
end,
OnComplete = function(animation, panel)
BaseClass.Close(panel)
end
})
end
vgui.Register("ixViewObjectives", PANEL, "DFrame")