mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
325
gamemodes/helix/plugins/willardinterface/cl_overrides.lua
Normal file
325
gamemodes/helix/plugins/willardinterface/cl_overrides.lua
Normal file
@@ -0,0 +1,325 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ix.hud.appendixColors = {
|
||||
["yellow"] = Color(255, 204, 0, 255),
|
||||
["red"] = Color(255, 78, 69, 255),
|
||||
["green"] = Color(128, 200, 97, 255),
|
||||
["blue"] = Color(85, 194, 240, 255)
|
||||
}
|
||||
|
||||
local function DrawAppendixTable(tooltip, data)
|
||||
for color, text in pairs(data) do
|
||||
text = tostring(text)
|
||||
|
||||
if (text != "" and text != " ") then
|
||||
text = L(text)
|
||||
end
|
||||
|
||||
local appendix = tooltip:Add("DLabel")
|
||||
appendix:SetText(text or "NOAPPENDIXTEXT")
|
||||
appendix:SetTextColor(ix.hud.appendixColors[color] or color_white)
|
||||
appendix:SetTextInset(15, 0)
|
||||
appendix:Dock(BOTTOM)
|
||||
appendix:DockMargin(0, 0, 0, 5)
|
||||
appendix:SetFont("ixSmallFont")
|
||||
appendix:SizeToContents()
|
||||
appendix:SetTall(appendix:GetTall() + 15)
|
||||
end
|
||||
end
|
||||
|
||||
function DFrameFixer(parent, bShouldNotPopup, bNoBackgroundBlur, bOverridePaint)
|
||||
if !bShouldNotPopup then
|
||||
parent:MakePopup()
|
||||
end
|
||||
|
||||
if !bNoBackgroundBlur then
|
||||
parent:SetBackgroundBlur(true)
|
||||
end
|
||||
parent:SetDeleteOnClose(true)
|
||||
|
||||
parent.PerformLayoutWindow = function(this)
|
||||
local titlePush = 0
|
||||
|
||||
if (IsValid(this.imgIcon)) then
|
||||
|
||||
this.imgIcon:SetPos(SScaleMin(5 / 3), SScaleMin(5 / 3))
|
||||
this.imgIcon:SetSize(SScaleMin(16 / 3), SScaleMin(16 / 3))
|
||||
titlePush = SScaleMin(16 / 3)
|
||||
end
|
||||
|
||||
this.btnClose:SetPos(this:GetWide() - SScaleMin(31 / 3) - (0 - SScaleMin(4 / 3)), 0)
|
||||
this.btnClose:SetSize(SScaleMin(31 / 3), SScaleMin(24 / 3))
|
||||
|
||||
this.btnMaxim:SetPos(this:GetWide() - SScaleMin(31 / 3) * 2 - (0 - SScaleMin(4 / 3)), 0)
|
||||
this.btnMaxim:SetSize(SScaleMin(31 / 3), SScaleMin(24 / 3))
|
||||
|
||||
this.btnMinim:SetPos(this:GetWide() - SScaleMin(31 / 3) * 3 - (0 - SScaleMin(4 / 3)), 0)
|
||||
this.btnMinim:SetSize(SScaleMin(31 / 3), SScaleMin(24 / 3))
|
||||
|
||||
this.lblTitle:SetPos(SScaleMin(8 / 3) + titlePush, SScaleMin(2 / 3))
|
||||
this.lblTitle:SetSize(this:GetWide() - SScaleMin(25 / 3) - titlePush, SScaleMin(20 / 3))
|
||||
end
|
||||
|
||||
if (!bOverridePaint) then
|
||||
parent.Paint = function(this, w, h)
|
||||
if (this.m_bBackgroundBlur) then
|
||||
Derma_DrawBackgroundBlur(this, this.m_fCreateTime)
|
||||
end
|
||||
|
||||
surface.SetDrawColor(Color(40, 40, 40, 100))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(Color(111, 111, 136, 255 / 100 * 30))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
|
||||
surface.DrawRect(0, 0, w, this.lblTitle:GetTall() + SScaleMin(5 / 3))
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
parent.lblTitle:SetFont("MenuFontNoClamp")
|
||||
parent.lblTitle:SizeToContents()
|
||||
end
|
||||
|
||||
function ix.hud.PopulateItemTooltip(tooltip, item, bShowcase)
|
||||
local labelName = item:GetData("labelName")
|
||||
local labelDesc = item:GetData("labelDescription")
|
||||
|
||||
local name = tooltip:AddRow("name")
|
||||
name:SetImportant()
|
||||
name:SetText((labelName and ("\"" .. labelName .. "\"")) or (item.GetName and item:GetName()) or L(item.name))
|
||||
name:SetMaxWidth(math.max(name:GetMaxWidth(), ScrW() * 0.5))
|
||||
name:SizeToContents()
|
||||
|
||||
local description = tooltip:AddRow("description")
|
||||
description:SetText(labelDesc and ("The label reads: \"" .. labelDesc .. "\"") or item:GetDescription() or "")
|
||||
description:SizeToContents()
|
||||
|
||||
if item.invID or bShowcase then
|
||||
if (item.GetColorAppendix) then
|
||||
if (isfunction(item.GetColorAppendix) and istable(item:GetColorAppendix()) and item:GetColorAppendix() != false) then
|
||||
DrawAppendixTable(tooltip, item:GetColorAppendix())
|
||||
end
|
||||
end
|
||||
|
||||
if (item.colorAppendix and istable(item.colorAppendix)) then
|
||||
DrawAppendixTable(tooltip, item.colorAppendix)
|
||||
end
|
||||
end
|
||||
|
||||
if (item.PopulateTooltip) then
|
||||
item:PopulateTooltip(tooltip)
|
||||
end
|
||||
|
||||
hook.Run("PopulateItemTooltip", tooltip, item)
|
||||
end
|
||||
|
||||
function Derma_Query( strText, strTitle, ... )
|
||||
|
||||
local Window = vgui.Create( "DFrame" )
|
||||
Window:SetTitle( strTitle or "Message Title (First Parameter)" )
|
||||
Window:SetDraggable( false )
|
||||
Window:ShowCloseButton( false )
|
||||
Window:SetDrawOnTop( true )
|
||||
DFrameFixer(Window)
|
||||
|
||||
local InnerPanel = vgui.Create( "DPanel", Window )
|
||||
InnerPanel:SetPaintBackground( false )
|
||||
|
||||
local Text = vgui.Create( "DLabel", InnerPanel )
|
||||
Text:SetText( strText or "Message Text (Second Parameter)" )
|
||||
Text:SetFont("MenuFontNoClamp")
|
||||
Text:SizeToContents()
|
||||
Text:SetContentAlignment( 5 )
|
||||
Text:SetTextColor( color_white )
|
||||
|
||||
local ButtonPanel = vgui.Create( "DPanel", Window )
|
||||
ButtonPanel:SetTall( SScaleMin(30 / 3) )
|
||||
ButtonPanel:SetPaintBackground( false )
|
||||
|
||||
-- Loop through all the options and create buttons for them.
|
||||
local NumOptions = 0
|
||||
local x = 5
|
||||
|
||||
for k=1, 8, 2 do
|
||||
|
||||
local Text = select( k, ... )
|
||||
if Text == nil then break end
|
||||
|
||||
local Func = select( k+1, ... ) or function() end
|
||||
|
||||
local Button = vgui.Create( "DButton", ButtonPanel )
|
||||
Button:SetText( Text )
|
||||
Button:SetFont("MenuFontNoClamp")
|
||||
Button:SizeToContents()
|
||||
Button:SetTall( SScaleMin(25 / 3) )
|
||||
Button:SetWide( Button:GetWide() + SScaleMin(20 / 3) )
|
||||
Button.DoClick = function() Window:Close() Func() end
|
||||
Button:SetPos( x, SScaleMin(5 / 3) )
|
||||
|
||||
x = x + Button:GetWide() + SScaleMin(5 / 3)
|
||||
|
||||
ButtonPanel:SetWide( x )
|
||||
NumOptions = NumOptions + 1
|
||||
|
||||
end
|
||||
|
||||
local w, h = Text:GetSize()
|
||||
|
||||
w = math.max( w, ButtonPanel:GetWide() )
|
||||
|
||||
Window:SetSize( w + SScaleMin(50 / 3), h + SScaleMin(25 / 3) + SScaleMin(45 / 3) + SScaleMin(10 / 3) )
|
||||
Window:Center()
|
||||
|
||||
InnerPanel:StretchToParent( SScaleMin(5 / 3), SScaleMin(25 / 3), SScaleMin(5 / 3), SScaleMin(45 / 3) )
|
||||
|
||||
Text:StretchToParent( SScaleMin(5 / 3), SScaleMin(5 / 3), SScaleMin(5 / 3), SScaleMin(5 / 3) )
|
||||
|
||||
ButtonPanel:CenterHorizontal()
|
||||
ButtonPanel:AlignBottom( 8 )
|
||||
|
||||
Window:DoModal()
|
||||
|
||||
if ( NumOptions == 0 ) then
|
||||
|
||||
Window:Close()
|
||||
Error( "Derma_Query: Created Query with no Options!?" )
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
return Window
|
||||
|
||||
end
|
||||
|
||||
function Derma_StringRequest( strTitle, strText, strDefaultText, fnEnter, fnCancel, strButtonText, strButtonCancelText, fuckYouModal )
|
||||
|
||||
local Window = vgui.Create( "DFrame" )
|
||||
Window:SetTitle( strTitle or "Message Title (First Parameter)" )
|
||||
Window:SetDraggable( false )
|
||||
Window:ShowCloseButton( false )
|
||||
Window:SetDrawOnTop( true )
|
||||
DFrameFixer(Window)
|
||||
|
||||
local InnerPanel = vgui.Create( "DPanel", Window )
|
||||
InnerPanel:SetPaintBackground( false )
|
||||
|
||||
local Text = vgui.Create( "DLabel", InnerPanel )
|
||||
Text:SetText( strText or "Message Text (Second Parameter)" )
|
||||
Text:SetFont("MenuFontNoClamp")
|
||||
Text:SizeToContents()
|
||||
Text:SetContentAlignment( 5 )
|
||||
Text:SetTextColor( color_white )
|
||||
|
||||
local TextEntry = vgui.Create( "DTextEntry", InnerPanel )
|
||||
TextEntry:SetText( strDefaultText or "" )
|
||||
TextEntry:SetFont("MenuFontNoClamp")
|
||||
TextEntry.OnEnter = function() Window:Close() fnEnter( TextEntry:GetValue() ) end
|
||||
TextEntry:SetTall(Text:GetTall())
|
||||
|
||||
local ButtonPanel = vgui.Create( "DPanel", Window )
|
||||
ButtonPanel:SetTall( SScaleMin(30 / 3) )
|
||||
ButtonPanel:SetPaintBackground( false )
|
||||
|
||||
local Button = vgui.Create( "DButton", ButtonPanel )
|
||||
Button:SetText( strButtonText 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.DoClick = function() Window:Close() fnEnter( TextEntry:GetValue() ) end
|
||||
|
||||
local ButtonCancel = vgui.Create( "DButton", ButtonPanel )
|
||||
ButtonCancel:SetText( strButtonCancelText or "Cancel" )
|
||||
ButtonCancel:SetFont("MenuFontNoClamp")
|
||||
ButtonCancel:SizeToContents()
|
||||
ButtonCancel:SetTall( SScaleMin(25 / 3) )
|
||||
ButtonCancel:SetWide( Button:GetWide() + SScaleMin(20 / 3) )
|
||||
ButtonCancel:SetPos( SScaleMin(5 / 3), SScaleMin(5 / 3) )
|
||||
ButtonCancel.DoClick = function() Window:Close() if ( fnCancel ) then fnCancel( TextEntry:GetValue() ) end end
|
||||
ButtonCancel:MoveRightOf( Button, SScaleMin(5 / 3) )
|
||||
|
||||
ButtonPanel:SetWide( Button:GetWide() + SScaleMin(5 / 3) + ButtonCancel:GetWide() + SScaleMin(10 / 3) )
|
||||
|
||||
local w, h = Text:GetSize()
|
||||
w = math.max( w, SScaleMin(400 / 3) )
|
||||
|
||||
Window:SetSize( w + SScaleMin(50 / 3), h + SScaleMin(25 / 3) + SScaleMin(75 / 3) + SScaleMin(10 / 3) )
|
||||
Window:Center()
|
||||
|
||||
InnerPanel:StretchToParent( SScaleMin(5 / 3), SScaleMin(25 / 3), SScaleMin(5 / 3), SScaleMin(45 / 3) )
|
||||
|
||||
Text:StretchToParent( SScaleMin(5 / 3), SScaleMin(5 / 3), SScaleMin(5 / 3), SScaleMin(35 / 3) )
|
||||
|
||||
TextEntry:StretchToParent( SScaleMin(5 / 3), nil, SScaleMin(5 / 3), nil )
|
||||
TextEntry:AlignBottom( 5 )
|
||||
|
||||
TextEntry:RequestFocus()
|
||||
TextEntry:SelectAllText( true )
|
||||
|
||||
ButtonPanel:CenterHorizontal()
|
||||
ButtonPanel:AlignBottom( 8 )
|
||||
|
||||
if !fuckYouModal then
|
||||
Window:DoModal()
|
||||
end
|
||||
|
||||
return Window
|
||||
|
||||
end
|
||||
|
||||
function PLUGIN:StartChat()
|
||||
if IsValid(ix.gui.chat) then
|
||||
if (IsValid(self.disableAutoScroll)) then
|
||||
self.disableAutoScroll:Remove()
|
||||
end
|
||||
|
||||
self.disableAutoScroll = vgui.Create("DButton")
|
||||
self.disableAutoScroll:SetText(ix.option.Get("disableAutoScrollChat", false) and "Activé Auto Scroll" or "Désactivé Auto Scroll")
|
||||
self.disableAutoScroll:SetFont("DebugFixedRadio")
|
||||
self.disableAutoScroll:SizeToContents()
|
||||
self.disableAutoScroll.Paint = nil
|
||||
|
||||
self.disableAutoScroll.Think = function(this)
|
||||
if IsValid(ix.gui.chat) then
|
||||
if !ix.gui.chat.GetPos or !ix.gui.chat.GetWide then return end
|
||||
if !IsValid(self.disableAutoScroll) or (IsValid(self.disableAutoScroll) and !self.disableAutoScroll.GetWide) then return end
|
||||
local x, y = ix.gui.chat:GetPos()
|
||||
y = y - SScaleMin(20 / 3)
|
||||
|
||||
x = x + ix.gui.chat:GetWide() - self.disableAutoScroll:GetWide()
|
||||
self.disableAutoScroll:SetPos(x, y)
|
||||
end
|
||||
end
|
||||
|
||||
self.disableAutoScroll.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
if ix.option.Get("disableAutoScrollChat", false) then
|
||||
ix.option.Set("disableAutoScrollChat", false)
|
||||
else
|
||||
ix.option.Set("disableAutoScrollChat", true)
|
||||
end
|
||||
|
||||
self.disableAutoScroll:SetText(ix.option.Get("disableAutoScrollChat", false) and "Activé Auto Scroll" or "Désactivé Auto Scroll")
|
||||
self.disableAutoScroll:SizeToContents()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:FinishChat()
|
||||
if self.disableAutoScroll and IsValid(self.disableAutoScroll) then
|
||||
self.disableAutoScroll:Remove()
|
||||
end
|
||||
end
|
||||
196
gamemodes/helix/plugins/willardinterface/derma/cl_bar.lua
Normal file
196
gamemodes/helix/plugins/willardinterface/derma/cl_bar.lua
Normal file
@@ -0,0 +1,196 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
-- bar manager
|
||||
-- this manages positions for bar panels
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "padding", "Padding", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW() * 0.35, ScrH())
|
||||
self:SetPos(4, 4)
|
||||
self:ParentToHUD()
|
||||
|
||||
self.bars = {}
|
||||
self.padding = 2
|
||||
|
||||
-- add bars that were registered before manager creation
|
||||
for _, v in ipairs(ix.bar.list) do
|
||||
v.panel = self:AddBar(v.index, v.color, v.priority)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetAll()
|
||||
return self.bars
|
||||
end
|
||||
|
||||
function PANEL:Clear()
|
||||
for k, v in ipairs(self.bars) do
|
||||
v:Remove()
|
||||
|
||||
table.remove(self.bars, k)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:AddBar(index, color, priority)
|
||||
local panel = self:Add("ixInfoBar")
|
||||
panel:SetSize(self:GetWide(), BAR_HEIGHT)
|
||||
panel:SetVisible(false)
|
||||
panel:SetID(index)
|
||||
panel:SetColor(color)
|
||||
panel:SetPriority(priority)
|
||||
|
||||
self.bars[#self.bars + 1] = panel
|
||||
self:Sort()
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:RemoveBar(panel)
|
||||
local toRemove
|
||||
|
||||
for k, v in ipairs(self.bars) do
|
||||
if (v == panel) then
|
||||
toRemove = k
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (toRemove) then
|
||||
table.remove(self.bars, toRemove)
|
||||
end
|
||||
|
||||
panel:Remove()
|
||||
self:Sort()
|
||||
end
|
||||
|
||||
-- sort bars by priority
|
||||
function PANEL:Sort()
|
||||
table.sort(self.bars, function(a, b)
|
||||
return a:GetPriority() < b:GetPriority()
|
||||
end)
|
||||
end
|
||||
|
||||
-- update target Y positions
|
||||
function PANEL:Organize()
|
||||
local currentY = 0
|
||||
|
||||
for _, v in ipairs(self.bars) do
|
||||
if (!v:IsVisible()) then
|
||||
continue
|
||||
end
|
||||
|
||||
v:SetPos(0, currentY)
|
||||
|
||||
currentY = currentY + self.padding + v:GetTall()
|
||||
end
|
||||
|
||||
self:SetSize(self:GetWide(), currentY)
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
local menu = (IsValid(ix.gui.characterMenu) and !ix.gui.characterMenu:IsClosing()) and ix.gui.characterMenu
|
||||
or IsValid(ix.gui.menu) and ix.gui.menu
|
||||
local fraction = menu and 1 - menu.currentAlpha / 255 or 1
|
||||
|
||||
self:SetAlpha(255 * fraction)
|
||||
|
||||
-- don't update bars when not visible
|
||||
if (fraction == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
local curTime = CurTime()
|
||||
local bShouldHide = hook.Run("ShouldHideBars")
|
||||
local bAlwaysShow = ix.option.Get("alwaysShowBars", false)
|
||||
|
||||
for _, v in ipairs(self.bars) do
|
||||
v:SetVisible(false)
|
||||
end
|
||||
|
||||
self:Organize()
|
||||
end
|
||||
|
||||
function PANEL:OnRemove()
|
||||
self:Clear()
|
||||
end
|
||||
|
||||
vgui.Register("ixInfoBarManager", PANEL, "Panel")
|
||||
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "index", "ID", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "color", "Color")
|
||||
AccessorFunc(PANEL, "priority", "Priority", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "value", "Value", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "delta", "Delta", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "lifetime", "Lifetime", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self.value = 0
|
||||
self.delta = 0
|
||||
self.lifetime = 0
|
||||
|
||||
self.bar = self:Add("DPanel")
|
||||
self.bar:SetPaintedManually(true)
|
||||
self.bar:Dock(FILL)
|
||||
self.bar:DockMargin(2, 2, 2, 2)
|
||||
self.bar.Paint = function(this, width, height)
|
||||
width = width * math.min(self.delta, 1)
|
||||
|
||||
derma.SkinFunc("PaintInfoBar", self, width, height, self.color)
|
||||
end
|
||||
|
||||
self.label = self:Add("DLabel")
|
||||
self.label:SetFont("ixSmallFont")
|
||||
self.label:SetContentAlignment(5)
|
||||
self.label:SetText("")
|
||||
self.label:SetTextColor(Color(240, 240, 240))
|
||||
self.label:SetExpensiveShadow(2, Color(20, 20, 20))
|
||||
self.label:SetPaintedManually(true)
|
||||
self.label:SizeToContents()
|
||||
self.label:Dock(FILL)
|
||||
end
|
||||
|
||||
function PANEL:SetText(text)
|
||||
self.label:SetText(text)
|
||||
self.label:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
local value = math.Approach(self.delta, self.value, FrameTime())
|
||||
-- fix for smooth bar changes (increase of 0.01 every 0.1sec for example)
|
||||
if (value == self.value and self.delta != self.value and self.value != 0 and self.value != 1) then
|
||||
value = self.delta
|
||||
end
|
||||
|
||||
self.delta = value
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(230, 230, 230, 15)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
surface.DrawOutlinedRect(0, 0, width, height)
|
||||
|
||||
self.bar:PaintManual()
|
||||
|
||||
DisableClipping(true)
|
||||
self.label:PaintManual()
|
||||
DisableClipping(false)
|
||||
end
|
||||
|
||||
vgui.Register("ixInfoBar", PANEL, "Panel")
|
||||
|
||||
if (IsValid(ix.gui.bars)) then
|
||||
ix.gui.bars:Remove()
|
||||
ix.gui.bars = vgui.Create("ixInfoBarManager")
|
||||
end
|
||||
474
gamemodes/helix/plugins/willardinterface/derma/cl_business.lua
Normal file
474
gamemodes/helix/plugins/willardinterface/derma/cl_business.lua
Normal file
@@ -0,0 +1,474 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
function PANEL:Init()
|
||||
-- being relative.
|
||||
local size = 120
|
||||
self:SetSize(size, size * 1.4)
|
||||
end
|
||||
|
||||
function PANEL:SetItem(itemTable)
|
||||
self.itemName = L(itemTable.name):utf8lower()
|
||||
|
||||
self.price = self:Add("DLabel")
|
||||
self.price:Dock(BOTTOM)
|
||||
self.price:SetText(itemTable.price and ix.currency.Get(itemTable.price) or L"free":utf8upper())
|
||||
self.price:SetContentAlignment(5)
|
||||
self.price:SetTextColor(color_white)
|
||||
self.price:SetFont("ixSmallFont")
|
||||
self.price:SetExpensiveShadow(1, Color(0, 0, 0, 200))
|
||||
|
||||
self.name = self:Add("DLabel")
|
||||
self.name:Dock(TOP)
|
||||
self.name:SetText(itemTable.GetName and itemTable:GetName() or L(itemTable.name))
|
||||
self.name:SetContentAlignment(5)
|
||||
self.name:SetTextColor(color_white)
|
||||
self.name:SetFont("ixSmallFont")
|
||||
self.name:SetExpensiveShadow(1, Color(0, 0, 0, 200))
|
||||
self.name.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 75)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.icon = self:Add("SpawnIcon")
|
||||
self.icon:SetZPos(1)
|
||||
self.icon:SetSize(self:GetWide(), self:GetWide())
|
||||
self.icon:Dock(FILL)
|
||||
self.icon:DockMargin(5, 5, 5, 10)
|
||||
self.icon:InvalidateLayout(true)
|
||||
self.icon:SetModel(itemTable:GetModel(), itemTable:GetSkin())
|
||||
self.icon:SetHelixTooltip(function(tooltip)
|
||||
ix.hud.PopulateItemTooltip(tooltip, itemTable)
|
||||
end)
|
||||
self.icon.itemTable = itemTable
|
||||
self.icon.DoClick = function(this)
|
||||
if (!IsValid(ix.gui.checkout) and (this.nextClick or 0) < CurTime()) then
|
||||
local parent = ix.gui.business
|
||||
parent:BuyItem(itemTable.uniqueID)
|
||||
|
||||
surface.PlaySound("buttons/button14.wav")
|
||||
this.nextClick = CurTime() + 0.5
|
||||
end
|
||||
end
|
||||
self.icon.PaintOver = function(this)
|
||||
if (itemTable and itemTable.PaintOver) then
|
||||
local w, h = this:GetSize()
|
||||
|
||||
itemTable.PaintOver(this, itemTable, w, h)
|
||||
end
|
||||
end
|
||||
|
||||
if ((itemTable.iconCam and !ICON_RENDER_QUEUE[itemTable.uniqueID]) or itemTable.forceRender) then
|
||||
local iconCam = itemTable.iconCam
|
||||
iconCam = {
|
||||
cam_pos = iconCam.pos,
|
||||
cam_fov = iconCam.fov,
|
||||
cam_ang = iconCam.ang,
|
||||
}
|
||||
ICON_RENDER_QUEUE[itemTable.uniqueID] = true
|
||||
|
||||
self.icon:RebuildSpawnIconEx(
|
||||
iconCam
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixBusinessItem", PANEL, "DPanel")
|
||||
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
ix.gui.business = self
|
||||
|
||||
self:SetSize(self:GetParent():GetSize())
|
||||
|
||||
self.categories = self:Add("DScrollPanel")
|
||||
self.categories:Dock(LEFT)
|
||||
self.categories:SetWide(260)
|
||||
self.categories.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 150)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
self.categories:DockPadding(5, 5, 5, 5)
|
||||
self.categories:DockMargin(0, 46, 0, 0)
|
||||
self.categoryPanels = {}
|
||||
|
||||
self.scroll = self:Add("DScrollPanel")
|
||||
self.scroll:Dock(FILL)
|
||||
|
||||
self.search = self:Add("DTextEntry")
|
||||
self.search:Dock(TOP)
|
||||
self.search:SetTall(36)
|
||||
self.search:SetFont("ixMediumFont")
|
||||
self.search:DockMargin(10 + self:GetWide() * 0.35, 0, 5, 5)
|
||||
self.search.OnTextChanged = function(this)
|
||||
local text = self.search:GetText():utf8lower()
|
||||
|
||||
if (self.selected) then
|
||||
self:LoadItems(self.selected.category, text:find("%S") and text or nil)
|
||||
self.scroll:InvalidateLayout()
|
||||
end
|
||||
end
|
||||
self.search.PaintOver = function(this, cw, ch)
|
||||
if (self.search:GetValue() == "" and !self.search:HasFocus()) then
|
||||
ix.util.DrawText("V", 10, ch/2 - 1, color_black, 3, 1, "ixIconsSmall")
|
||||
end
|
||||
end
|
||||
|
||||
self.itemList = self.scroll:Add("DIconLayout")
|
||||
self.itemList:Dock(TOP)
|
||||
self.itemList:DockMargin(10, 1, 5, 5)
|
||||
self.itemList:SetSpaceX(10)
|
||||
self.itemList:SetSpaceY(10)
|
||||
self.itemList:SetMinimumSize(128, 400)
|
||||
|
||||
self.checkout = self:Add("DButton")
|
||||
self.checkout:Dock(BOTTOM)
|
||||
self.checkout:SetTextColor(color_white)
|
||||
self.checkout:SetTall(36)
|
||||
self.checkout:SetFont("ixMediumFont")
|
||||
self.checkout:DockMargin(10, 10, 0, 0)
|
||||
self.checkout:SetExpensiveShadow(1, Color(0, 0, 0, 150))
|
||||
self.checkout:SetText(L("checkout", 0))
|
||||
self.checkout.DoClick = function()
|
||||
if (!IsValid(ix.gui.checkout) and self:GetCartCount() > 0) then
|
||||
vgui.Create("ixBusinessCheckout"):SetCart(self.cart)
|
||||
end
|
||||
end
|
||||
|
||||
self.cart = {}
|
||||
|
||||
local dark = Color(0, 0, 0, 50)
|
||||
local first = true
|
||||
|
||||
for k, v in pairs(ix.item.list) do
|
||||
if (hook.Run("CanPlayerUseBusiness", LocalPlayer(), k) == false) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (!self.categoryPanels[L(v.category)]) then
|
||||
self.categoryPanels[L(v.category)] = v.category
|
||||
end
|
||||
end
|
||||
|
||||
for category, realName in SortedPairs(self.categoryPanels) do
|
||||
local button = self.categories:Add("DButton")
|
||||
button:SetTall(36)
|
||||
button:SetText(category)
|
||||
button:Dock(TOP)
|
||||
button:SetTextColor(color_white)
|
||||
button:DockMargin(5, 5, 5, 0)
|
||||
button:SetFont("ixMediumFont")
|
||||
button:SetExpensiveShadow(1, Color(0, 0, 0, 150))
|
||||
button.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(self.selected == this and ix.config.Get("color") or dark)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(0, 0, 0, 50)
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
button.DoClick = function(this)
|
||||
if (self.selected != this) then
|
||||
self.selected = this
|
||||
self:LoadItems(realName)
|
||||
timer.Simple(0.01, function()
|
||||
self.scroll:InvalidateLayout()
|
||||
end)
|
||||
end
|
||||
end
|
||||
button.category = realName
|
||||
|
||||
if (first) then
|
||||
self.selected = button
|
||||
first = false
|
||||
end
|
||||
|
||||
self.categoryPanels[realName] = button
|
||||
end
|
||||
|
||||
if (self.selected) then
|
||||
self:LoadItems(self.selected.category)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetCartCount()
|
||||
local count = 0
|
||||
|
||||
for _, v in pairs(self.cart) do
|
||||
count = count + v
|
||||
end
|
||||
|
||||
return count
|
||||
end
|
||||
|
||||
function PANEL:BuyItem(uniqueID)
|
||||
self.cart[uniqueID] = (self.cart[uniqueID] or 0) + 1
|
||||
self.checkout:SetText(L("checkout", self:GetCartCount()))
|
||||
end
|
||||
|
||||
function PANEL:LoadItems(category, search)
|
||||
category = category or "misc"
|
||||
local items = ix.item.list
|
||||
|
||||
self.itemList:Clear()
|
||||
self.itemList:InvalidateLayout(true)
|
||||
|
||||
for uniqueID, itemTable in SortedPairsByMemberValue(items, "name") do
|
||||
if (hook.Run("CanPlayerUseBusiness", LocalPlayer(), uniqueID) == false) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (itemTable.category == category) then
|
||||
if (search and search != "" and !L(itemTable.name):utf8lower():find(search, 1, true)) then
|
||||
continue
|
||||
end
|
||||
|
||||
self.itemList:Add("ixBusinessItem"):SetItem(itemTable)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetPage()
|
||||
end
|
||||
|
||||
function PANEL:GetPageItems()
|
||||
end
|
||||
|
||||
vgui.Register("ixBusiness", PANEL, "EditablePanel")
|
||||
|
||||
DEFINE_BASECLASS("DFrame")
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
if (IsValid(ix.gui.checkout)) then
|
||||
ix.gui.checkout:Remove()
|
||||
end
|
||||
|
||||
ix.gui.checkout = self
|
||||
|
||||
self:SetTitle(L("checkout", 0))
|
||||
self:SetSize(ScrW() / 4 > 200 and ScrW() / 4 or ScrW() / 2, ScrH() / 2 > 300 and ScrH() / 2 or ScrH())
|
||||
self:MakePopup()
|
||||
self:Center()
|
||||
self:SetBackgroundBlur(true)
|
||||
self:SetSizable(true)
|
||||
|
||||
self.items = self:Add("DScrollPanel")
|
||||
self.items:Dock(FILL)
|
||||
self.items.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 100)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
self.items:DockMargin(0, 0, 0, 4)
|
||||
|
||||
self.buy = self:Add("DButton")
|
||||
self.buy:Dock(BOTTOM)
|
||||
self.buy:SetText(L"purchase")
|
||||
self.buy:SetTextColor(color_white)
|
||||
self.buy.DoClick = function(this)
|
||||
if ((this.nextClick or 0) < CurTime()) then
|
||||
this.nextClick = CurTime() + 0.5
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
if (self.preventBuy) then
|
||||
self.finalGlow:SetText(self.final:GetText())
|
||||
self.finalGlow:SetAlpha(255)
|
||||
self.finalGlow:AlphaTo(0, 0.5)
|
||||
|
||||
return surface.PlaySound("buttons/button11.wav")
|
||||
end
|
||||
|
||||
net.Start("ixBusinessBuy")
|
||||
net.WriteTable(self.itemData)
|
||||
net.SendToServer()
|
||||
|
||||
self.itemData = {}
|
||||
self.items:Remove()
|
||||
self.data:Remove()
|
||||
self.buy:Remove()
|
||||
self:ShowCloseButton(false)
|
||||
|
||||
if (IsValid(ix.gui.business)) then
|
||||
ix.gui.business.cart = {}
|
||||
ix.gui.business.checkout:SetText(L("checkout", 0))
|
||||
end
|
||||
|
||||
self.text = self:Add("DLabel")
|
||||
self.text:Dock(FILL)
|
||||
self.text:SetContentAlignment(5)
|
||||
self.text:SetTextColor(color_white)
|
||||
self.text:SetText(L"purchasing")
|
||||
self.text:SetFont("ixMediumFont")
|
||||
|
||||
net.Receive("ixBusinessResponse", function()
|
||||
if (IsValid(self)) then
|
||||
self.text:SetText(L"buyGood")
|
||||
self.done = true
|
||||
self:ShowCloseButton(true)
|
||||
|
||||
surface.PlaySound("buttons/button3.wav")
|
||||
end
|
||||
end)
|
||||
|
||||
timer.Simple(4, function()
|
||||
if (IsValid(self) and !self.done) then
|
||||
self.text:SetText(L"buyFailed")
|
||||
self:ShowCloseButton(true)
|
||||
|
||||
surface.PlaySound("buttons/button11.wav")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
self.data = self:Add("DPanel")
|
||||
self.data:Dock(BOTTOM)
|
||||
self.data:SetTall(64)
|
||||
self.data:DockMargin(0, 0, 0, 4)
|
||||
|
||||
self.current = self.data:Add("DLabel")
|
||||
self.current:SetFont("ixSmallFont")
|
||||
self.current:SetContentAlignment(6)
|
||||
self.current:SetTextColor(color_white)
|
||||
self.current:Dock(TOP)
|
||||
self.current:SetTextInset(4, 0)
|
||||
|
||||
self.total = self.data:Add("DLabel")
|
||||
self.total:SetFont("ixSmallFont")
|
||||
self.total:SetContentAlignment(6)
|
||||
self.total:SetTextColor(color_white)
|
||||
self.total:Dock(TOP)
|
||||
self.total:SetTextInset(4, 0)
|
||||
|
||||
local line = self.data:Add("DPanel")
|
||||
line:SetTall(1)
|
||||
line:DockMargin(128, 0, 4, 0)
|
||||
line:Dock(TOP)
|
||||
line.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(255, 255, 255, 150)
|
||||
surface.DrawLine(0, 0, w, 0)
|
||||
end
|
||||
|
||||
self.final = self.data:Add("DLabel")
|
||||
self.final:SetFont("ixSmallFont")
|
||||
self.final:SetContentAlignment(6)
|
||||
self.final:SetTextColor(color_white)
|
||||
self.final:Dock(TOP)
|
||||
self.final:SetTextInset(4, 0)
|
||||
|
||||
self.finalGlow = self.final:Add("DLabel")
|
||||
self.finalGlow:Dock(FILL)
|
||||
self.finalGlow:SetFont("ixSmallFont")
|
||||
self.finalGlow:SetTextColor(color_white)
|
||||
self.finalGlow:SetContentAlignment(6)
|
||||
self.finalGlow:SetAlpha(0)
|
||||
self.finalGlow:SetTextInset(4, 0)
|
||||
|
||||
|
||||
self:SetFocusTopLevel(true)
|
||||
self.itemData = {}
|
||||
self:OnQuantityChanged()
|
||||
end
|
||||
|
||||
function PANEL:OnQuantityChanged()
|
||||
local price = 0
|
||||
local money = LocalPlayer():GetCharacter():GetMoney()
|
||||
local valid = 0
|
||||
|
||||
for k, v in pairs(self.itemData) do
|
||||
local itemTable = ix.item.list[k]
|
||||
|
||||
if (itemTable and v > 0) then
|
||||
valid = valid + 1
|
||||
price = price + (v * (itemTable.price or 0))
|
||||
end
|
||||
end
|
||||
|
||||
self.current:SetText(L"currentMoney"..ix.currency.Get(money))
|
||||
self.total:SetText("- "..ix.currency.Get(price))
|
||||
self.final:SetText(L"moneyLeft"..ix.currency.Get(money - price))
|
||||
self.final:SetTextColor((money - price) >= 0 and Color(46, 204, 113) or Color(217, 30, 24))
|
||||
|
||||
self.preventBuy = (money - price) < 0 or valid == 0
|
||||
end
|
||||
|
||||
function PANEL:SetCart(items)
|
||||
self.itemData = items
|
||||
|
||||
for k, v in SortedPairs(items) do
|
||||
local itemTable = ix.item.list[k]
|
||||
|
||||
if (itemTable) then
|
||||
local slot = self.items:Add("DPanel")
|
||||
slot:SetTall(36)
|
||||
slot:Dock(TOP)
|
||||
slot:DockMargin(5, 5, 5, 0)
|
||||
|
||||
slot.icon = slot:Add("SpawnIcon")
|
||||
slot.icon:SetPos(2, 2)
|
||||
slot.icon:SetSize(32, 32)
|
||||
slot.icon:SetModel(itemTable:GetModel())
|
||||
slot.icon:SetTooltip()
|
||||
|
||||
slot.name = slot:Add("DLabel")
|
||||
slot.name:SetPos(40, 2)
|
||||
slot.name:SetFont("ixChatFont")
|
||||
slot.name:SetText(string.format(
|
||||
"%s (%s)",
|
||||
L(itemTable.GetName and itemTable:GetName() or L(itemTable.name)),
|
||||
itemTable.price and ix.currency.Get(itemTable.price) or L"free":utf8upper()
|
||||
))
|
||||
slot.name:SetTextColor(color_white)
|
||||
slot.name:SizeToContents()
|
||||
slot.name:DockMargin(40, 0, 0, 0)
|
||||
slot.name:Dock(FILL)
|
||||
|
||||
slot.quantity = slot:Add("DTextEntry")
|
||||
slot.quantity:SetSize(32, 32)
|
||||
slot.quantity:Dock(RIGHT)
|
||||
slot.quantity:DockMargin(4, 4, 4, 4)
|
||||
slot.quantity:SetContentAlignment(5)
|
||||
slot.quantity:SetNumeric(true)
|
||||
slot.quantity:SetText(v)
|
||||
slot.quantity:SetFont("ixChatFont")
|
||||
slot.quantity.OnTextChanged = function(this)
|
||||
local value = tonumber(this:GetValue())
|
||||
|
||||
if (value) then
|
||||
items[k] = math.Clamp(math.Round(value), 0, 10)
|
||||
self:OnQuantityChanged()
|
||||
else
|
||||
this:SetValue(1)
|
||||
end
|
||||
end
|
||||
else
|
||||
items[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
self:OnQuantityChanged()
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (!self:HasFocus()) then
|
||||
self:MakePopup()
|
||||
end
|
||||
|
||||
BaseClass.Think(self)
|
||||
end
|
||||
|
||||
vgui.Register("ixBusinessCheckout", PANEL, "DFrame")
|
||||
|
||||
hook.Add("CreateMenuButtons", "ixBusiness", function(tabs)
|
||||
end)
|
||||
669
gamemodes/helix/plugins/willardinterface/derma/cl_character.lua
Normal file
669
gamemodes/helix/plugins/willardinterface/derma/cl_character.lua
Normal file
@@ -0,0 +1,669 @@
|
||||
--[[
|
||||
| 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 audioFadeInTime = 2
|
||||
local animationTime = 0.5
|
||||
|
||||
-- character menu panel
|
||||
DEFINE_BASECLASS("ixSubpanelParent")
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:UpdateLocations()
|
||||
self:SetSize(self:GetParent():GetSize())
|
||||
self:SetPos(0, 0)
|
||||
self:SetZPos(5)
|
||||
|
||||
self.childPanels = {}
|
||||
self.subpanels = {}
|
||||
self.activeSubpanel = ""
|
||||
|
||||
self.currentDimAmount = 0
|
||||
self.currentY = 0
|
||||
self.currentScale = 1
|
||||
self.currentAlpha = 255
|
||||
self.targetDimAmount = 0
|
||||
self.targetScale = 0
|
||||
end
|
||||
|
||||
function PANEL:Dim(length, callback)
|
||||
length = length or animationTime
|
||||
self.currentDimAmount = 0
|
||||
|
||||
self:CreateAnimation(length, {
|
||||
target = {
|
||||
currentDimAmount = self.targetDimAmount,
|
||||
currentScale = self.targetScale,
|
||||
OnComplete = callback
|
||||
},
|
||||
easing = "outCubic"
|
||||
})
|
||||
|
||||
self:OnDim()
|
||||
end
|
||||
|
||||
function PANEL:UpdateLocations()
|
||||
for i = 1, #ix.characters do
|
||||
local id = ix.characters[i]
|
||||
local foundCharacter = ix.char.loaded[id]
|
||||
|
||||
if (!foundCharacter) then
|
||||
continue
|
||||
end
|
||||
|
||||
local location = foundCharacter.vars.location or false
|
||||
local locationConfig = ix.config.Get("Location", false) or false
|
||||
|
||||
if location and locationConfig then
|
||||
if location != locationConfig then
|
||||
table.remove(ix.characters, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Undim(length, callback)
|
||||
length = length or animationTime
|
||||
self.currentDimAmount = self.targetDimAmount
|
||||
|
||||
self:CreateAnimation(length, {
|
||||
target = {
|
||||
currentDimAmount = 0,
|
||||
currentScale = 1
|
||||
},
|
||||
easing = "outCubic",
|
||||
OnComplete = callback
|
||||
})
|
||||
|
||||
self:OnUndim()
|
||||
end
|
||||
|
||||
function PANEL:OnDim()
|
||||
end
|
||||
|
||||
function PANEL:OnUndim()
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
local amount = self.currentDimAmount
|
||||
local bShouldScale = self.currentScale != 1
|
||||
local matrix
|
||||
|
||||
-- draw child panels with scaling if needed
|
||||
if (bShouldScale) then
|
||||
matrix = Matrix()
|
||||
matrix:Scale(Vector(1, 1, 0.0001) * self.currentScale)
|
||||
matrix:Translate(Vector(
|
||||
ScrW() * 0.5 - (ScrW() * self.currentScale * 0.5),
|
||||
ScrH() * 0.5 - (ScrH() * self.currentScale * 0.5),
|
||||
1
|
||||
))
|
||||
|
||||
cam.PushModelMatrix(matrix)
|
||||
self.currentMatrix = matrix
|
||||
end
|
||||
|
||||
BaseClass.Paint(self, width, height)
|
||||
|
||||
if (bShouldScale) then
|
||||
cam.PopModelMatrix()
|
||||
self.currentMatrix = nil
|
||||
end
|
||||
|
||||
if (amount > 0) then
|
||||
local color = Color(0, 0, 0, amount)
|
||||
|
||||
surface.SetDrawColor(color)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixCharMenuPanel", PANEL, "ixSubpanelParent")
|
||||
|
||||
-- main character menu panel
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "bUsingCharacter", "UsingCharacter", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
ix.gui.wnMainMenu = self
|
||||
|
||||
ix.panelCreationActive = false
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
end
|
||||
|
||||
function PANEL:CreateMainPanel(logoData, buttonData)
|
||||
local logoPanel = self:Add("Panel")
|
||||
logoPanel:SetSize(self:GetSize())
|
||||
|
||||
local newHeight = 0
|
||||
|
||||
local logoMargin = SScaleMin(40 / 3)
|
||||
local shouldDefault = logoData and (logoData.bDefault or !logoData.path) or false
|
||||
local hasData = logoData.width and logoData.height and logoData.path and true
|
||||
|
||||
local panelName = ((shouldDefault or !hasData) and "ixWillardCreditsLogoSmall" or "DImage")
|
||||
local logoImage = logoPanel:Add(panelName)
|
||||
local logoW = SScaleMin(hasData and logoData.width / 3 or 125 / 3)
|
||||
local logoH = SScaleMin(hasData and logoData.height / 3 or 128 / 3)
|
||||
|
||||
logoImage:SetSize(logoW, logoH)
|
||||
logoImage:Dock(TOP)
|
||||
|
||||
if !shouldDefault and hasData then
|
||||
logoImage:SetImage("willardnetworks/newlogo.png")
|
||||
end
|
||||
|
||||
logoImage:DockMargin(logoPanel:GetWide() * 0.5 - logoImage:GetWide() * 0.5, 0, logoPanel:GetWide() * 0.5 -
|
||||
logoImage:GetWide() * 0.5, logoMargin)
|
||||
|
||||
newHeight = newHeight + logoImage:GetTall() + (logoMargin)
|
||||
|
||||
local titleLabel = logoPanel:Add("DLabel")
|
||||
titleLabel:SetTextColor(color_white)
|
||||
titleLabel:SetFont("MainMenuNewTitleFont")
|
||||
titleLabel:SetText(string.utf8upper(ix.config.Get("menuTitle") or "Willard Networks"))
|
||||
titleLabel:SetContentAlignment(5)
|
||||
titleLabel:SizeToContents()
|
||||
titleLabel:Dock(TOP)
|
||||
titleLabel:DockMargin(0, 0, 0, SScaleMin(15 / 3))
|
||||
|
||||
newHeight = newHeight + titleLabel:GetTall() + SScaleMin(15 / 3)
|
||||
|
||||
self.buttonList = logoPanel:Add("Panel")
|
||||
self.buttonList:Dock(TOP)
|
||||
|
||||
self.buttonWidth = 0
|
||||
self:CreateButtons(buttonData)
|
||||
|
||||
self.buttonList:SetSize(self.buttonWidth, SScaleMin(30 / 3))
|
||||
self.buttonList:DockMargin(logoPanel:GetWide() * 0.5 - self.buttonList:GetWide() * 0.5, 0,
|
||||
logoPanel:GetWide() * 0.5 - self.buttonList:GetWide() * 0.5, 0)
|
||||
|
||||
newHeight = newHeight + self.buttonList:GetTall()
|
||||
|
||||
logoPanel:SetTall(newHeight)
|
||||
logoPanel:Center()
|
||||
local x, y = logoPanel:GetPos()
|
||||
logoPanel:SetPos(x, y - SScaleMin(100 / 3))
|
||||
end
|
||||
|
||||
function PANEL:UpdateChildPanels(parent)
|
||||
if parent.loadCharacterPanel then
|
||||
parent.loadCharacterPanel.aFontColor = self.aFontColor
|
||||
parent.loadCharacterPanel.aFontHoverColor = self.aFontHoverColor
|
||||
parent.loadCharacterPanel.aFontLockedButtonColor = self.aFontLockedButtonColor
|
||||
|
||||
if parent.loadCharacterPanel.back then
|
||||
parent.loadCharacterPanel.back:SetTextColor(self.aFontColor)
|
||||
end
|
||||
end
|
||||
|
||||
if parent.newCharacterPanel then
|
||||
parent.newCharacterPanel.aFontColor = self.aFontColor
|
||||
parent.newCharacterPanel.aFontHoverColor = self.aFontHoverColor
|
||||
parent.newCharacterPanel.aFontLockedButtonColor = self.aFontLockedButtonColor
|
||||
|
||||
if parent.newCharacterPanel.factionBack then
|
||||
parent.newCharacterPanel.factionBack:SetTextColor(self.aFontColor)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateButtons(buttonData)
|
||||
local parent = self:GetParent()
|
||||
local buttonHeight = SScaleMin(30 / 3)
|
||||
|
||||
local fontColor = buttonData["Font Color"] or Color(196, 196, 196, 255)
|
||||
local fontHoverColor = buttonData["Font Hover Color"] or Color(255, 255, 255, 255)
|
||||
local fontLockedButtonColor = buttonData["Font Locked Button Color"] or Color(90, 90, 90, 255)
|
||||
|
||||
self.aFontColor = Color(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
|
||||
self.aFontHoverColor = Color(fontHoverColor.r, fontHoverColor.g, fontHoverColor.b, fontHoverColor.a)
|
||||
self.aFontLockedButtonColor = Color(fontLockedButtonColor.r, fontLockedButtonColor.g, fontLockedButtonColor.b, fontLockedButtonColor.a)
|
||||
|
||||
local bHasCharacter = #ix.characters > 0
|
||||
self.bUsingCharacter = LocalPlayer().GetCharacter and LocalPlayer():GetCharacter()
|
||||
|
||||
local function PaintButton(this, text, boolLoad, charCreationDisabled, shouldMargin)
|
||||
this:SetText(text)
|
||||
this:SetFont("MainMenuNewButtonFont")
|
||||
this:SetTextColor(self.aFontColor)
|
||||
this:SetContentAlignment(5)
|
||||
this:DockMargin(0, 0, (!shouldMargin and SScaleMin(30 / 3) or 0), 0)
|
||||
self.buttonWidth = self.buttonWidth + (!shouldMargin and SScaleMin(30 / 3) or 0)
|
||||
|
||||
if (!bHasCharacter and boolLoad) or charCreationDisabled then
|
||||
this:SetDisabled(true)
|
||||
this:SetTextColor(self.aFontLockedButtonColor)
|
||||
end
|
||||
|
||||
this.Paint = nil
|
||||
end
|
||||
|
||||
local function OnCursor(name, boolLoad, charCreationDisabled)
|
||||
name.OnCursorEntered = function()
|
||||
if (!bHasCharacter and boolLoad) then
|
||||
if self.loadButtonTitle and IsValid(self.loadButtonTitle) then
|
||||
self.loadButtonTitle:SetTextColor(self.aFontLockedButtonColor)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if charCreationDisabled then
|
||||
name:SetTextColor(self.aFontLockedButtonColor)
|
||||
return
|
||||
end
|
||||
|
||||
surface.PlaySound("helix/ui/rollover.wav")
|
||||
name:SetTextColor(self.aFontHoverColor)
|
||||
end
|
||||
|
||||
name.OnCursorExited = function()
|
||||
if (!bHasCharacter and boolLoad) then
|
||||
if self.loadButtonTitle and IsValid(self.loadButtonTitle) then
|
||||
self.loadButtonTitle:SetTextColor(self.aFontLockedButtonColor)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if charCreationDisabled then
|
||||
name:SetTextColor(self.aFontLockedButtonColor)
|
||||
return
|
||||
end
|
||||
|
||||
name:SetTextColor(self.aFontColor)
|
||||
end
|
||||
end
|
||||
|
||||
-- create character button
|
||||
local createButton = self.buttonList:Add("DButton")
|
||||
createButton:SetTall(buttonHeight)
|
||||
createButton:Dock(LEFT)
|
||||
|
||||
local charCreation = ix.config.Get("CharCreationDisabled") and
|
||||
!CAMI.PlayerHasAccess(LocalPlayer(), "Helix - Character Creation Bypass")
|
||||
PaintButton(createButton, "NOUVEAU", nil, charCreation)
|
||||
OnCursor(createButton, nil, charCreation)
|
||||
|
||||
createButton:SizeToContents()
|
||||
self.buttonWidth = self.buttonWidth + createButton:GetWide()
|
||||
|
||||
createButton.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
if !LocalPlayer():GetData("QuizCompleted", false) then
|
||||
if ix.gui.quizAnswering then
|
||||
if ix.gui.quizAnswering.Remove then
|
||||
ix.gui.quizAnswering:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Create("ixQuizMenu")
|
||||
netstream.Start("RequestQuizzes", false)
|
||||
return
|
||||
end
|
||||
|
||||
local maximum = hook.Run("GetMaxPlayerCharacter", LocalPlayer()) or ix.config.Get("maxCharacters", 5)
|
||||
-- don't allow creation if we've hit the character limit
|
||||
if (#ix.characters >= maximum) then
|
||||
self:GetParent():ShowNotice(3, L("maxCharacters"))
|
||||
return
|
||||
end
|
||||
self:Dim()
|
||||
parent.newCharacterPanel:SetActiveSubpanel("faction", 0)
|
||||
parent.newCharacterPanel:SlideUp()
|
||||
end
|
||||
|
||||
-- load character button
|
||||
self.loadButton = self.buttonList:Add("DButton")
|
||||
self.loadButton:SetTall(buttonHeight)
|
||||
self.loadButton:Dock(LEFT)
|
||||
|
||||
PaintButton(self.loadButton, "PERSONNAGES", true)
|
||||
OnCursor(self.loadButton, true)
|
||||
|
||||
self.loadButton:SizeToContents()
|
||||
self.buttonWidth = self.buttonWidth + self.loadButton:GetWide()
|
||||
|
||||
self.loadButton.DoClick = function()
|
||||
self:Dim()
|
||||
parent.loadCharacterPanel:SlideUp()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
-- community button
|
||||
local communityButton = self.buttonList:Add("DButton")
|
||||
communityButton:SetTall(buttonHeight)
|
||||
communityButton:Dock(LEFT)
|
||||
PaintButton(communityButton, "DISCORD")
|
||||
|
||||
OnCursor(communityButton)
|
||||
|
||||
communityButton:SizeToContents()
|
||||
self.buttonWidth = self.buttonWidth + communityButton:GetWide()
|
||||
|
||||
communityButton.DoClick = function()
|
||||
gui.OpenURL("https://discord.gg/TkCUtVMRef")
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
-- content button
|
||||
local contentButton = self.buttonList:Add("DButton")
|
||||
contentButton:SetText("")
|
||||
contentButton:SetTall(buttonHeight)
|
||||
contentButton:Dock(LEFT)
|
||||
PaintButton(contentButton, "COLLECTION")
|
||||
|
||||
OnCursor(contentButton)
|
||||
|
||||
contentButton:SizeToContents()
|
||||
self.buttonWidth = self.buttonWidth + contentButton:GetWide()
|
||||
|
||||
contentButton.DoClick = function()
|
||||
gui.OpenURL("https://steamcommunity.com/sharedfiles/filedetails/?id=2934933494")
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
-- leave/return button
|
||||
self.returnButton = self.buttonList:Add("DButton")
|
||||
self.returnButton:SetTall(buttonHeight)
|
||||
self.returnButton:Dock(LEFT)
|
||||
PaintButton(self.returnButton, "", false, false, true)
|
||||
|
||||
OnCursor(self.returnButton)
|
||||
|
||||
self.returnButton:SizeToContents()
|
||||
|
||||
self:UpdateReturnButton()
|
||||
self.buttonWidth = self.buttonWidth + self.returnButton:GetWide()
|
||||
|
||||
self.returnButton.DoClick = function()
|
||||
if (self.bUsingCharacter) then
|
||||
parent:Close()
|
||||
else
|
||||
RunConsoleCommand("disconnect")
|
||||
end
|
||||
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:UpdateReturnButton(bValue)
|
||||
if (bValue == nil) then
|
||||
bValue = self.bUsingCharacter
|
||||
end
|
||||
|
||||
if self.returnButton and IsValid(self.returnButton) then
|
||||
self.returnButton:SetText(bValue and "RETOUR" or "DÉCONNECTER")
|
||||
self.returnButton:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnDim()
|
||||
-- disable input on this panel since it will still be in the background while invisible - prone to stray clicks if the
|
||||
-- panels overtop slide out of the way
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
end
|
||||
|
||||
function PANEL:OnUndim()
|
||||
self:SetMouseInputEnabled(true)
|
||||
self:SetKeyboardInputEnabled(true)
|
||||
|
||||
-- we may have just deleted a character so update the status of the return button
|
||||
self.bUsingCharacter = LocalPlayer().GetCharacter and LocalPlayer():GetCharacter()
|
||||
self:UpdateReturnButton()
|
||||
end
|
||||
|
||||
function PANEL:OnClose()
|
||||
for _, v in pairs(self:GetChildren()) do
|
||||
if (IsValid(v)) then
|
||||
v:SetVisible(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixCharMenuMain", PANEL, "ixCharMenuPanel")
|
||||
|
||||
-- container panel
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
if (IsValid(ix.gui.loading)) then
|
||||
ix.gui.loading:Remove()
|
||||
end
|
||||
|
||||
if (IsValid(ix.gui.characterMenu)) then
|
||||
if (IsValid(ix.gui.characterMenu.channel)) then
|
||||
ix.gui.characterMenu.channel:Stop()
|
||||
end
|
||||
|
||||
ix.gui.characterMenu:Remove()
|
||||
end
|
||||
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetPos(0, 0)
|
||||
|
||||
-- main menu panel
|
||||
self.mainPanel = self:Add("ixCharMenuMain")
|
||||
self.mainPanel.avoidPadding = true
|
||||
|
||||
-- new character panel
|
||||
self.newCharacterPanel = self:Add("ixCharMenuNew")
|
||||
self.newCharacterPanel:SlideDown(0)
|
||||
|
||||
-- load character panel
|
||||
self.loadCharacterPanel = self:Add("ixCharMenuLoad")
|
||||
self.loadCharacterPanel:SlideDown(0)
|
||||
|
||||
net.Start("RequestMainMenuInfo")
|
||||
net.SendToServer()
|
||||
|
||||
-- notice bar
|
||||
self.notice = self:Add("ixNoticeBar")
|
||||
|
||||
-- finalization
|
||||
self:MakePopup()
|
||||
self.currentAlpha = 255
|
||||
self.volume = 0
|
||||
|
||||
ix.gui.characterMenu = self
|
||||
|
||||
if (!IsValid(ix.gui.intro)) then
|
||||
self:PlayMusic()
|
||||
end
|
||||
|
||||
hook.Run("OnCharacterMenuCreated", self)
|
||||
end
|
||||
|
||||
function PANEL:PlayMusic()
|
||||
local path = "sound/" .. ix.config.Get("music")
|
||||
local url = path:match("http[s]?://.+")
|
||||
local play = url and sound.PlayURL or sound.PlayFile
|
||||
path = url and url or path
|
||||
|
||||
play(path, "noplay", function(channel, error, message)
|
||||
if (!IsValid(channel)) then
|
||||
return
|
||||
end
|
||||
|
||||
channel:SetVolume(self.volume or 0)
|
||||
channel:Play()
|
||||
|
||||
if IsValid(self) then
|
||||
self.channel = channel
|
||||
|
||||
self:CreateAnimation(audioFadeInTime, {
|
||||
index = 10,
|
||||
target = {volume = 1},
|
||||
|
||||
Think = function(animation, panel)
|
||||
if (IsValid(panel.channel)) then
|
||||
panel.channel:SetVolume(self.volume * 0.5)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function PANEL:ShowNotice(type, text)
|
||||
self.notice:SetType(type)
|
||||
self.notice:SetText(text)
|
||||
self.notice:Show()
|
||||
end
|
||||
|
||||
function PANEL:HideNotice()
|
||||
if (IsValid(self.notice) and !self.notice:GetHidden()) then
|
||||
self.notice:Slide("up", 0.5, true)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnCharacterDeleted(character)
|
||||
if (#ix.characters == 0) then
|
||||
self.mainPanel:Undim() -- undim since the load panel will slide down
|
||||
end
|
||||
|
||||
self.loadCharacterPanel:OnCharacterDeleted(character)
|
||||
end
|
||||
|
||||
function PANEL:OnCharacterLoadFailed(error)
|
||||
self.loadCharacterPanel:SetMouseInputEnabled(true)
|
||||
self.loadCharacterPanel:SlideUp()
|
||||
self:ShowNotice(3, error)
|
||||
end
|
||||
|
||||
function PANEL:IsClosing()
|
||||
return self.bClosing
|
||||
end
|
||||
|
||||
function PANEL:Close(bFromMenu)
|
||||
self.bClosing = true
|
||||
self.bFromMenu = bFromMenu
|
||||
|
||||
local fadeOutTime = animationTime * 8
|
||||
|
||||
self:CreateAnimation(fadeOutTime, {
|
||||
index = 1,
|
||||
target = {currentAlpha = 0},
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.currentAlpha)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
panel:Remove()
|
||||
end
|
||||
})
|
||||
|
||||
self:CreateAnimation(fadeOutTime - 0.1, {
|
||||
index = 10,
|
||||
target = {volume = 0},
|
||||
|
||||
Think = function(animation, panel)
|
||||
if (IsValid(panel.channel)) then
|
||||
panel.channel:SetVolume(self.volume * 0.5)
|
||||
end
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
if (IsValid(panel.channel)) then
|
||||
panel.channel:Stop()
|
||||
panel.channel = nil
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- hide children if we're already dimmed
|
||||
if (bFromMenu) then
|
||||
for _, v in pairs(self:GetChildren()) do
|
||||
if (IsValid(v)) then
|
||||
v:SetVisible(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- fade out the main panel quicker because it significantly blocks the screen
|
||||
self.mainPanel.currentAlpha = 255
|
||||
|
||||
self.mainPanel:CreateAnimation(animationTime * 2, {
|
||||
target = {currentAlpha = 0},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.currentAlpha)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
panel:SetVisible(false)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
-- relinquish mouse control
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
gui.EnableScreenClicker(false)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
if ix.gui.background_url then
|
||||
local mat = Material(ix.gui.background_url)
|
||||
local w, h = width, height
|
||||
local x, y = 0, 0
|
||||
|
||||
local ratioW = width / mat:Width()
|
||||
local ratioH = height / mat:Height()
|
||||
|
||||
if ratioW < 1 then
|
||||
w = mat:Width() * ratioH
|
||||
x = (w - width) / -2
|
||||
else
|
||||
h = mat:Height() * ratioW
|
||||
y = (h - height) / -2
|
||||
end
|
||||
|
||||
surface.SetMaterial(mat)
|
||||
surface.SetDrawColor(255, 255, 255, 255)
|
||||
surface.DrawTexturedRect(x, y, w, h)
|
||||
else
|
||||
surface.SetDrawColor(Color(63, 58, 115, 100))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
Derma_DrawBackgroundBlur( self, 1 )
|
||||
end
|
||||
|
||||
--[[surface.SetDrawColor(0, 0, 0, 150)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
ix.util.DrawBlur(self, Lerp((255 - 100) / 255, 0, 10))]]--
|
||||
end
|
||||
|
||||
function PANEL:PaintOver(width, height)
|
||||
if (self.bClosing and self.bFromMenu) then
|
||||
surface.SetDrawColor(color_black)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixCharMenu", PANEL, "EditablePanel")
|
||||
|
||||
if (IsValid(ix.gui.characterMenu)) then
|
||||
ix.gui.characterMenu:Remove()
|
||||
|
||||
--TODO: REMOVE ME
|
||||
ix.gui.characterMenu = vgui.Create("ixCharMenu")
|
||||
end
|
||||
|
||||
netstream.Hook("SendCharacterPanelNotify", function(error)
|
||||
if ix.gui.characterMenu and IsValid(ix.gui.characterMenu) then
|
||||
ix.gui.characterMenu:ShowNotice(3, error)
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,265 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
function PANEL:Init()
|
||||
local titlePushDown = SScaleMin(30 / 3)
|
||||
local padding = SScaleMin(30 / 3)
|
||||
local margin = SScaleMin(10 / 3)
|
||||
local iconSize = SScaleMin(18 / 3)
|
||||
local topPushDown = SScaleMin(150 / 3)
|
||||
local scale780 = SScaleMin(780 / 3)
|
||||
local scale120 = SScaleMin(120 / 3)
|
||||
|
||||
self:SetWide(ScrW() - (topPushDown * 2))
|
||||
|
||||
local sizeXtitle, sizeYtitle = self:GetWide(), scale120
|
||||
local sizeXcontent, sizeYcontent = self:GetWide(), scale780
|
||||
|
||||
self.titlePanel = self:Add("Panel")
|
||||
self.titlePanel:SetSize(sizeXtitle, sizeYtitle)
|
||||
self.titlePanel:SetPos(self:GetWide() * 0.5 - self.titlePanel:GetWide() * 0.5)
|
||||
|
||||
self:CreateTitleText()
|
||||
|
||||
self.contentFrame = self:Add("Panel")
|
||||
self.contentFrame:SetSize(sizeXcontent, sizeYcontent)
|
||||
self.contentFrame:SetPos(self:GetWide() * 0.5 - self.contentFrame:GetWide() * 0.5, titlePushDown)
|
||||
|
||||
self:SetTall(scale120 + scale780 + titlePushDown)
|
||||
self:Center()
|
||||
|
||||
self.informationFrame = self.contentFrame:Add("Panel")
|
||||
self.informationFrame:SetSize(self.contentFrame:GetWide() * 0.5 - padding, self.contentFrame:GetTall())
|
||||
self.informationFrame:Dock(LEFT)
|
||||
self.informationFrame:DockMargin(0, 0, padding, 0)
|
||||
|
||||
self.informationFrame.Paint = function( _, w, h )
|
||||
surface.SetDrawColor(Color(255, 255, 255, 30))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local informationSubframe = self.informationFrame:Add("Panel")
|
||||
informationSubframe:SetSize(self.informationFrame:GetSize())
|
||||
informationSubframe:DockMargin(padding, padding, padding, padding)
|
||||
informationSubframe:Dock(FILL)
|
||||
|
||||
local function CreatePart(parent, title, text, icon, boolLast, editButton, bWrap)
|
||||
parent:Dock(TOP)
|
||||
parent:SetSize(informationSubframe:GetWide(), SScaleMin(16.666666666667))
|
||||
parent.Paint = function(_, w, h)
|
||||
if boolLast then
|
||||
return
|
||||
end
|
||||
|
||||
surface.SetDrawColor(Color(255, 255, 255, 30))
|
||||
surface.DrawLine(0, h - 1, w, h - 1)
|
||||
end
|
||||
|
||||
local leftSide = parent:Add("Panel")
|
||||
leftSide:Dock(LEFT)
|
||||
leftSide:SetWide(parent:GetWide() * 0.25)
|
||||
leftSide:DockMargin(0, 0, margin, 0)
|
||||
|
||||
local parentIcon = leftSide:Add("DImage")
|
||||
parentIcon:SetImage("willardnetworks/tabmenu/charmenu/"..icon..".png")
|
||||
parentIcon:SetSize(iconSize, iconSize)
|
||||
parentIcon:Dock(LEFT)
|
||||
parentIcon:DockMargin(0, parent:GetTall() * 0.5 - iconSize * 0.5, 0, parent:GetTall() * 0.5 - iconSize * 0.5)
|
||||
|
||||
local parentTitle = leftSide:Add("DLabel")
|
||||
parentTitle:SetText(title)
|
||||
parentTitle:SetFont("MenuFontLargerNoClamp")
|
||||
parentTitle:Dock(LEFT)
|
||||
parentTitle:DockMargin(margin, 0, 0, 0)
|
||||
parentTitle:SetTextColor(Color(255, 255, 255, 255))
|
||||
parentTitle:SizeToContents()
|
||||
|
||||
local parentTextPanel = parent:Add("Panel")
|
||||
parentTextPanel:Dock(FILL)
|
||||
|
||||
parent.Text = parentTextPanel:Add("DLabel")
|
||||
parent.Text:SetText(text)
|
||||
parent.Text:SetFont("MenuFontLargerNoClamp")
|
||||
parent.Text:SetTextColor(Color(220, 220, 220, 255))
|
||||
parent.Text:SetContentAlignment(4)
|
||||
if bWrap then
|
||||
parent.Text:SetWrap(true)
|
||||
parent.Text:SetWide(SScaleMin(467 / 3))
|
||||
parent.Text:SetTall(SScaleMin(50 / 3))
|
||||
else
|
||||
parent.Text:Dock(LEFT)
|
||||
parent.Text:SizeToContents()
|
||||
end
|
||||
|
||||
local editButtonPanel = parent:Add("Panel")
|
||||
editButtonPanel:Dock(RIGHT)
|
||||
editButtonPanel:SetWide(iconSize)
|
||||
editButtonPanel:DockMargin(padding, 0, 0, 0)
|
||||
|
||||
if editButton then
|
||||
editButton:SetParent(editButtonPanel)
|
||||
editButton:SetSize(iconSize, iconSize)
|
||||
editButton:Dock(RIGHT)
|
||||
editButton:DockMargin(0, parent:GetTall() * 0.5 - editButton:GetTall() * 0.5, 0, parent:GetTall() * 0.5 - editButton:GetTall() * 0.5)
|
||||
end
|
||||
end
|
||||
|
||||
-- Name
|
||||
local namePanel = informationSubframe:Add("Panel")
|
||||
CreatePart(namePanel, "Nom :", LocalPlayer():GetName(), "name")
|
||||
|
||||
-- Fake name
|
||||
local fakeNamePanel = informationSubframe:Add("Panel")
|
||||
|
||||
local editfakenameIcon = fakeNamePanel:Add("DImageButton")
|
||||
editfakenameIcon:SetImage("willardnetworks/tabmenu/charmenu/edit_desc.png")
|
||||
|
||||
local fakeName = LocalPlayer():GetCharacter():GetFakeName()
|
||||
local displayFakeName = fakeName and (utf8.len(fakeName) <= 34 and fakeName or utf8.sub(fakeName, 1, 34).."...") or "--"
|
||||
|
||||
CreatePart(fakeNamePanel, "Faux nom :", displayFakeName, "fakename", false, editfakenameIcon)
|
||||
|
||||
editfakenameIcon.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
Derma_StringRequest(L("fakeNameTitle"), L("fakeNameText"), fakeName, function(text)
|
||||
local minLength = ix.config.Get("minNameLength", 4)
|
||||
local maxLength = ix.config.Get("maxNameLength", 32)
|
||||
local nameLength = utf8.len(text)
|
||||
|
||||
if (text != "" and (nameLength > maxLength or nameLength < minLength)) then
|
||||
ix.util.NotifyLocalized("fakeNameLength", minLength, maxLength)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
net.Start("ixFakeName")
|
||||
net.WriteString(text)
|
||||
net.SendToServer()
|
||||
|
||||
if fakeNamePanel.Text then
|
||||
fakeNamePanel.Text:SetText(text == "" and "--" or (nameLength <= 34 and text or utf8.sub(text, 1, 34).."..."))
|
||||
fakeNamePanel.Text:SizeToContents()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Genetics
|
||||
local geneticAge = string.utf8lower(LocalPlayer():GetCharacter():GetAge())
|
||||
local geneticHeight = string.utf8lower(LocalPlayer():GetCharacter():GetHeight())
|
||||
local geneticEyecolor = string.utf8lower(LocalPlayer():GetCharacter():GetEyeColor())
|
||||
|
||||
local function firstUpper(str)
|
||||
return str:gsub("^%l", string.utf8upper)
|
||||
end
|
||||
|
||||
local geneticDescPanel = informationSubframe:Add("Panel")
|
||||
local geneticDesc = hook.Run("GetCharacterGeneticDescription", LocalPlayer():GetCharacter())
|
||||
if geneticDesc then
|
||||
CreatePart(geneticDescPanel, "Génétique :", geneticDesc, "genetics")
|
||||
else
|
||||
CreatePart(geneticDescPanel, "Génétique :", firstUpper(geneticAge).." | "..firstUpper(geneticHeight).." | Yeux "..firstUpper(geneticEyecolor).."", "genetics")
|
||||
end
|
||||
-- Description
|
||||
local description = LocalPlayer():GetCharacter():GetDescription()
|
||||
|
||||
if string.utf8len(description) > 34 then
|
||||
description = string.utf8sub(description, 1, 34)
|
||||
end
|
||||
|
||||
local descPanel = informationSubframe:Add("Panel")
|
||||
|
||||
local editdescIcon = descPanel:Add("DImageButton")
|
||||
editdescIcon:SetImage("willardnetworks/tabmenu/charmenu/edit_desc.png")
|
||||
|
||||
CreatePart(descPanel, "Description :", description, "description", false, editdescIcon)
|
||||
|
||||
editdescIcon.DoClick = function()
|
||||
ix.command.Send("CharDesc")
|
||||
end
|
||||
|
||||
local timerId = "ixCharacterTabUpdate"
|
||||
|
||||
timer.Create(timerId, 0.25, 0, function()
|
||||
if (!IsValid(self) or !IsValid(descPanel)) then
|
||||
timer.Remove(timerId)
|
||||
elseif (LocalPlayer():GetCharacter()) then
|
||||
description = LocalPlayer():GetCharacter():GetDescription()
|
||||
|
||||
if string.utf8len(description) > 34 then
|
||||
description = string.utf8sub(description, 1, 34)
|
||||
end
|
||||
|
||||
if (descPanel.Text:GetText() != description) then
|
||||
descPanel.Text:SetText(description)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Faction
|
||||
local faction = ix.faction.indices[LocalPlayer():GetCharacter():GetFaction()]
|
||||
|
||||
local factionPanel = informationSubframe:Add("Panel")
|
||||
CreatePart(factionPanel, "Faction :", faction.name, "faction")
|
||||
|
||||
hook.Run("CreateExtraCharacterTabInfo", LocalPlayer():GetCharacter(), informationSubframe, CreatePart)
|
||||
|
||||
self.contentFrame:Add("CharFrame")
|
||||
|
||||
local returnToMenuButton = informationSubframe:Add("DButton")
|
||||
returnToMenuButton:Dock(BOTTOM)
|
||||
returnToMenuButton:DockMargin(0, SScaleMin(25 / 5), 0, 0)
|
||||
returnToMenuButton:SetText("Retourner au menu principal")
|
||||
returnToMenuButton:SetFont("MenuFontBoldNoClamp")
|
||||
returnToMenuButton:SetTall(SScaleMin(16.666666666667))
|
||||
returnToMenuButton.Paint = function(_, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 100)
|
||||
surface.DrawRect(0, 1, w - 2, h - 1)
|
||||
|
||||
surface.SetDrawColor(Color(111, 111, 136, 255 / 100 * 30))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
returnToMenuButton.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
net.Start("ixReturnToMenu")
|
||||
net.SendToServer()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateTitleText()
|
||||
local characterTitleIcon = self.titlePanel:Add("DImage")
|
||||
characterTitleIcon:SetImage("willardnetworks/tabmenu/charmenu/name.png")
|
||||
characterTitleIcon:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
|
||||
local characterTitle = self.titlePanel:Add("DLabel")
|
||||
characterTitle:SetFont("TitlesFontNoClamp")
|
||||
characterTitle:SetText("Character")
|
||||
characterTitle:SizeToContents()
|
||||
characterTitle:SetPos(SScaleMin(32 / 3), SScaleMin(20 / 3) * 0.5 - characterTitle:GetTall() * 0.5)
|
||||
end
|
||||
|
||||
vgui.Register("CharacterTab", PANEL, "Panel")
|
||||
|
||||
hook.Add("CreateMenuButtons", "CharacterTab", function(tabs)
|
||||
tabs["Character"] = {
|
||||
RowNumber = 1,
|
||||
Width = 17,
|
||||
Height = 19,
|
||||
Icon = "willardnetworks/tabmenu/navicons/character.png",
|
||||
Create = function(info, container)
|
||||
local panel = container:Add("CharacterTab")
|
||||
ix.gui.characterpanel = panel
|
||||
end
|
||||
}
|
||||
end)
|
||||
2854
gamemodes/helix/plugins/willardinterface/derma/cl_charcreate.lua
Normal file
2854
gamemodes/helix/plugins/willardinterface/derma/cl_charcreate.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,156 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
function PANEL:Init()
|
||||
local margin = SScaleMin(10 / 3)
|
||||
local smallerIconSize = SScaleMin(16 / 3)
|
||||
local parent = self:GetParent()
|
||||
|
||||
self:SetSize(parent:GetWide() * 0.5, parent:GetTall())
|
||||
self:Dock(LEFT)
|
||||
|
||||
local imgBackground = self:Add("DImage")
|
||||
local invImage = LocalPlayer():GetFactionVar("inventoryImage", "materials/willardnetworks/tabmenu/inventory/backgrounds/street.png")
|
||||
imgBackground:SetImage(invImage)
|
||||
imgBackground:SetKeepAspect(true)
|
||||
imgBackground:Dock(FILL)
|
||||
imgBackground:SetWide(self:GetWide() * 0.65)
|
||||
|
||||
local statusArea = self:Add("Panel")
|
||||
statusArea:Dock(RIGHT)
|
||||
statusArea:SetWide(self:GetWide() * 0.35)
|
||||
statusArea.Paint = function( this, w, h )
|
||||
surface.SetDrawColor(Color(255, 255, 255, 10))
|
||||
surface.DrawRect(0, 0, w, h )
|
||||
end
|
||||
|
||||
local innerStatus = statusArea:Add("Panel")
|
||||
innerStatus:SetSize(statusArea:GetWide() - (margin * 2), statusArea:GetTall())
|
||||
innerStatus:Dock(FILL)
|
||||
innerStatus:DockMargin(margin * 2, 0, margin * 2, 0)
|
||||
|
||||
local function CreateTitle(parent2, text)
|
||||
parent2:Dock(TOP)
|
||||
parent2:DockMargin(0, margin * 2 - (margin * 0.5), 0, margin * 0.5, 0)
|
||||
parent2:SetText(text)
|
||||
parent2:SetContentAlignment(4)
|
||||
parent2:SetFont("MenuFontLargerNoClamp")
|
||||
parent2:SizeToContents()
|
||||
end
|
||||
|
||||
local function CreateSubBar(parent3, iconImage, title, text, iconW, iconH)
|
||||
local SScaleMin25 = SScaleMin(25 / 3)
|
||||
parent3:Dock(TOP)
|
||||
parent3:DockMargin(0, margin * 0.5, 0, 0)
|
||||
parent3:SetSize(innerStatus:GetWide(), SScaleMin25)
|
||||
|
||||
local leftSideSub = parent3:Add("Panel")
|
||||
leftSideSub:Dock(LEFT)
|
||||
leftSideSub:SetSize(parent3:GetWide() * 0.65, SScaleMin25)
|
||||
|
||||
local rightSideSub = parent3:Add("Panel")
|
||||
rightSideSub:Dock(FILL)
|
||||
rightSideSub:SetSize(parent3:GetWide() * 0.35, SScaleMin25)
|
||||
|
||||
local iconPanel = leftSideSub:Add("Panel")
|
||||
iconPanel:Dock(LEFT)
|
||||
iconPanel:SetSize(iconW, parent3:GetTall())
|
||||
|
||||
local icon = iconPanel:Add("DImage")
|
||||
icon:SetSize(iconW, iconH)
|
||||
icon:SetImage(iconImage)
|
||||
icon:SetPos(0, iconPanel:GetTall() * 0.5 - icon:GetTall() * 0.5)
|
||||
|
||||
local leftTitle = leftSideSub:Add("DLabel")
|
||||
leftTitle:SetFont("MenuFontLargerNoClamp")
|
||||
leftTitle:SetText(title or "")
|
||||
leftTitle:SetContentAlignment(4)
|
||||
leftTitle:Dock(LEFT)
|
||||
leftTitle:DockMargin(margin, 0, 0, 0)
|
||||
leftTitle:SizeToContents()
|
||||
|
||||
local rightText = rightSideSub:Add("DLabel")
|
||||
rightText:SetFont("MenuFontLargerNoClamp")
|
||||
rightText:SetText(text or "")
|
||||
rightText:SetContentAlignment(6)
|
||||
rightText:Dock(RIGHT)
|
||||
rightText:SizeToContents()
|
||||
end
|
||||
|
||||
local statusTitle = innerStatus:Add("DLabel")
|
||||
CreateTitle(statusTitle, "STATUT")
|
||||
|
||||
local hp = innerStatus:Add("Panel")
|
||||
CreateSubBar(hp, "willardnetworks/hud/cross.png", "Vie", LocalPlayer():Health(), smallerIconSize, smallerIconSize)
|
||||
|
||||
local armor = innerStatus:Add("Panel")
|
||||
CreateSubBar(armor, "willardnetworks/hud/shield.png", "Armure", LocalPlayer():Armor(), smallerIconSize, smallerIconSize)
|
||||
|
||||
hook.Run("AdjustInnerStatusPanel", innerStatus, CreateTitle, CreateSubBar)
|
||||
|
||||
self.model = imgBackground:Add("ixModelPanel")
|
||||
self.model:Dock(FILL)
|
||||
self.model:SetFOV(ScrW() > 1920 and 50 or 40)
|
||||
self.model:SetModel(LocalPlayer():GetModel(), LocalPlayer():GetSkin(), true)
|
||||
|
||||
local rotatePanel = self:Add("Panel")
|
||||
rotatePanel:Dock(BOTTOM)
|
||||
rotatePanel:SetTall(SScaleMin(50 / 3))
|
||||
|
||||
self.rLeft = rotatePanel:Add("DButton")
|
||||
self.rLeft:Dock(LEFT)
|
||||
self.rLeft:SetWide(imgBackground:GetWide() / 2)
|
||||
self.rLeft:SetText("")
|
||||
self:CreateArrow(self.rLeft, imgBackground, "back_arrow")
|
||||
|
||||
self.rRight = rotatePanel:Add("DButton")
|
||||
self.rRight:Dock(FILL)
|
||||
self.rRight:SetText("")
|
||||
self:CreateArrow(self.rRight, imgBackground, "right-arrow")
|
||||
|
||||
ix.gui.inventoryModel = self.model
|
||||
end
|
||||
|
||||
function PANEL:CreateArrow(parent, imgBackground, path)
|
||||
local s5 = SScaleMin(5 / 3)
|
||||
local s40 = SScaleMin(40 / 3)
|
||||
local imgbgWD2 = imgBackground:GetWide() / 2
|
||||
local lrMargin = (imgbgWD2 - s40) * 0.5
|
||||
|
||||
local arrow = parent:Add("DImage")
|
||||
arrow:Dock(FILL)
|
||||
arrow:DockMargin(lrMargin, s5, lrMargin, s5)
|
||||
arrow:SetImage("willardnetworks/mainmenu/"..path..".png")
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if !istable(ix.gui.inventoryModel) then
|
||||
ix.gui.inventoryModel = self.model
|
||||
end
|
||||
|
||||
if !self.rLeft or self.rLeft and !IsValid(self.rLeft) then return end
|
||||
if !self.rRight or self.rRight and !IsValid(self.rRight) then return end
|
||||
|
||||
if self.rLeft:IsDown() then
|
||||
if IsValid(self.model.Entity) then
|
||||
self.model.Entity:SetAngles(self.model.Entity:GetAngles() - Angle(0, 1, 0))
|
||||
end
|
||||
end
|
||||
|
||||
if self.rRight:IsDown() then
|
||||
if IsValid(self.model.Entity) then
|
||||
self.model.Entity:SetAngles(self.model.Entity:GetAngles() + Angle(0, 1, 0))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("CharFrame", PANEL, "Panel")
|
||||
730
gamemodes/helix/plugins/willardinterface/derma/cl_charload.lua
Normal file
730
gamemodes/helix/plugins/willardinterface/derma/cl_charload.lua
Normal file
@@ -0,0 +1,730 @@
|
||||
--[[
|
||||
| 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 errorModel = "models/error.mdl"
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "animationTime", "AnimationTime", FORCE_NUMBER)
|
||||
|
||||
local function SetCharacter(self, character)
|
||||
self.character = character
|
||||
|
||||
if (character) then
|
||||
self:SetModel(character:GetModel())
|
||||
self:SetSkin(character:GetData("skin", 0))
|
||||
|
||||
for i = 0, (self:GetNumBodyGroups() - 1) do
|
||||
self:SetBodygroup(i, 0)
|
||||
end
|
||||
|
||||
local bodygroups = character:GetData("groups", nil)
|
||||
if (istable(bodygroups)) then
|
||||
for k, v in pairs(bodygroups) do
|
||||
self:SetBodygroup(k, v)
|
||||
end
|
||||
end
|
||||
else
|
||||
self:SetModel(errorModel)
|
||||
end
|
||||
end
|
||||
|
||||
local function GetCharacter(self)
|
||||
return self.character
|
||||
end
|
||||
|
||||
function PANEL:Init()
|
||||
self.activeCharacter = ClientsideModel(errorModel)
|
||||
self.activeCharacter:SetNoDraw(true)
|
||||
self.activeCharacter.SetCharacter = SetCharacter
|
||||
self.activeCharacter.GetCharacter = GetCharacter
|
||||
|
||||
self.animationTime = 0.5
|
||||
|
||||
self.shadeY = 0
|
||||
self.shadeHeight = 0
|
||||
|
||||
self.cameraPosition = Vector(80, 0, 35)
|
||||
self.cameraAngle = Angle(0, 180, 0)
|
||||
self.lastPaint = 0
|
||||
end
|
||||
|
||||
function PANEL:ResetSequence(model, lastModel)
|
||||
local sequence = model:LookupSequence("reference")
|
||||
|
||||
if (sequence <= 0) then
|
||||
sequence = model:SelectWeightedSequence(ACT_IDLE)
|
||||
end
|
||||
|
||||
if (sequence > 0) then
|
||||
model:ResetSequence(sequence)
|
||||
else
|
||||
local found = false
|
||||
|
||||
for _, v in ipairs(model:GetSequenceList()) do
|
||||
if ((v:utf8lower():find("idle") or v:utf8lower():find("fly")) and v != "idlenoise") then
|
||||
model:ResetSequence(v)
|
||||
found = true
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (!found) then
|
||||
model:ResetSequence(4)
|
||||
end
|
||||
end
|
||||
|
||||
model:SetIK(false)
|
||||
|
||||
-- copy cycle if we can to avoid a jarring transition from resetting the sequence
|
||||
if (lastModel) then
|
||||
model:SetCycle(lastModel:GetCycle())
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:RunAnimation(model)
|
||||
model:FrameAdvance((RealTime() - self.lastPaint) * 0.5)
|
||||
end
|
||||
|
||||
function PANEL:LayoutEntity(model)
|
||||
model:SetIK(false)
|
||||
self:RunAnimation(model)
|
||||
|
||||
if self.activeCharacter:GetModel() == "models/willardnetworks/vortigaunt.mdl" then
|
||||
if model:LookupBone("ValveBiped.head") then
|
||||
local headpos = model:GetBonePosition(model:LookupBone("ValveBiped.head"))
|
||||
model:SetEyeTarget(headpos-Vector(-15, 0, 0))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
for i = 2, 7 do
|
||||
model:SetFlexWeight( i, 0 )
|
||||
end
|
||||
|
||||
for i = 0, 1 do
|
||||
model:SetFlexWeight( i, 1 )
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetActiveCharacter(character)
|
||||
self.shadeY = self:GetTall()
|
||||
self.shadeHeight = self:GetTall()
|
||||
|
||||
-- set character immediately if we're an error (something isn't selected yet)
|
||||
if (self.activeCharacter:GetModel() == errorModel) then
|
||||
self.activeCharacter:SetCharacter(character)
|
||||
self:ResetSequence(self.activeCharacter)
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
local x, y = self:LocalToScreen(0, 0)
|
||||
|
||||
cam.Start3D(self.cameraPosition, self.cameraAngle, 70, x, y, width, height)
|
||||
render.SetColorMaterial()
|
||||
render.SetColorModulation(1, 1, 1)
|
||||
render.SuppressEngineLighting(true)
|
||||
render.SetLightingOrigin(self.activeCharacter:GetPos())
|
||||
|
||||
-- setup lighting
|
||||
render.SetModelLighting(0, 1.5, 1.5, 1.5)
|
||||
|
||||
for i = 1, 4 do
|
||||
render.SetModelLighting(i, 0.4, 0.4, 0.4)
|
||||
end
|
||||
render.SetModelLighting(5, 0.04, 0.04, 0.04)
|
||||
|
||||
-- clip anything out of bounds
|
||||
local curparent = self
|
||||
local rightx = self:GetWide()
|
||||
local leftx = 0
|
||||
local topy = 0
|
||||
local bottomy = self:GetTall()
|
||||
local previous = curparent
|
||||
|
||||
while (curparent:GetParent() != nil) do
|
||||
local lastX, lastY = previous:GetPos()
|
||||
curparent = curparent:GetParent()
|
||||
|
||||
topy = math.Max(lastY, topy + lastY)
|
||||
leftx = math.Max(lastX, leftx + lastX)
|
||||
bottomy = math.Min(lastY + previous:GetTall(), bottomy + lastY)
|
||||
rightx = math.Min(lastX + previous:GetWide(), rightx + lastX)
|
||||
|
||||
previous = curparent
|
||||
end
|
||||
|
||||
ix.util.ResetStencilValues()
|
||||
|
||||
render.SetStencilWriteMask(1)
|
||||
render.SetStencilTestMask(1)
|
||||
render.SetStencilReferenceValue(1)
|
||||
|
||||
render.SetStencilFailOperation(STENCIL_KEEP)
|
||||
render.SetStencilZFailOperation(STENCIL_KEEP)
|
||||
|
||||
self:LayoutEntity(self.activeCharacter)
|
||||
|
||||
render.SetScissorRect(leftx, topy + self.shadeHeight, rightx, bottomy, true)
|
||||
self.activeCharacter:DrawModel()
|
||||
|
||||
render.SetScissorRect(leftx, topy, rightx, bottomy, true)
|
||||
|
||||
render.SetStencilCompareFunction(STENCIL_EQUAL)
|
||||
render.SetStencilPassOperation(STENCIL_KEEP)
|
||||
|
||||
render.SetStencilEnable(false)
|
||||
|
||||
render.SetScissorRect(0, 0, 0, 0, false)
|
||||
render.SuppressEngineLighting(false)
|
||||
cam.End3D()
|
||||
|
||||
self.lastPaint = RealTime()
|
||||
end
|
||||
|
||||
function PANEL:OnRemove()
|
||||
self.activeCharacter:Remove()
|
||||
end
|
||||
|
||||
vgui.Register("ixCharMenuCarousel", PANEL, "Panel")
|
||||
|
||||
-- character load panel
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "animationTime", "AnimationTime", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "backgroundFraction", "BackgroundFraction", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
local parent = self:GetParent()
|
||||
|
||||
self.animationTime = 1
|
||||
self.backgroundFraction = 1
|
||||
|
||||
-- main panel
|
||||
self.panel = self:AddSubpanel("main")
|
||||
self.panel:SetSize(parent:GetSize())
|
||||
self.panel:SetTitle("")
|
||||
self.panel.OnSetActive = function()
|
||||
self:CreateAnimation(self.animationTime, {
|
||||
index = 2,
|
||||
target = {backgroundFraction = 1},
|
||||
easing = "outQuint",
|
||||
})
|
||||
end
|
||||
|
||||
self.aFontColor = parent.mainPanel.aFontColor or Color(196, 196, 196, 255)
|
||||
self.aFontHoverColor = parent.mainPanel.aFontHoverColor or Color(255, 255, 255, 255)
|
||||
self.aFontLockedButtonColor = parent.mainPanel.aFontLockedButtonColor or Color(90, 90, 90, 255)
|
||||
|
||||
self.panel.avoidPadding = true
|
||||
|
||||
-- Character Count
|
||||
local Count = 0
|
||||
|
||||
for _, _ in pairs(ix.characters) do
|
||||
Count = Count + 1
|
||||
end
|
||||
|
||||
self.CharacterCount = Count
|
||||
|
||||
local charImageH = SScaleMin(500 / 3)
|
||||
local charPanelW = SScaleMin(300 / 3)
|
||||
local charTextH = SScaleMin(80 / 3)
|
||||
local margin = SScaleMin(20 / 3)
|
||||
|
||||
local panelLoad = self.panel:Add("Panel")
|
||||
|
||||
local titleLabel = panelLoad:Add("DLabel")
|
||||
titleLabel:SetTextColor(color_white)
|
||||
titleLabel:SetFont("MainMenuNewTitleFont")
|
||||
titleLabel:SetText(string.utf8upper("Personnages"))
|
||||
titleLabel:SizeToContents()
|
||||
titleLabel:SetContentAlignment(5)
|
||||
titleLabel:Dock(TOP)
|
||||
titleLabel:DockMargin(0, 0, 0, SScaleMin(50 / 3))
|
||||
|
||||
local panelLoadWBelowEqual4 = (self.CharacterCount) * charPanelW + ((self.CharacterCount - 1) * margin)
|
||||
local panelLoad4 = (4) * charPanelW + ((4 - 1) * margin)
|
||||
|
||||
if panelLoadWBelowEqual4 < titleLabel:GetWide() then panelLoadWBelowEqual4 = titleLabel:GetWide() end
|
||||
if panelLoad4 < titleLabel:GetWide() then panelLoad4 = titleLabel:GetWide() end
|
||||
|
||||
if self.CharacterCount <= 4 then
|
||||
panelLoad:SetSize(panelLoadWBelowEqual4, titleLabel:GetTall() + SScaleMin(50 / 3) + SScaleMin(590 / 3) + (margin * 3) + SScaleMin(30 / 3))
|
||||
else
|
||||
panelLoad:SetSize(panelLoad4, titleLabel:GetTall() + SScaleMin(50 / 3) + SScaleMin(590 / 3) + (margin * 3) + SScaleMin(30 / 3))
|
||||
end
|
||||
|
||||
panelLoad:Center()
|
||||
|
||||
self.charactersPanel = panelLoad:Add("Panel")
|
||||
self.charactersPanel:SetSize(panelLoad:GetWide(), SScaleMin(590 / 3))
|
||||
self.charactersPanel:Dock(TOP)
|
||||
|
||||
self.characterImages = self.charactersPanel:Add("Panel")
|
||||
self.characterText = self.charactersPanel:Add("Panel")
|
||||
|
||||
if self.CharacterCount == 1 then
|
||||
self.characterImages:SetSize(charPanelW, charImageH)
|
||||
self.characterText:SetSize(charPanelW, charTextH + margin)
|
||||
else
|
||||
self.characterImages:SetSize((self.CharacterCount) * charPanelW + ((self.CharacterCount - 1) * margin), charImageH)
|
||||
self.characterText:SetSize((self.CharacterCount) * charPanelW + ((self.CharacterCount - 1) * margin), charTextH + margin + (margin * 0.5) + SScaleMin(10 / 3))
|
||||
end
|
||||
|
||||
self.characterImages:Center()
|
||||
local x, y = self.characterImages:GetPos()
|
||||
self.characterImages:SetPos(x, 0)
|
||||
|
||||
self.characterText:Center()
|
||||
x, y = self.characterText:GetPos()
|
||||
self.characterText:SetPos(x, self.characterImages:GetTall())
|
||||
|
||||
if self.CharacterCount > 4 then
|
||||
self.characterText:SetPos(0, self.characterImages:GetTall())
|
||||
self.characterImages:SetPos(0, 0)
|
||||
|
||||
self.nextButton = self.panel:Add("DImageButton")
|
||||
|
||||
self.nextButton:SetSize(SScaleMin(32 / 3), SScaleMin(32 / 3))
|
||||
self.nextButton:SetImage("willardnetworks/charselect/arrow_right.png")
|
||||
|
||||
self.nextButton:Center()
|
||||
x, y = self.nextButton:GetPos()
|
||||
self.nextButton:MoveRightOf(panelLoad)
|
||||
local x2, y2 = self.nextButton:GetPos()
|
||||
|
||||
self.nextButton:SetPos(x2 + margin, y)
|
||||
|
||||
self.nextButton.OnCursorEntered = function()
|
||||
surface.PlaySound("helix/ui/rollover.wav")
|
||||
self.nextButton:SetColor( Color( 210, 210, 210, 255 ) )
|
||||
end
|
||||
|
||||
self.nextButton.OnCursorExited = function()
|
||||
self.nextButton:SetColor( Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
self.nextButton.DoClick = function()
|
||||
x, y = self.characterImages:GetPos()
|
||||
x2, y2 = self.characterText:GetPos()
|
||||
local pos1, pos2 = math.Round(math.abs( x )), math.Round(((self.CharacterCount - 5) * (charPanelW + margin)))
|
||||
|
||||
if pos1 == pos2 or math.abs(pos1 - pos2) <= charPanelW - 10 then
|
||||
self.nextButton:SetVisible(false)
|
||||
end
|
||||
|
||||
self.characterImages:MoveTo( x - (charPanelW + margin), y, 0.1, 0, 1 )
|
||||
self.characterText:MoveTo( x2 - (charPanelW + margin), y2, 0.1, 0, 1 )
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
if IsValid(self.previousButton) then
|
||||
return
|
||||
else
|
||||
self.previousButton = self.panel:Add("DImageButton")
|
||||
self.previousButton:SetSize(SScaleMin(32 / 3), SScaleMin(32 / 3))
|
||||
self.previousButton:SetImage("willardnetworks/charselect/arrow_left.png")
|
||||
|
||||
self.previousButton:Center()
|
||||
x, y = self.previousButton:GetPos()
|
||||
self.previousButton:MoveLeftOf(panelLoad)
|
||||
x2, y2 = self.previousButton:GetPos()
|
||||
|
||||
self.previousButton:SetPos(x2 - margin, y)
|
||||
|
||||
self.previousButton.OnCursorEntered = function()
|
||||
surface.PlaySound("helix/ui/rollover.wav")
|
||||
self.previousButton:SetColor( Color( 210, 210, 210, 255 ) )
|
||||
end
|
||||
|
||||
self.previousButton.OnCursorExited = function()
|
||||
self.previousButton:SetColor( Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
self.previousButton.DoClick = function()
|
||||
x, y = self.characterImages:GetPos()
|
||||
x2, y2 = self.characterText:GetPos()
|
||||
|
||||
if IsValid(self.nextButton) then
|
||||
self.nextButton:SetVisible(true)
|
||||
end
|
||||
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self.characterImages:MoveTo( x + (charPanelW + margin), y, 0.1, 0, 1 )
|
||||
self.characterText:MoveTo( x2 + (charPanelW + margin), y2, 0.1, 0, 1 )
|
||||
|
||||
if IsValid(self.previousButton) then
|
||||
pos1, pos2 = math.Round(x, 0), math.Round((0 - (charPanelW + margin)), 0)
|
||||
if pos1 == pos2 or math.abs(pos1 - pos2) <= charPanelW - 10 then
|
||||
self.previousButton:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #ix.characters do
|
||||
local id = ix.characters[i]
|
||||
local character = ix.char.loaded[id]
|
||||
|
||||
if (!character) then
|
||||
continue
|
||||
end
|
||||
|
||||
local index = character:GetFaction()
|
||||
local faction = ix.faction.indices[index]
|
||||
|
||||
local image = self.characterImages:Add("DImageButton")
|
||||
image:SetKeepAspect(true)
|
||||
image:SetImage(faction.selectImage or "willardnetworks/charselect/citizen2.png")
|
||||
image:Dock(LEFT)
|
||||
|
||||
if i == 1 then
|
||||
image:DockMargin(0, 0, 0, 0)
|
||||
else
|
||||
image:DockMargin(0, 0, margin, 0)
|
||||
end
|
||||
|
||||
image.id = character:GetID()
|
||||
image:MoveToBack()
|
||||
image:SetSize( charPanelW, charImageH )
|
||||
image.PaintOver = function(self, w, h)
|
||||
surface.SetDrawColor(Color(73, 82, 87, 255))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local model = image:Add("ixCharMenuCarousel")
|
||||
model:SetActiveCharacter(character)
|
||||
model:SetSize(SScaleMin(649 / 3), SScaleMin(540 / 3))
|
||||
model:SetPos(0 - SScaleMin(169 / 3))
|
||||
|
||||
self.characterTextPanel = self.characterText:Add("Panel")
|
||||
self.characterTextPanel:Dock(RIGHT)
|
||||
self.characterTextPanel:SetWide(charPanelW)
|
||||
self.characterTextPanel.id = character:GetID()
|
||||
|
||||
if i == 1 then
|
||||
self.characterTextPanel:DockMargin(0, 0, 0, 0)
|
||||
else
|
||||
self.characterTextPanel:DockMargin(0, 0, margin, 0)
|
||||
end
|
||||
|
||||
local nameText = self.characterTextPanel:Add("DLabel")
|
||||
nameText:SetFont("WNMenuFontNoClamp")
|
||||
|
||||
if string.utf8len( character:GetName() ) > 17 then
|
||||
nameText:SetText(string.utf8upper(string.utf8sub(character:GetName(), 1, 16) .."..."))
|
||||
else
|
||||
nameText:SetText(string.utf8upper(character:GetName()))
|
||||
end
|
||||
|
||||
nameText:SizeToContents()
|
||||
nameText:Dock(TOP)
|
||||
nameText:DockMargin(0, SScaleMin(10 / 3), 0, 0)
|
||||
nameText:SetContentAlignment(5)
|
||||
|
||||
local factionText = self.characterTextPanel:Add("DLabel")
|
||||
factionText:SetFont("WNMenuFontNoClamp")
|
||||
if (faction.name) == "O.T.A" then
|
||||
factionText:SetText("SOLDAT")
|
||||
else
|
||||
factionText:SetText(string.utf8upper(faction.name))
|
||||
end
|
||||
|
||||
factionText:SizeToContents()
|
||||
factionText:Dock(TOP)
|
||||
factionText:SetContentAlignment(5)
|
||||
factionText:SetTextColor(Color(200, 200, 200, 200))
|
||||
|
||||
local buttons = self.characterTextPanel:Add("Panel")
|
||||
buttons:SetSize(self.characterTextPanel:GetWide(), margin)
|
||||
buttons:Dock(TOP)
|
||||
buttons:DockMargin(0, margin * 0.5, 0, 0)
|
||||
|
||||
local centerButtons = buttons:Add("Panel")
|
||||
centerButtons:SetSize((margin * 2) + SScaleMin(15 / 3), buttons:GetTall())
|
||||
centerButtons:Center()
|
||||
|
||||
local loadChar = centerButtons:Add("DImageButton")
|
||||
loadChar:SetSize(margin, margin)
|
||||
loadChar:SetImage("willardnetworks/charselect/check.png")
|
||||
loadChar:Dock(LEFT)
|
||||
|
||||
loadChar.OnCursorEntered = function()
|
||||
surface.PlaySound("helix/ui/rollover.wav")
|
||||
loadChar:SetColor( Color( 210, 210, 210, 255 ) )
|
||||
end
|
||||
|
||||
loadChar.OnCursorExited = function()
|
||||
loadChar:SetColor( Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
loadChar.DoClick = function()
|
||||
self.character = character
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:Slide("down", self.animationTime, function()
|
||||
net.Start("ixCharacterChoose")
|
||||
net.WriteUInt(self.character:GetID(), 32)
|
||||
net.SendToServer()
|
||||
end, true)
|
||||
end
|
||||
|
||||
local deleteButton = centerButtons:Add("DImageButton")
|
||||
deleteButton:SetSize(margin, margin)
|
||||
deleteButton:SetImage("willardnetworks/charselect/delete.png")
|
||||
deleteButton:Dock(RIGHT)
|
||||
|
||||
deleteButton.OnCursorEntered = function()
|
||||
surface.PlaySound("helix/ui/rollover.wav")
|
||||
deleteButton:SetColor( Color( 210, 210, 210, 255 ) )
|
||||
end
|
||||
|
||||
deleteButton.OnCursorExited = function()
|
||||
deleteButton:SetColor( Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
deleteButton.DoClick = function()
|
||||
self.character = character
|
||||
self:SetActiveSubpanel("delete")
|
||||
if self.deleteModel and IsValid(self.deleteModel) then
|
||||
self.deleteModel.overrideProxyColors = character:GetProxyColors()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (ix.config.Get("CharCreationDisabled", false) and !CAMI.PlayerHasAccess(LocalPlayer(), "Helix - Character Creation Bypass") and #ix.characters == 0) then
|
||||
Derma_Query( "Voulez-vous vous connecter au serveur de la cité ?", "Vous n'avez aucun personnage à cet endroit.", "OUI", function()
|
||||
RunConsoleCommand("connect", 'hl2rp.willard.network')
|
||||
end, "NON")
|
||||
end
|
||||
|
||||
local backPanel = panelLoad:Add("Panel")
|
||||
backPanel:Dock(TOP)
|
||||
backPanel:SetSize(panelLoad:GetWide(), SScaleMin(30 / 3))
|
||||
backPanel:DockMargin(0, margin * 2, 0, 0)
|
||||
|
||||
self.back = backPanel:Add("DButton")
|
||||
self.back:SetText(string.utf8upper("Retour"))
|
||||
self.back:SetContentAlignment(6)
|
||||
self.back:SetSize(SScaleMin(90 / 3), SScaleMin(30 / 3))
|
||||
self.back:SetTextColor(self.aFontColor)
|
||||
self.back:SetFont("MainMenuNewButtonFont")
|
||||
self.back:Center()
|
||||
self.back:SetTextInset(SScaleMin(10 / 3), 0)
|
||||
|
||||
self.back.Paint = function( self, w, h )
|
||||
surface.SetDrawColor(Color(255, 255, 255, 255))
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/mainmenu/back_arrow.png"))
|
||||
surface.DrawTexturedRect(SScaleMin(10 / 3) - 10, (SScaleMin(30 / 3) * 0.5) - (margin * 0.5), margin, margin)
|
||||
end
|
||||
|
||||
self.back.OnCursorEntered = function()
|
||||
surface.PlaySound("helix/ui/rollover.wav")
|
||||
self.back:SetTextColor(self.aFontHoverColor)
|
||||
end
|
||||
|
||||
self.back.OnCursorExited = function()
|
||||
self.back:SetTextColor(self.aFontColor)
|
||||
end
|
||||
|
||||
self.back.DoClick = function()
|
||||
self:SlideDown()
|
||||
parent.mainPanel:Undim()
|
||||
end
|
||||
|
||||
-- character deletion panel
|
||||
self.delete = self:AddSubpanel("delete")
|
||||
self.delete:SetTitle(nil)
|
||||
self.delete.OnSetActive = function()
|
||||
self.delete.avoidPadding = true
|
||||
self.deleteModel:SetModel(self.character:GetModel())
|
||||
if self.character:GetData("skin") then
|
||||
self.deleteModel.Entity:SetSkin(self.character:GetData("skin"))
|
||||
end
|
||||
|
||||
local bodygroups = self.character:GetData("groups", nil)
|
||||
|
||||
if (istable(bodygroups)) then
|
||||
for k, v in pairs(bodygroups) do
|
||||
if self.deleteModel.Entity then
|
||||
self.deleteModel.Entity:SetBodygroup(k, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:CreateAnimation(self.animationTime, {
|
||||
index = 2,
|
||||
target = {backgroundFraction = 0},
|
||||
easing = "outQuint"
|
||||
})
|
||||
end
|
||||
|
||||
local deleteInfo = self.delete:Add("Panel")
|
||||
deleteInfo:SetSize(parent:GetWide() * 0.5, parent:GetTall())
|
||||
deleteInfo:Dock(LEFT)
|
||||
|
||||
self.deleteModel = deleteInfo:Add("ixModelPanel")
|
||||
self.deleteModel:Dock(FILL)
|
||||
self.deleteModel:SetModel(errorModel)
|
||||
self.deleteModel:SetFOV(78)
|
||||
self.deleteModel.PaintModel = self.deleteModel.Paint
|
||||
|
||||
local deleteNag = self.delete:Add("Panel")
|
||||
deleteNag:SetTall(parent:GetTall() * 0.6)
|
||||
deleteNag:Dock(BOTTOM)
|
||||
|
||||
local deleteTitle = deleteNag:Add("DLabel")
|
||||
deleteTitle:SetFont("WNMenuTitleNoClamp")
|
||||
deleteTitle:SetText(string.utf8upper("êtes-vous sûrs ?"))
|
||||
deleteTitle:SetTextColor(Color(243, 69, 42, 255))
|
||||
deleteTitle:SizeToContents()
|
||||
deleteTitle:Dock(TOP)
|
||||
|
||||
local deleteText = deleteNag:Add("DLabel")
|
||||
deleteText:SetFont("WNSmallerMenuTitleNoClamp")
|
||||
deleteText:SetText("Ce personnage sera supprimé pour toujours !")
|
||||
deleteText:SetTextColor(color_white)
|
||||
deleteText:SetContentAlignment(7)
|
||||
deleteText:Dock(TOP)
|
||||
deleteText:SizeToContents()
|
||||
|
||||
local yesnoPanel = deleteNag:Add("Panel")
|
||||
yesnoPanel:Dock(TOP)
|
||||
yesnoPanel:SetTall(SScaleMin(60 / 3))
|
||||
yesnoPanel:DockMargin(0, margin, 0, 0)
|
||||
|
||||
local yes = yesnoPanel:Add("DButton")
|
||||
yes:Dock(LEFT)
|
||||
yes:SetWide(SScaleMin(100 / 3))
|
||||
yes:DockMargin(0, 0, SScaleMin(40 / 3), 0)
|
||||
yes:SetFont("WNSmallerMenuTitleNoClamp")
|
||||
yes:SetText(string.utf8upper("oui"))
|
||||
yes.Paint = function(self, w, h) end
|
||||
yes:SetContentAlignment(4)
|
||||
yes.DoClick = function()
|
||||
|
||||
self.CharacterCount = self.CharacterCount - 1
|
||||
|
||||
local id = self.character:GetID()
|
||||
|
||||
parent:ShowNotice(1, L("deleteComplete", self.character:GetName()))
|
||||
|
||||
self:SetActiveSubpanel("main")
|
||||
|
||||
net.Start("ixCharacterDelete")
|
||||
net.WriteUInt(id, 32)
|
||||
net.SendToServer()
|
||||
|
||||
for k, v in pairs(self.characterImages:GetChildren()) do
|
||||
if v.id == id then
|
||||
v:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(self.characterText:GetChildren()) do
|
||||
if v.id == id then
|
||||
v:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
if self.CharacterCount == 1 then
|
||||
self.characterImages:SetSize(charPanelW, charImageH)
|
||||
self.characterText:SetSize(charPanelW, charTextH + margin)
|
||||
else
|
||||
self.characterImages:SetSize((self.CharacterCount) * charPanelW + ((self.CharacterCount - 1) * margin), charImageH)
|
||||
self.characterText:SetSize((self.CharacterCount) * charPanelW + ((self.CharacterCount - 1) * margin), charTextH + margin)
|
||||
end
|
||||
|
||||
if self.CharacterCount > 4 then
|
||||
self.characterImages:SetPos(0, 0)
|
||||
self.characterText:SetPos(0, self.characterImages:GetTall())
|
||||
else
|
||||
if IsValid(self.nextButton) then
|
||||
self.nextButton:Remove()
|
||||
end
|
||||
|
||||
if IsValid(self.previousButton) then
|
||||
self.previousButton:Remove()
|
||||
end
|
||||
|
||||
self.characterImages:Center()
|
||||
local x, y = self.characterImages:GetPos()
|
||||
self.characterImages:SetPos(x, 0)
|
||||
|
||||
self.characterText:Center()
|
||||
local x, y = self.characterText:GetPos()
|
||||
self.characterText:SetPos(x, self.characterImages:GetTall())
|
||||
end
|
||||
|
||||
if IsValid(self.characterTextPanel) then
|
||||
if self.CharacterCount == 1 then
|
||||
self.characterTextPanel:DockMargin(0, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local no = yesnoPanel:Add("DButton")
|
||||
no:Dock(LEFT)
|
||||
no:SetWide(SScaleMin(100 / 3))
|
||||
no:SetFont("WNSmallerMenuTitleNoClamp")
|
||||
no:SetText(string.utf8upper("non"))
|
||||
no:SetContentAlignment(6)
|
||||
no.Paint = function(self, w, h) end
|
||||
no.DoClick = function()
|
||||
self:SetActiveSubpanel("main")
|
||||
end
|
||||
|
||||
-- finalize setup
|
||||
self:SetActiveSubpanel("main", 0)
|
||||
end
|
||||
|
||||
function PANEL:OnCharacterDeleted(character)
|
||||
local parent = self:GetParent()
|
||||
local bHasCharacter = #ix.characters > 0
|
||||
|
||||
if (self.bActive and #ix.characters == 0) then
|
||||
self:SlideDown()
|
||||
parent.mainPanel.loadButton:SetDisabled(true)
|
||||
parent.mainPanel.loadButton:SetTextColor(self.aFontLockedButtonColor)
|
||||
|
||||
|
||||
parent.mainPanel.loadButton.OnCursorEntered = function()
|
||||
if (!bHasCharacter) then
|
||||
parent.mainPanel.loadButton:SetTextColor(self.aFontLockedButtonColor)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
parent.mainPanel.loadButton.OnCursorExited = function()
|
||||
if (!bHasCharacter) then
|
||||
parent.mainPanel.loadButton:SetTextColor(self.aFontLockedButtonColor)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnSlideUp()
|
||||
self.bActive = true
|
||||
end
|
||||
|
||||
function PANEL:OnSlideDown()
|
||||
self.bActive = false
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
end
|
||||
|
||||
vgui.Register("ixCharMenuLoad", PANEL, "ixCharMenuPanel")
|
||||
223
gamemodes/helix/plugins/willardinterface/derma/cl_entitymenu.lua
Normal file
223
gamemodes/helix/plugins/willardinterface/derma/cl_entitymenu.lua
Normal file
@@ -0,0 +1,223 @@
|
||||
--[[
|
||||
| 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 animationTime = 1
|
||||
local padding = 32
|
||||
|
||||
-- entity menu button
|
||||
DEFINE_BASECLASS("ixMenuButton")
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "callback", "Callback")
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetTall(ScrH() * 0.1)
|
||||
self:Dock(TOP)
|
||||
self:SetFont("MenuFontBoldNoClamp")
|
||||
self.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.DrawLine(0, h - 1, w, h - 1)
|
||||
|
||||
if self:IsHovered() then
|
||||
self:SetTextColor(Color(230, 230, 230, 255))
|
||||
else
|
||||
self:SetTextColor(color_white)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:DoClick()
|
||||
local bStatus = true
|
||||
local parent = ix.menu.panel
|
||||
local entity = parent:GetEntity()
|
||||
|
||||
if (parent.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
if (isfunction(self.callback)) then
|
||||
bStatus = self.callback()
|
||||
end
|
||||
|
||||
if (bStatus != false) then
|
||||
ix.menu.NetworkChoice(entity, self.originalText, bStatus)
|
||||
end
|
||||
|
||||
parent:Remove()
|
||||
end
|
||||
|
||||
function PANEL:SetText(text)
|
||||
self.originalText = text
|
||||
BaseClass.SetText(self, text)
|
||||
end
|
||||
|
||||
vgui.Register("ixEntityMenuButton", PANEL, "ixMenuButton")
|
||||
|
||||
-- entity menu list
|
||||
DEFINE_BASECLASS("EditablePanel")
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.list = {}
|
||||
self.titleBar = self:Add("Panel")
|
||||
self.titleBar:SetTall(SScaleMin(20 / 3))
|
||||
self.titleBar:Dock(TOP)
|
||||
self.titleBar.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(Color(255, 78, 69, 255))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.title = self.titleBar:Add("DLabel")
|
||||
self.title:Dock(FILL)
|
||||
self.title:SetFont("MenuFontLargerBoldNoFix")
|
||||
self.title:SetContentAlignment(5)
|
||||
self.title:SizeToContents()
|
||||
self.title:SetText("Intéractions")
|
||||
|
||||
self.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)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:AddOption(text, callback)
|
||||
local panel = self:Add("ixEntityMenuButton")
|
||||
panel:SetText(text)
|
||||
panel:SetCallback(callback)
|
||||
panel:Dock(TOP)
|
||||
|
||||
self.list[#self.list + 1] = panel
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local height = 0
|
||||
|
||||
for i = 1, #self.list do
|
||||
height = height + self.list[i]:GetTall()
|
||||
end
|
||||
|
||||
height = height + self.titleBar:GetTall()
|
||||
|
||||
self:SetSize(SScaleMin(200 / 3), height)
|
||||
end
|
||||
|
||||
vgui.Register("ixEntityMenuList", PANEL, "EditablePanel")
|
||||
|
||||
-- entity menu
|
||||
DEFINE_BASECLASS("EditablePanel")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "entity", "Entity")
|
||||
AccessorFunc(PANEL, "bClosing", "IsClosing", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "desiredHeight", "DesiredHeight", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
if (IsValid(ix.menu.panel)) then
|
||||
self:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
-- close entity tooltip if it's open
|
||||
if (IsValid(ix.gui.entityInfo)) then
|
||||
ix.gui.entityInfo:Remove()
|
||||
end
|
||||
|
||||
ix.menu.panel = self
|
||||
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetPos(0, 0)
|
||||
|
||||
self.list = self:Add("ixEntityMenuList")
|
||||
|
||||
self.desiredHeight = 0
|
||||
self.blur = 0
|
||||
self.alpha = 1
|
||||
self.bClosing = false
|
||||
self.lastPosition = vector_origin
|
||||
|
||||
self:CreateAnimation(animationTime, {
|
||||
target = {blur = 1},
|
||||
easing = "outQuint"
|
||||
})
|
||||
|
||||
self:MakePopup()
|
||||
end
|
||||
|
||||
function PANEL:SetOptions(options)
|
||||
for k, v in SortedPairs(options) do
|
||||
self.list:AddOption(k, v)
|
||||
end
|
||||
|
||||
self.list:SizeToContents()
|
||||
self.list:Center()
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
local entity = self.entity
|
||||
local distance = 0
|
||||
|
||||
if (IsValid(entity)) then
|
||||
local position = entity:GetPos()
|
||||
distance = LocalPlayer():GetShootPos():DistToSqr(position)
|
||||
|
||||
if (distance > 65536) then
|
||||
self:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
self.lastPosition = position
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetOverviewInfo(origin, angles)
|
||||
return angles
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed(code)
|
||||
if (code == MOUSE_LEFT) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
self.bClosing = true
|
||||
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
gui.EnableScreenClicker(false)
|
||||
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
target = {alpha = 0},
|
||||
index = 2,
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.alpha * 255)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
ix.menu.panel = nil
|
||||
BaseClass.Remove(self)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vgui.Register("ixEntityMenu", PANEL, "EditablePanel")
|
||||
330
gamemodes/helix/plugins/willardinterface/derma/cl_f1menu.lua
Normal file
330
gamemodes/helix/plugins/willardinterface/derma/cl_f1menu.lua
Normal file
@@ -0,0 +1,330 @@
|
||||
--[[
|
||||
| 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 animationTime = 1
|
||||
|
||||
DEFINE_BASECLASS("ixSubpanelParent")
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
if IsValid(ix.gui.F1Menu) then
|
||||
ix.gui.F1Menu:Remove()
|
||||
end
|
||||
|
||||
ix.gui.F1Menu = self
|
||||
|
||||
-- properties
|
||||
self.noAnchor = CurTime() + 0.4
|
||||
self.anchorMode = true
|
||||
|
||||
self.currentAlpha = 0
|
||||
self.currentBlur = 0
|
||||
|
||||
gui.EnableScreenClicker( true )
|
||||
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
|
||||
local function FramePaint( self, w, h)
|
||||
surface.SetDrawColor(Color(0, 0, 0, 50))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(Color(100, 100, 100, 150))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local mainFrame = self:Add("DPanel")
|
||||
mainFrame:SetSize( SScaleMin(1020 / 3), SScaleMin(372 / 3) )
|
||||
mainFrame:SetPos(ScrW() * 0.5 - mainFrame:GetWide() * 0.5, ScrH() * 0.5 - mainFrame:GetTall() * 0.5)
|
||||
mainFrame.Paint = function( self, w, h ) end
|
||||
|
||||
-- Main frame (invisible)
|
||||
local rightFrame = vgui.Create( "DPanel", mainFrame )
|
||||
rightFrame:SetSize( SScaleMin(800 / 3), 0 )
|
||||
rightFrame:Dock(RIGHT)
|
||||
rightFrame.Paint = function( self, w, h ) end
|
||||
|
||||
local leftFrame = vgui.Create( "DPanel", mainFrame)
|
||||
leftFrame:SetSize( SScaleMin(200 / 3), 0 )
|
||||
leftFrame:Dock(LEFT)
|
||||
leftFrame:DockMargin(0, SScaleMin(11 / 3), 0, 0)
|
||||
leftFrame.Paint = function( self, w, h )
|
||||
FramePaint(self, w, h)
|
||||
|
||||
surface.SetDrawColor(Color(150, 150, 150, 20))
|
||||
surface.SetMaterial(Material("willardnetworks/tabmenu/crafting/box_pattern.png", "noclamp"))
|
||||
surface.DrawTexturedRectUV( 0, 0, w, h, 0, 0, w / SScaleMin(414 / 3), h / SScaleMin(677 / 3) )
|
||||
end
|
||||
|
||||
-- Character model
|
||||
self.icon = vgui.Create( "ixModelPanel", leftFrame )
|
||||
self.icon:Dock(TOP)
|
||||
self.icon:SetTall(SScaleMin(372 / 3))
|
||||
self.icon:DockMargin(0, 0 - SScaleMin(20 / 3), 0, 0)
|
||||
self.icon:SetFOV(38)
|
||||
self.icon:SetModel( LocalPlayer():GetModel(), LocalPlayer():GetSkin(), true )
|
||||
|
||||
local title = rightFrame:Add("DLabel")
|
||||
title:SetFont("WNSmallerMenuTitleNoClamp")
|
||||
title:SetTextColor(Color(255, 255, 255, 255))
|
||||
title:SetExpensiveShadow(1, Color(0, 0, 0, 150))
|
||||
title:SetText(string.utf8upper("Informations Personnages & RP"))
|
||||
title:SizeToContents()
|
||||
title:Dock(TOP)
|
||||
|
||||
|
||||
local charInfoFrame = rightFrame:Add("DPanel")
|
||||
charInfoFrame:SetSize(rightFrame:GetWide(), SScaleMin(170 / 3))
|
||||
charInfoFrame:Dock(TOP)
|
||||
charInfoFrame:DockMargin(0, 0, 0, SScaleMin(20 / 3))
|
||||
|
||||
local boxPattern = Material("willardnetworks/tabmenu/crafting/box_pattern.png", "noclamp")
|
||||
charInfoFrame.Paint = function( self, w, h )
|
||||
FramePaint(self, w, h)
|
||||
|
||||
surface.SetDrawColor(Color(150, 150, 150, 20))
|
||||
surface.SetMaterial(boxPattern)
|
||||
surface.DrawTexturedRectUV( 0, 0, w, h, 0, 0, w / SScaleMin(414 / 3), h / SScaleMin(677 / 3) )
|
||||
end
|
||||
|
||||
local function GetPartColor(name)
|
||||
if LocalPlayer():GetNetVar(name) and LocalPlayer():GetNetVar("fullHealth") == false then
|
||||
return Color(255, 129, 122, 255)
|
||||
else
|
||||
return Color(255, 255, 255, 255)
|
||||
end
|
||||
end
|
||||
|
||||
local bodyParts = {
|
||||
{Image = "willardnetworks/f1menu/chest.png", Name = "ChestDamaged"},
|
||||
{Image = "willardnetworks/f1menu/head.png", Name = "HeadDamaged"},
|
||||
{Image = "willardnetworks/f1menu/larm.png", Name = "LArmDamaged"},
|
||||
{Image = "willardnetworks/f1menu/lleg.png", Name = "LLegDamaged"},
|
||||
{Image = "willardnetworks/f1menu/rarm.png", Name = "RArmDamaged"},
|
||||
{Image = "willardnetworks/f1menu/rleg.png", Name = "RLegDamaged"},
|
||||
{Image = "willardnetworks/f1menu/stomach.png", Name = "StomachDamaged"}
|
||||
}
|
||||
|
||||
-- Body
|
||||
local bodyFrame = charInfoFrame:Add("DPanel")
|
||||
bodyFrame:SetWide( SScaleMin(100 / 3) )
|
||||
bodyFrame:Dock(LEFT)
|
||||
bodyFrame.Paint = function(self, w, h) end
|
||||
|
||||
local body = bodyFrame:Add("DImage")
|
||||
local w, h = SScaleMin(64 / 3), SScaleMin(128 / 3)
|
||||
local x, y = bodyFrame:GetWide() * 0.5 - w * 0.5, charInfoFrame:GetTall() * 0.5 - h * 0.5
|
||||
|
||||
body:SetSize( w, h )
|
||||
body:SetPos(x, y)
|
||||
body:SetImage( "willardnetworks/f1menu/body.png" )
|
||||
|
||||
for k, v in pairs(bodyParts) do
|
||||
local bodypart = bodyFrame:Add("DImage")
|
||||
bodypart:SetSize( w, h )
|
||||
bodypart:SetPos(x, y)
|
||||
bodypart:SetImage( v.Image )
|
||||
bodypart:SetImageColor( GetPartColor(v.Name) )
|
||||
end
|
||||
|
||||
local textFrame = charInfoFrame:Add("DPanel")
|
||||
textFrame:SetWide( SScaleMin( 500 / 3) )
|
||||
textFrame:Dock(LEFT)
|
||||
textFrame.Paint = function(self, w, h) end
|
||||
|
||||
local name = textFrame:Add("DLabel")
|
||||
name:SetFont("TitlesFontNoClamp")
|
||||
name:SetTextColor(Color(254, 200, 0, 255))
|
||||
name:SetExpensiveShadow(1, Color(0, 0, 0, 50))
|
||||
name:SetText(LocalPlayer():Name())
|
||||
name:SizeToContents()
|
||||
name:Dock(TOP)
|
||||
name:DockMargin(0, SScaleMin(23 / 3), 0, 0)
|
||||
|
||||
local faction = textFrame:Add("DLabel")
|
||||
local factionTable = ix.faction.Get(LocalPlayer():Team())
|
||||
faction:SetFont("TitlesFontNoClamp")
|
||||
faction:SetTextColor(Color(254, 200, 0, 255))
|
||||
faction:SetExpensiveShadow(1, Color(0, 0, 0, 50))
|
||||
faction:SetText(factionTable.name)
|
||||
faction:SizeToContents()
|
||||
faction:Dock(TOP)
|
||||
faction:DockMargin(0, SScaleMin(9 / 3), 0, 0)
|
||||
|
||||
local citizenid = textFrame:Add("DLabel")
|
||||
local cidtext = LocalPlayer():GetCharacter():GetCid() or "N/A"
|
||||
citizenid:SetFont("TitlesFontNoClamp")
|
||||
citizenid:SetTextColor(Color(255, 255, 255, 255))
|
||||
citizenid:SetExpensiveShadow(1, Color(0, 0, 0, 50))
|
||||
citizenid:SetText("CID : #"..cidtext or "AUCUN")
|
||||
citizenid:SizeToContents()
|
||||
citizenid:Dock(TOP)
|
||||
citizenid:DockMargin(0, SScaleMin(9 / 3), 0, 0)
|
||||
|
||||
local tokens = textFrame:Add("DLabel")
|
||||
tokens:SetFont("TitlesFontNoClamp")
|
||||
tokens:SetTextColor(Color(255, 255, 255, 255))
|
||||
tokens:SetExpensiveShadow(1, Color(0, 0, 0, 50))
|
||||
tokens:SetText("Crédits : "..LocalPlayer():GetCharacter():GetMoney())
|
||||
tokens:SizeToContents()
|
||||
tokens:Dock(TOP)
|
||||
tokens:DockMargin(0, SScaleMin(9 / 3), 0, 0)
|
||||
|
||||
local description = vgui.Create("DButton", rightFrame)
|
||||
description:SetFont("MenuFontNoClamp")
|
||||
description:SetText( "Description" )
|
||||
description:Dock(TOP)
|
||||
description:DockMargin(0, 0, 0, 0 - SScaleMin(1 / 3))
|
||||
description:SetSize( rightFrame:GetWide(), SScaleMin(30 / 3) )
|
||||
|
||||
description.Paint = function( self, w, h ) FramePaint(self, w, h) end
|
||||
|
||||
description.DoClick = function ( btn )
|
||||
Derma_StringRequest(LocalPlayer():Name(), "Entrez votre description", LocalPlayer():GetCharacter():GetDescription(), function(desc)
|
||||
ix.command.Send("CharDesc", desc)
|
||||
end)
|
||||
end
|
||||
|
||||
local detDesc = vgui.Create("DButton", rightFrame)
|
||||
detDesc:SetFont("MenuFontNoClamp")
|
||||
detDesc:SetText( "Animations" )
|
||||
detDesc:Dock(TOP)
|
||||
detDesc:DockMargin(0, 0, 0, 0 - SScaleMin(1 / 3))
|
||||
detDesc:SetSize( rightFrame:GetWide(), SScaleMin(30 / 3) )
|
||||
detDesc.Paint = function( self, w, h ) FramePaint(self, w, h) end
|
||||
|
||||
detDesc.DoClick = function ( btn )
|
||||
local MenuButtonOptions = DermaMenu() -- Creates the menu
|
||||
MenuButtonOptions:AddOption("Act Arrest", function() ix.command.Send("actarrest") end ) -- Add options to the menu
|
||||
MenuButtonOptions:AddOption("Act Injured", function() ix.command.Send("actinjured") end )
|
||||
MenuButtonOptions:AddOption("Act Cheer", function() ix.command.Send("actcheer") end )
|
||||
MenuButtonOptions:AddOption("Act Lean", function() ix.command.Send("actlean") end )
|
||||
MenuButtonOptions:AddOption("Act Pant", function() ix.command.Send("actpant") end )
|
||||
MenuButtonOptions:AddOption("Act Sit", function() ix.command.Send("actsit") end )
|
||||
MenuButtonOptions:AddOption("Act Sit Wall", function() ix.command.Send("actsitwall") end )
|
||||
MenuButtonOptions:AddOption("Act Stand", function() ix.command.Send("actstand") end )
|
||||
MenuButtonOptions:AddOption("Act Wave", function() ix.command.Send("actwave") end )
|
||||
MenuButtonOptions:AddOption("Act Window", function() ix.command.Send("actwindow") end )
|
||||
MenuButtonOptions:AddOption("Act Type", function() ix.command.Send("acttype") end )
|
||||
MenuButtonOptions:AddOption("Act Sit Chair", function() ix.command.Send("actsitchair") end)
|
||||
MenuButtonOptions:AddOption("Act Sit Lean", function() ix.command.Send("actsitlean") end)
|
||||
MenuButtonOptions:Open() -- Open the menu AFTER adding your options
|
||||
|
||||
for _, v in pairs(MenuButtonOptions:GetChildren()[1]:GetChildren()) do
|
||||
if v:GetClassName() == "Label" then
|
||||
v:SetFont("MenuFontNoClamp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local fallover = vgui.Create("DButton", rightFrame)
|
||||
fallover:SetFont("MenuFontNoClamp")
|
||||
fallover:SetText( "S'évanouir" )
|
||||
fallover:Dock(TOP)
|
||||
fallover:DockMargin(0, 0, 0, 0 - SScaleMin(1 / 3))
|
||||
fallover:SetSize( rightFrame:GetWide(), SScaleMin(30 / 3) )
|
||||
fallover.Paint = function( self, w, h ) FramePaint(self, w, h) end
|
||||
|
||||
fallover.DoClick = function ( btn )
|
||||
ix.command.Send("CharFallover")
|
||||
end
|
||||
|
||||
hook.Run("F1MenuCreated", self, mainFrame, leftFrame, rightFrame)
|
||||
|
||||
self:MakePopup()
|
||||
self:OnOpened()
|
||||
end
|
||||
|
||||
function PANEL:OnOpened()
|
||||
self:SetAlpha(0)
|
||||
|
||||
self:CreateAnimation(animationTime, {
|
||||
target = {currentAlpha = 255},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.currentAlpha)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:OnKeyCodePressed(key)
|
||||
self.noAnchor = CurTime() + 0.5
|
||||
|
||||
if (key == KEY_F1) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
local bF1Down = input.IsKeyDown(KEY_F1)
|
||||
|
||||
if (bF1Down and (self.noAnchor or CurTime() + 0.4) < CurTime() and self.anchorMode) then
|
||||
self.anchorMode = false
|
||||
end
|
||||
|
||||
if ((!self.anchorMode and !bF1Down) or gui.IsGameUIVisible()) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
Derma_DrawBackgroundBlur( self, 0 )
|
||||
|
||||
BaseClass.Paint(self, width, height)
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
self.bClosing = true
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
|
||||
if IsValid(self.icon) then
|
||||
self.icon:Remove()
|
||||
end
|
||||
|
||||
CloseDermaMenus()
|
||||
gui.EnableScreenClicker(false)
|
||||
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
index = 2,
|
||||
target = {currentBlur = 0},
|
||||
easing = "outQuint"
|
||||
})
|
||||
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
target = {currentAlpha = 0},
|
||||
easing = "outQuint",
|
||||
|
||||
-- we don't animate the blur because blurring doesn't draw things
|
||||
-- with amount < 1 very well, resulting in jarring transition
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.currentAlpha)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
BaseClass.Remove(panel)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vgui.Register("ixF1Menu", PANEL, "ixSubpanelParent")
|
||||
|
||||
if (IsValid(ix.gui.F1Menu)) then
|
||||
ix.gui.F1Menu:Remove()
|
||||
end
|
||||
702
gamemodes/helix/plugins/willardinterface/derma/cl_generic.lua
Normal file
702
gamemodes/helix/plugins/willardinterface/derma/cl_generic.lua
Normal file
@@ -0,0 +1,702 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
-- generic panels that are applicable anywhere
|
||||
|
||||
-- used for prominent text entries
|
||||
DEFINE_BASECLASS("DTextEntry")
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "backgroundColor", "BackgroundColor")
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetPaintBackground(false)
|
||||
self:SetTextColor(color_white)
|
||||
|
||||
self.backgroundColor = Color(255, 255, 255, 25)
|
||||
end
|
||||
|
||||
function PANEL:SetFont(font)
|
||||
surface.SetFont(font)
|
||||
local _, height = surface.GetTextSize("W@")
|
||||
|
||||
self:SetTall(height)
|
||||
BaseClass.SetFont(self, font)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
derma.SkinFunc("DrawImportantBackground", 0, 0, width, height, self.backgroundColor)
|
||||
BaseClass.Paint(self, width, height)
|
||||
end
|
||||
|
||||
vgui.Register("ixTextEntry", PANEL, "DTextEntry")
|
||||
|
||||
-- similar to a frame, but is mainly used for grouping panels together in a list
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "text", "Text", FORCE_STRING)
|
||||
AccessorFunc(PANEL, "color", "Color")
|
||||
|
||||
function PANEL:Init()
|
||||
self.text = ""
|
||||
self.paddingTop = SScaleMin(32 / 3)
|
||||
|
||||
local skin = self:GetSkin()
|
||||
|
||||
if (skin and skin.fontCategoryBlur) then
|
||||
surface.SetFont("TitlesFontNoClamp")
|
||||
self.paddingTop = select(2, surface.GetTextSize("W@")) + SScaleMin(6 / 3)
|
||||
end
|
||||
|
||||
self:DockPadding(SScaleMin(1 / 3), self.paddingTop, SScaleMin(1 / 3), SScaleMin(1 / 3))
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local height = self.paddingTop + SScaleMin(1 / 3)
|
||||
|
||||
for _, v in ipairs(self:GetChildren()) do
|
||||
if (IsValid(v) and v:IsVisible()) then
|
||||
local _, top, _, bottom = v:GetDockMargin()
|
||||
|
||||
height = height + v:GetTall() + top + bottom
|
||||
end
|
||||
end
|
||||
|
||||
self:SetTall(height)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
text = self.text or ""
|
||||
color = self.color or ix.config.Get("color")
|
||||
|
||||
|
||||
surface.SetFont("TitlesFontNoClamp")
|
||||
|
||||
local textHeight = select(2, surface.GetTextSize(text)) + SScaleMin(6 / 3)
|
||||
local width, height = self:GetSize()
|
||||
|
||||
surface.SetDrawColor(0, 0, 0, 100)
|
||||
surface.DrawRect(0, textHeight, width, height - textHeight)
|
||||
|
||||
surface.SetDrawColor(Color(0, 0, 0, 0))
|
||||
surface.DrawRect(0, 0, width, textHeight)
|
||||
|
||||
surface.SetFont("TitlesFontNoClamp")
|
||||
surface.SetTextColor(color_white)
|
||||
surface.SetTextPos(0, SScaleMin(1 / 3))
|
||||
surface.DrawText(text)
|
||||
|
||||
return SScaleMin(1 / 3), textHeight, SScaleMin(1 / 3), SScaleMin(1 / 3)
|
||||
end
|
||||
|
||||
vgui.Register("ixCategoryPanel", PANEL, "EditablePanel")
|
||||
|
||||
-- segmented progress bar
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "font", "Font", FORCE_STRING)
|
||||
AccessorFunc(PANEL, "barColor", "BarColor")
|
||||
AccessorFunc(PANEL, "textColor", "TextColor")
|
||||
AccessorFunc(PANEL, "progress", "Progress", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "padding", "Padding", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "animationTime", "AnimationTime", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "easingType", "EasingType", FORCE_STRING)
|
||||
|
||||
function PANEL:Init()
|
||||
self.segments = {}
|
||||
self.padding = ScrH() * 0.01
|
||||
self.fraction = 0
|
||||
self.animationTime = 0.5
|
||||
self.easingType = "outQuint"
|
||||
self.progress = 0
|
||||
end
|
||||
|
||||
function PANEL:AddSegment(text)
|
||||
local id = #self.segments + 1
|
||||
|
||||
if (text:utf8sub(1, 1) == "@") then
|
||||
text = L(text:utf8sub(2))
|
||||
end
|
||||
|
||||
self.segments[id] = text
|
||||
return id
|
||||
end
|
||||
|
||||
function PANEL:AddSegments(...)
|
||||
local segments = {...}
|
||||
|
||||
for i = 1, #segments do
|
||||
self:AddSegment(segments[i])
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetSegments()
|
||||
return self.segments
|
||||
end
|
||||
|
||||
function PANEL:SetProgress(segment)
|
||||
self.progress = math.Clamp(segment, 0, #self.segments)
|
||||
|
||||
self:CreateAnimation(self.animationTime, {
|
||||
target = {fraction = self.progress / #self.segments},
|
||||
easing = self.easingType
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:IncrementProgress(amount)
|
||||
self:SetProgress(self.progress + (amount or 1))
|
||||
end
|
||||
|
||||
function PANEL:DecrementProgress(amount)
|
||||
self:SetProgress(self.progress - (amount or 1))
|
||||
end
|
||||
|
||||
function PANEL:GetFraction()
|
||||
return self.fraction
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
self:SetTall(draw.GetFontHeight(self.font or self:GetSkin().fontSegmentedProgress) + self.padding)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
derma.SkinFunc("PaintSegmentedProgressBackground", self, width, height)
|
||||
|
||||
if (#self.segments > 0) then
|
||||
derma.SkinFunc("PaintSegmentedProgress", self, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixSegmentedProgress", PANEL, "Panel")
|
||||
|
||||
-- list of labelled information
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "labelColor", "LabelColor")
|
||||
AccessorFunc(PANEL, "textColor", "TextColor")
|
||||
AccessorFunc(PANEL, "list", "List")
|
||||
AccessorFunc(PANEL, "minWidth", "MinimumWidth", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self.label = self:Add("DLabel")
|
||||
self.label:SetFont("TitlesFontNoClamp")
|
||||
self.label:SetExpensiveShadow(1)
|
||||
self.label:SetTextColor(color_white)
|
||||
self.label:SetText("Label")
|
||||
self.label:SetContentAlignment(5)
|
||||
self.label:Dock(LEFT)
|
||||
self.label:DockMargin(0, 0, SScaleMin(4 / 3), 0)
|
||||
self.label:SizeToContents()
|
||||
self.label.Paint = function(this, width, height)
|
||||
derma.SkinFunc("PaintListRow", this, width, height)
|
||||
end
|
||||
|
||||
self.text = self:Add("DLabel")
|
||||
self.text:SetFont("TitlesFontNoBoldNoClamp")
|
||||
self.text:SetTextColor(color_white)
|
||||
self.text:SetText("Text")
|
||||
self.text:SetTextInset(SScaleMin(8 / 3), 0)
|
||||
self.text:Dock(FILL)
|
||||
self.text:DockMargin(SScaleMin(4 / 3), 0, 0, 0)
|
||||
self.text:SizeToContents()
|
||||
self.text.Paint = function(this, width, height)
|
||||
derma.SkinFunc("PaintListRow", this, width, height)
|
||||
end
|
||||
|
||||
self:DockMargin(0, 0, 0, SScaleMin(8 / 3))
|
||||
|
||||
self.list = {}
|
||||
self.minWidth = SScaleMin(100 / 3)
|
||||
end
|
||||
|
||||
function PANEL:SetRightPanel(panel)
|
||||
self.text:Remove()
|
||||
|
||||
self.text = self:Add(panel)
|
||||
self.text:Dock(FILL)
|
||||
self.text:DockMargin(SScaleMin(8 / 3), SScaleMin(4 / 3), SScaleMin(4 / 3), SScaleMin(4 / 3))
|
||||
self.text:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:SetList(list, bNoAdd)
|
||||
if (!bNoAdd) then
|
||||
list[#list + 1] = self
|
||||
end
|
||||
|
||||
self.list = list
|
||||
end
|
||||
|
||||
function PANEL:UpdateLabelWidths()
|
||||
local maxWidth = self.label:GetWide()
|
||||
|
||||
for i = 1, #self.list do
|
||||
maxWidth = math.max(self.list[i]:GetLabelWidth(), maxWidth)
|
||||
end
|
||||
|
||||
maxWidth = math.max(self.minWidth, maxWidth)
|
||||
|
||||
for i = 1, #self.list do
|
||||
self.list[i]:SetLabelWidth(maxWidth)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetLabelColor(color)
|
||||
self.label:SetTextColor(color)
|
||||
end
|
||||
|
||||
function PANEL:SetTextColor(color)
|
||||
self.text:SetTextColor(color)
|
||||
end
|
||||
|
||||
function PANEL:SetLabelText(text)
|
||||
self.label:SetText(text)
|
||||
self.label:SizeToContents()
|
||||
|
||||
self:UpdateLabelWidths()
|
||||
end
|
||||
|
||||
function PANEL:SetText(text)
|
||||
self.text:SetText(text)
|
||||
self.text:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:SetLabelWidth(width)
|
||||
self.label:SetWide(width)
|
||||
end
|
||||
|
||||
function PANEL:GetLabelWidth(bWithoutMargin)
|
||||
if (!bWithoutMargin) then
|
||||
return self.label:GetWide()
|
||||
end
|
||||
|
||||
local left, _, right, _ = self.label:GetDockMargin()
|
||||
return self.label:GetWide() + left + right
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
self:SetTall(math.max(self.label:GetTall(), self.text:GetTall()) + SScaleMin(8 / 3))
|
||||
end
|
||||
|
||||
vgui.Register("ixListRow", PANEL, "Panel")
|
||||
|
||||
-- alternative checkbox
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "bChecked", "Checked", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "animationTime", "AnimationTime", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "labelPadding", "LabelPadding", FORCE_NUMBER)
|
||||
|
||||
PANEL.GetValue = PANEL.GetChecked
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetMouseInputEnabled(true)
|
||||
self:SetCursor("hand")
|
||||
|
||||
self.labelPadding = SScaleMin(8 / 3)
|
||||
|
||||
self.animationOffset = 0
|
||||
self.animationTime = 0.5
|
||||
self.bChecked = false
|
||||
|
||||
surface.SetFont("TitlesFontNoBoldNoClamp")
|
||||
self:SetWide(math.max(surface.GetTextSize(L("yes")), surface.GetTextSize(L("no"))) + self.labelPadding)
|
||||
end
|
||||
|
||||
-- can be overidden to change audio params
|
||||
function PANEL:GetAudioFeedback()
|
||||
return "weapons/ar2/ar2_empty.wav", 75, self.bChecked and 150 or 125, 0.25
|
||||
end
|
||||
|
||||
function PANEL:EmitFeedback()
|
||||
LocalPlayer():EmitSound(self:GetAudioFeedback())
|
||||
end
|
||||
|
||||
function PANEL:SetChecked(bChecked, bInstant)
|
||||
self.bChecked = tobool(bChecked)
|
||||
|
||||
self:CreateAnimation(bInstant and 0 or self.animationTime, {
|
||||
index = 1,
|
||||
target = {
|
||||
animationOffset = bChecked and 1 or 0
|
||||
},
|
||||
easing = "outElastic"
|
||||
})
|
||||
|
||||
if (!bInstant) then
|
||||
self:EmitFeedback()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed(code)
|
||||
if (code == MOUSE_LEFT) then
|
||||
self:SetChecked(!self.bChecked)
|
||||
self:DoClick()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:DoClick()
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(derma.GetColor("DarkerBackground", self))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
local offset = self.animationOffset
|
||||
surface.SetFont("TitlesFontNoBoldNoClamp")
|
||||
|
||||
local text = L("no"):utf8upper()
|
||||
local textWidth, textHeight = surface.GetTextSize(text)
|
||||
local y = offset * -textHeight
|
||||
|
||||
surface.SetTextColor(250, 60, 60, 255)
|
||||
surface.SetTextPos(width * 0.5 - textWidth * 0.5, y + height * 0.5 - textHeight * 0.5)
|
||||
surface.DrawText(text)
|
||||
|
||||
text = L("yes"):utf8upper()
|
||||
y = y + textHeight
|
||||
textWidth, textHeight = surface.GetTextSize(text)
|
||||
|
||||
surface.SetTextColor(30, 250, 30, 255)
|
||||
surface.SetTextPos(width * 0.5 - textWidth * 0.5, y + height * 0.5 - textHeight * 0.5)
|
||||
surface.DrawText(text)
|
||||
end
|
||||
|
||||
vgui.Register("ixCheckBox", PANEL, "EditablePanel")
|
||||
|
||||
-- alternative num slider
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "labelPadding", "LabelPadding", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self.labelPadding = SScaleMin(8 / 3)
|
||||
|
||||
surface.SetFont("TitlesFontNoBoldNoClamp")
|
||||
local totalWidth = surface.GetTextSize("999") -- start off with 3 digit width
|
||||
|
||||
self.label = self:Add("DLabel")
|
||||
self.label:Dock(RIGHT)
|
||||
self.label:SetWide(totalWidth + self.labelPadding)
|
||||
self.label:SetContentAlignment(5)
|
||||
self.label:SetFont("TitlesFontNoBoldNoClamp")
|
||||
self.label.Paint = function(panel, width, height)
|
||||
surface.SetDrawColor(derma.GetColor("DarkerBackground", self))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
self.label.SizeToContents = function(panel)
|
||||
surface.SetFont(panel:GetFont())
|
||||
local textWidth = surface.GetTextSize(panel:GetText())
|
||||
|
||||
if (textWidth > totalWidth) then
|
||||
panel:SetWide(textWidth + self.labelPadding)
|
||||
elseif (panel:GetWide() > totalWidth + self.labelPadding) then
|
||||
panel:SetWide(totalWidth + self.labelPadding)
|
||||
end
|
||||
end
|
||||
|
||||
self.slider = self:Add("ixSlider")
|
||||
self.slider:Dock(FILL)
|
||||
self.slider:DockMargin(0, 0, SScaleMin(4 / 3), 0)
|
||||
self.slider.OnValueChanged = function(panel)
|
||||
self:OnValueChanged()
|
||||
end
|
||||
self.slider.OnValueUpdated = function(panel)
|
||||
self.label:SetText(tostring(panel:GetValue()))
|
||||
self.label:SizeToContents()
|
||||
|
||||
self:OnValueUpdated()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetLabel()
|
||||
return self.label
|
||||
end
|
||||
|
||||
function PANEL:GetSlider()
|
||||
return self.slider
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value, bNoNotify)
|
||||
value = tonumber(value) or self.slider:GetMin()
|
||||
|
||||
self.slider:SetValue(value, bNoNotify)
|
||||
self.label:SetText(tostring(self.slider:GetValue()))
|
||||
self.label:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return self.slider:GetValue()
|
||||
end
|
||||
|
||||
function PANEL:GetFraction()
|
||||
return self.slider:GetFraction()
|
||||
end
|
||||
|
||||
function PANEL:GetVisualFraction()
|
||||
return self.slider:GetVisualFraction()
|
||||
end
|
||||
|
||||
function PANEL:SetMin(value)
|
||||
self.slider:SetMin(value)
|
||||
end
|
||||
|
||||
function PANEL:SetMax(value)
|
||||
self.slider:SetMax(value)
|
||||
end
|
||||
|
||||
function PANEL:GetMin()
|
||||
return self.slider:GetMin()
|
||||
end
|
||||
|
||||
function PANEL:GetMax()
|
||||
return self.slider:GetMax()
|
||||
end
|
||||
|
||||
function PANEL:SetDecimals(value)
|
||||
self.slider:SetDecimals(value)
|
||||
end
|
||||
|
||||
function PANEL:GetDecimals()
|
||||
return self.slider:GetDecimals()
|
||||
end
|
||||
|
||||
-- called when changed by user
|
||||
function PANEL:OnValueChanged()
|
||||
end
|
||||
|
||||
-- called when changed while dragging bar
|
||||
function PANEL:OnValueUpdated()
|
||||
end
|
||||
|
||||
vgui.Register("ixNumSlider", PANEL, "Panel")
|
||||
|
||||
-- alternative slider
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "bDragging", "Dragging", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "min", "Min", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "max", "Max", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "decimals", "Decimals", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self.min = 0
|
||||
self.max = 10
|
||||
self.value = 0
|
||||
self.visualValue = 0
|
||||
self.decimals = 0
|
||||
|
||||
self:SetCursor("hand")
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value, bNoNotify)
|
||||
self.value = math.Clamp(math.Round(tonumber(value) or self.min, self.decimals), self.min, self.max)
|
||||
self:ValueUpdated(bNoNotify)
|
||||
|
||||
if (!bNoNotify) then
|
||||
self:OnValueChanged()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return self.value
|
||||
end
|
||||
|
||||
function PANEL:GetFraction()
|
||||
return math.Remap(self.value, self.min, self.max, 0, 1)
|
||||
end
|
||||
|
||||
function PANEL:GetVisualFraction()
|
||||
return math.Remap(self.visualValue, self.min, self.max, 0, 1)
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed(key)
|
||||
if (key == MOUSE_LEFT) then
|
||||
self.bDragging = true
|
||||
self:MouseCapture(true)
|
||||
|
||||
self:OnCursorMoved(self:CursorPos())
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnMouseReleased(key)
|
||||
if (self.bDragging) then
|
||||
self:OnValueChanged()
|
||||
end
|
||||
|
||||
self.bDragging = false
|
||||
self:MouseCapture(false)
|
||||
end
|
||||
|
||||
function PANEL:OnCursorMoved(x, y)
|
||||
if (!self.bDragging) then
|
||||
return
|
||||
end
|
||||
|
||||
x = math.Clamp(x, 0, self:GetWide())
|
||||
local oldValue = self.value
|
||||
|
||||
self.value = math.Clamp(math.Round(
|
||||
math.Remap(x / self:GetWide(), 0, 1, self.min, self.max), self.decimals
|
||||
), self.min, self.max)
|
||||
|
||||
self:CreateAnimation(0.5, {
|
||||
index = 1,
|
||||
target = {visualValue = self.value},
|
||||
easing = "outQuint"
|
||||
})
|
||||
|
||||
if (self.value != oldValue) then
|
||||
self:ValueUpdated()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnValueChanged()
|
||||
end
|
||||
|
||||
function PANEL:ValueUpdated(bNoNotify)
|
||||
self:CreateAnimation(bNoNotify and 0 or 0.5, {
|
||||
index = 1,
|
||||
target = {visualValue = self.value},
|
||||
easing = "outQuint"
|
||||
})
|
||||
|
||||
if (!bNoNotify) then
|
||||
self:OnValueUpdated()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnValueUpdated()
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
derma.SkinFunc("PaintHelixSlider", self, width, height)
|
||||
end
|
||||
|
||||
vgui.Register("ixSlider", PANEL, "EditablePanel")
|
||||
|
||||
-- label with custom kerning
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "text", "Text", FORCE_STRING)
|
||||
AccessorFunc(PANEL, "color", "TextColor")
|
||||
AccessorFunc(PANEL, "kerning", "Kerning", FORCE_NUMBER) -- in px
|
||||
AccessorFunc(PANEL, "font", "Font", FORCE_STRING)
|
||||
AccessorFunc(PANEL, "bCentered", "Centered", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "bDrawShadow", "ExpensiveShadow")
|
||||
|
||||
function PANEL:Init()
|
||||
self.text = ""
|
||||
self.color = color_white
|
||||
self.kerning = 2
|
||||
self.font = "DermaDefault"
|
||||
self.bCentered = false
|
||||
|
||||
self.shadowDistance = 0
|
||||
self.color = color_black
|
||||
end
|
||||
|
||||
function PANEL:SetText(text)
|
||||
self.text = tostring(text)
|
||||
self:GetContentSize(true)
|
||||
end
|
||||
|
||||
function PANEL:SetExpensiveShadow(distance, color) -- we'll retain similar naming to the DLabel shadow
|
||||
self.shadowDistance = distance or 1
|
||||
self.shadowColor = ix.util.DimColor(self.color, 0.5)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetFont(self.font)
|
||||
local x = self.bCentered and (width * 0.5 - self:GetContentSize() * 0.5) or 0
|
||||
|
||||
for i = 1, #self.text do
|
||||
local character = self.text[i]
|
||||
local textWidth, _ = surface.GetTextSize(character)
|
||||
local kerning = i == 1 and 0 or self.kerning
|
||||
local shadowDistance = self.shadowDistance
|
||||
|
||||
-- shadow
|
||||
if (self.shadowDistance > 0) then
|
||||
surface.SetTextColor(self.shadowColor)
|
||||
surface.SetTextPos(x + kerning + shadowDistance, shadowDistance)
|
||||
surface.DrawText(character)
|
||||
end
|
||||
|
||||
-- character
|
||||
surface.SetTextColor(self.color)
|
||||
surface.SetTextPos(x + kerning, 0)
|
||||
surface.DrawText(character)
|
||||
|
||||
x = x + textWidth + kerning
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetContentSize(bCalculate)
|
||||
if (bCalculate or !self.contentSize) then
|
||||
local width = 0
|
||||
surface.SetFont(self.font)
|
||||
|
||||
for i = 1, #self.text do
|
||||
local textWidth, _ = surface.GetTextSize(self.text[i])
|
||||
width = width + textWidth + self.kerning
|
||||
end
|
||||
|
||||
self.contentSize = {width, draw.GetFontHeight(self.font)}
|
||||
end
|
||||
|
||||
return self.contentSize[1], self.contentSize[2]
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
self:SetSize(self:GetContentSize(true))
|
||||
end
|
||||
|
||||
vgui.Register("ixKLabel", PANEL, "Panel")
|
||||
|
||||
-- text entry with icon
|
||||
DEFINE_BASECLASS("ixTextEntry")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "icon", "Icon", FORCE_STRING)
|
||||
AccessorFunc(PANEL, "iconColor", "IconColor")
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetIcon("V")
|
||||
self:SetFont("ixSmallTitleFont")
|
||||
|
||||
self.iconColor = Color(200, 200, 200, 160)
|
||||
end
|
||||
|
||||
function PANEL:SetIcon(newIcon)
|
||||
surface.SetFont("ixSmallTitleIcons")
|
||||
|
||||
self.iconWidth, self.iconHeight = surface.GetTextSize(newIcon)
|
||||
self.icon = newIcon
|
||||
|
||||
self:DockMargin(self.iconWidth + 2, 0, 0, 8)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
BaseClass.Paint(self, width, height)
|
||||
|
||||
-- there's no inset for text entries so we'll have to get creative
|
||||
DisableClipping(true)
|
||||
surface.SetDrawColor(self:GetBackgroundColor())
|
||||
surface.DrawRect(-self.iconWidth - 2, 0, self.iconWidth + 2, height)
|
||||
|
||||
surface.SetFont("ixSmallTitleIcons")
|
||||
surface.SetTextColor(self.iconColor)
|
||||
surface.SetTextPos(-self.iconWidth, 0)
|
||||
surface.DrawText("V")
|
||||
DisableClipping(false)
|
||||
end
|
||||
|
||||
vgui.Register("ixIconTextEntry", PANEL, "ixTextEntry")
|
||||
355
gamemodes/helix/plugins/willardinterface/derma/cl_help.lua
Normal file
355
gamemodes/helix/plugins/willardinterface/derma/cl_help.lua
Normal file
@@ -0,0 +1,355 @@
|
||||
--[[
|
||||
| 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 backgroundColor = Color(0, 0, 0, 66)
|
||||
local titlePushDown = 30
|
||||
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "maxWidth", "MaxWidth", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
|
||||
self:SetWide(SScaleMin(180 / 3))
|
||||
self:Dock(LEFT)
|
||||
|
||||
self.maxWidth = ScrW() * 0.2
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(backgroundColor)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local width = 0
|
||||
|
||||
for _, v in ipairs(self:GetChildren()) do
|
||||
width = math.max(width, v:GetWide())
|
||||
end
|
||||
|
||||
self:SetSize(math.max(SScaleMin(32 / 3), math.min(width, self.maxWidth)), self:GetParent():GetTall())
|
||||
end
|
||||
|
||||
vgui.Register("ixHelpMenuCategories", PANEL, "EditablePanel")
|
||||
|
||||
-- help menu
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
local titlePushDown = SScaleMin(30 / 3)
|
||||
local topPushDown = SScaleMin(150 / 3)
|
||||
local scale780 = SScaleMin(780 / 3)
|
||||
local scale120 = SScaleMin(120 / 3)
|
||||
|
||||
self:SetWide(ScrW() - (topPushDown * 2))
|
||||
|
||||
local sizeXtitle, sizeYtitle = self:GetWide(), scale120
|
||||
local sizeXcontent, sizeYcontent = self:GetWide(), (scale780)
|
||||
|
||||
self.titlePanel = self:Add("Panel")
|
||||
self.titlePanel:SetSize(sizeXtitle, sizeYtitle)
|
||||
self.titlePanel:SetPos(self:GetWide() * 0.5 - self.titlePanel:GetWide() * 0.5)
|
||||
|
||||
self:CreateTitleText()
|
||||
|
||||
self.contentFrame = self:Add("Panel")
|
||||
self.contentFrame:SetSize(sizeXcontent, sizeYcontent)
|
||||
self.contentFrame:SetPos(self:GetWide() * 0.5 - self.contentFrame:GetWide() * 0.5, titlePushDown)
|
||||
|
||||
self:SetTall(scale120 + scale780 + titlePushDown)
|
||||
self:Center()
|
||||
|
||||
self.categories = {}
|
||||
self.categorySubpanels = {}
|
||||
self.categoryPanel = self.contentFrame:Add("ixHelpMenuCategories")
|
||||
|
||||
self.canvasPanel = self.contentFrame:Add("EditablePanel")
|
||||
self.canvasPanel:Dock(FILL)
|
||||
|
||||
self.idlePanel = self.canvasPanel:Add("Panel")
|
||||
self.idlePanel:Dock(FILL)
|
||||
self.idlePanel:DockMargin(SScaleMin(8 / 3), 0, 0, 0)
|
||||
|
||||
self.idlePanel.Paint = function(_, width, height)
|
||||
local curTime = CurTime()
|
||||
|
||||
surface.SetDrawColor(backgroundColor)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
surface.SetDrawColor(Color(255, 255, 255, 255))
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_base.png"))
|
||||
surface.DrawTexturedRect(width * 0.5 - SScaleMin(195 / 3) * 0.5, height * 0.5 - SScaleMin(196 / 3) * 0.5, SScaleMin(195 / 3), SScaleMin(196 / 3))
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_circle1.png"))
|
||||
surface.DrawTexturedRectRotated((width * 0.5) + 2, (height * 0.5) - 2, SScaleMin(195 / 3), SScaleMin(196 / 3), curTime * -15)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_circle2.png"))
|
||||
surface.DrawTexturedRectRotated((width * 0.5) - 2, (height * 0.5) + 2, SScaleMin(195 / 3), SScaleMin(196 / 3), curTime * -15)
|
||||
end
|
||||
|
||||
local categories = {}
|
||||
hook.Run("PopulateHelpMenu", categories)
|
||||
|
||||
for k, v in SortedPairs(categories) do
|
||||
if (!isstring(k)) then
|
||||
ErrorNoHalt("expected string for help menu key\n")
|
||||
continue
|
||||
elseif (!isfunction(v)) then
|
||||
ErrorNoHalt(string.format("expected function for help menu entry '%s'\n", k))
|
||||
continue
|
||||
end
|
||||
|
||||
self:AddCategory(k)
|
||||
self.categories[k] = v
|
||||
end
|
||||
|
||||
self.categoryPanel:SizeToContents()
|
||||
|
||||
if (ix.gui.lastHelpMenuTab) then
|
||||
self:OnCategorySelected(ix.gui.lastHelpMenuTab)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:AddCategory(name)
|
||||
local button = self.categoryPanel:Add("ixMenuButton")
|
||||
button:SetText(L(name))
|
||||
if (L(name)) == "credits" then
|
||||
button:SetText("Jetons")
|
||||
end
|
||||
-- @todo don't hardcode this but it's the only panel that needs docking at the bottom so it'll do for now
|
||||
button:Dock(name == "credits" and BOTTOM or TOP)
|
||||
button.DoClick = function()
|
||||
self:OnCategorySelected(name)
|
||||
end
|
||||
|
||||
local panel = self.canvasPanel:Add("DScrollPanel")
|
||||
panel:SetVisible(false)
|
||||
panel:Dock(FILL)
|
||||
panel:DockMargin(SScaleMin(8 / 3), 0, 0, 0)
|
||||
panel:GetCanvas():DockPadding(SScaleMin(8 / 3), SScaleMin(8 / 3), SScaleMin(8 / 3), SScaleMin(8 / 3))
|
||||
|
||||
panel.Paint = function(_, width, height)
|
||||
surface.SetDrawColor(backgroundColor)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
-- reverts functionality back to a standard panel in the case that a category will manage its own scrolling
|
||||
panel.DisableScrolling = function()
|
||||
panel:GetCanvas():SetVisible(false)
|
||||
panel:GetVBar():SetVisible(false)
|
||||
panel.OnChildAdded = function() end
|
||||
end
|
||||
|
||||
self.categorySubpanels[name] = panel
|
||||
end
|
||||
|
||||
function PANEL:OnCategorySelected(name)
|
||||
local panel = self.categorySubpanels[name]
|
||||
|
||||
if (!IsValid(panel)) then
|
||||
return
|
||||
end
|
||||
|
||||
if (!panel.bPopulated) then
|
||||
self.categories[name](panel)
|
||||
panel.bPopulated = true
|
||||
end
|
||||
|
||||
if (IsValid(self.activeCategory)) then
|
||||
self.activeCategory:SetVisible(false)
|
||||
end
|
||||
|
||||
panel:SetVisible(true)
|
||||
self.idlePanel:SetVisible(false)
|
||||
|
||||
self.activeCategory = panel
|
||||
ix.gui.lastHelpMenuTab = name
|
||||
end
|
||||
|
||||
function PANEL:CreateTitleText()
|
||||
local informationTitleIcon = self.titlePanel:Add("DImage")
|
||||
informationTitleIcon:SetImage("willardnetworks/tabmenu/navicons/info.png")
|
||||
informationTitleIcon:SetSize(SScaleMin(17 / 3), SScaleMin(17 / 3))
|
||||
|
||||
local informationTitle = self.titlePanel:Add("DLabel")
|
||||
informationTitle:SetFont("TitlesFontNoClamp")
|
||||
informationTitle:SetText("Information")
|
||||
informationTitle:SizeToContents()
|
||||
informationTitle:SetPos(SScaleMin(28 / 3), informationTitleIcon:GetTall() * 0.5 - informationTitle:GetTall() * 0.5)
|
||||
end
|
||||
|
||||
vgui.Register("ixHelpMenu", PANEL, "EditablePanel")
|
||||
|
||||
hook.Add("CreateMenuButtons", "ixHelpMenu", function(tabs)
|
||||
tabs["Informations"] = {
|
||||
|
||||
RowNumber = 4,
|
||||
|
||||
Width = 17,
|
||||
|
||||
Height = 17,
|
||||
|
||||
Icon = "willardnetworks/tabmenu/navicons/info.png",
|
||||
|
||||
Create = function(info, container)
|
||||
local helpMenu = container:Add("ixHelpMenu")
|
||||
end
|
||||
}
|
||||
end)
|
||||
|
||||
hook.Add("PopulateHelpMenu", "ixHelpMenu", function(tabs)
|
||||
tabs["Commandes"] = function(container)
|
||||
-- info text
|
||||
local info = container:Add("DLabel")
|
||||
info:SetFont("MenuFontLargerNoClamp")
|
||||
info:SetText(L("helpCommands"))
|
||||
info:SetContentAlignment(5)
|
||||
info:SetTextColor(color_white)
|
||||
info:SetExpensiveShadow(1, color_black)
|
||||
info:Dock(TOP)
|
||||
info:DockMargin(0, 0, 0, SScaleMin(8 / 3))
|
||||
info:SizeToContents()
|
||||
info:SetTall(info:GetTall() + SScaleMin(16 / 3))
|
||||
|
||||
info.Paint = function(_, width, height)
|
||||
surface.SetDrawColor(Color(0, 0, 0, 50))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
-- commands
|
||||
for uniqueID, command in SortedPairs(ix.command.list) do
|
||||
if (command.OnCheckAccess and !command:OnCheckAccess(LocalPlayer())) then
|
||||
continue
|
||||
end
|
||||
|
||||
local bIsAlias = false
|
||||
local aliasText = ""
|
||||
|
||||
-- we want to show aliases in the same entry for better readability
|
||||
if (command.alias) then
|
||||
local alias = istable(command.alias) and command.alias or {command.alias}
|
||||
|
||||
for _, v in ipairs(alias) do
|
||||
if (v:utf8lower() == uniqueID) then
|
||||
bIsAlias = true
|
||||
break
|
||||
end
|
||||
|
||||
aliasText = aliasText .. ", /" .. v
|
||||
end
|
||||
|
||||
if (bIsAlias) then
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
||||
-- command name
|
||||
local title = container:Add("DLabel")
|
||||
title:SetFont("TitlesFontNoBoldNoClamp")
|
||||
title:SetText("/" .. command.name .. aliasText)
|
||||
title:Dock(TOP)
|
||||
title:SetTextColor(Color(211, 86, 89, 255))
|
||||
title:SetExpensiveShadow(1, color_black)
|
||||
title:SizeToContents()
|
||||
|
||||
-- syntax
|
||||
local syntaxText = command.syntax
|
||||
local syntax
|
||||
|
||||
if (syntaxText != "" and syntaxText != "[none]") then
|
||||
syntax = container:Add("DLabel")
|
||||
syntax:SetFont("TitlesFontNoBoldNoClamp")
|
||||
syntax:SetText(syntaxText)
|
||||
syntax:Dock(TOP)
|
||||
syntax:SetTextColor(color_white)
|
||||
syntax:SetExpensiveShadow(1, color_black)
|
||||
syntax:SetWrap(true)
|
||||
syntax:SetAutoStretchVertical(true)
|
||||
syntax:SizeToContents()
|
||||
end
|
||||
|
||||
-- description
|
||||
local descriptionText = command:GetDescription()
|
||||
|
||||
if (descriptionText != "") then
|
||||
local description = container:Add("DLabel")
|
||||
description:SetFont("MenuFontLargerNoClamp")
|
||||
description:SetText(descriptionText)
|
||||
description:Dock(TOP)
|
||||
description:SetTextColor(color_white)
|
||||
description:SetExpensiveShadow(1, color_black)
|
||||
description:SetWrap(true)
|
||||
description:SetAutoStretchVertical(true)
|
||||
description:SizeToContents()
|
||||
description:DockMargin(0, 0, 0, SScaleMin(8 / 3))
|
||||
elseif (syntax) then
|
||||
syntax:DockMargin(0, 0, 0, SScaleMin(8 / 3))
|
||||
else
|
||||
title:DockMargin(0, 0, 0, SScaleMin(8 / 3))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
tabs["flags"] = function(container)
|
||||
-- info text
|
||||
local info = container:Add("DLabel")
|
||||
info:SetFont("MenuFontLargerNoClamp")
|
||||
info:SetText(L("helpFlags"))
|
||||
info:SetContentAlignment(5)
|
||||
info:SetTextColor(color_white)
|
||||
info:SetExpensiveShadow(1, color_black)
|
||||
info:Dock(TOP)
|
||||
info:DockMargin(0, 0, 0, SScaleMin(8 / 3))
|
||||
info:SizeToContents()
|
||||
info:SetTall(info:GetTall() + SScaleMin(16 / 3))
|
||||
|
||||
info.Paint = function(_, width, height)
|
||||
surface.SetDrawColor(Color(0, 0, 0, 50))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
-- flags
|
||||
for k, v in SortedPairs(ix.flag.list) do
|
||||
local background = ColorAlpha(
|
||||
LocalPlayer():GetCharacter():HasFlags(k) and derma.GetColor("Success", info) or derma.GetColor("Error", info), 88
|
||||
)
|
||||
|
||||
local panel = container:Add("Panel")
|
||||
panel:Dock(TOP)
|
||||
panel:DockMargin(0, 0, 0, SScaleMin(8 / 3))
|
||||
panel:DockPadding(SScaleMin(4 / 3), SScaleMin(4 / 3), SScaleMin(4 / 3), SScaleMin(4 / 3))
|
||||
panel.Paint = function(_, width, height)
|
||||
derma.SkinFunc("DrawImportantBackground", 0, 0, width, height, background)
|
||||
end
|
||||
|
||||
local flag = panel:Add("DLabel")
|
||||
flag:SetFont("TitlesFontNoBoldNoClamp")
|
||||
flag:SetText(string.format("[%s]", k))
|
||||
flag:Dock(LEFT)
|
||||
flag:SetTextColor(color_white)
|
||||
flag:SetExpensiveShadow(1, color_black)
|
||||
flag:SetTextInset(SScaleMin(4 / 3), 0)
|
||||
flag:SizeToContents()
|
||||
flag:SetTall(flag:GetTall() + SScaleMin(8 / 3))
|
||||
|
||||
local description = panel:Add("DLabel")
|
||||
description:SetFont("TitlesFontNoBoldNoClamp")
|
||||
description:SetText(v.description)
|
||||
description:Dock(FILL)
|
||||
description:SetTextColor(color_white)
|
||||
description:SetExpensiveShadow(1, color_black)
|
||||
description:SetTextInset(SScaleMin(8 / 3), 0)
|
||||
description:SizeToContents()
|
||||
description:SetTall(description:GetTall() + SScaleMin(8 / 3))
|
||||
|
||||
panel:SizeToChildren(false, true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,12 @@
|
||||
--[[
|
||||
| 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("CreateMenuButtons", "ixCharInfo", function(tabs)
|
||||
end)
|
||||
275
gamemodes/helix/plugins/willardinterface/derma/cl_intro.lua
Normal file
275
gamemodes/helix/plugins/willardinterface/derma/cl_intro.lua
Normal file
@@ -0,0 +1,275 @@
|
||||
--[[
|
||||
| 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("EditablePanel")
|
||||
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
end
|
||||
|
||||
function PANEL:SetText(text)
|
||||
self.text = text
|
||||
|
||||
self:Clear()
|
||||
|
||||
-- Some calculations
|
||||
local temp = self:Add("DLabel")
|
||||
temp:SetText(self.text)
|
||||
temp:SetFont("SmallerTitleFontNoBoldNoClampLessWeight")
|
||||
temp:Dock(TOP)
|
||||
temp:SetContentAlignment(5)
|
||||
temp:SizeToContents()
|
||||
temp:SetVisible(false)
|
||||
|
||||
surface.SetFont("SmallerTitleFontNoBoldNoClampLessWeight")
|
||||
local tempW, _ = surface.GetTextSize(self.text)
|
||||
|
||||
local textWidth = tempW
|
||||
local letterCount = string.len(text)
|
||||
local letterChunks = math.floor(letterCount / (textWidth / self.width) - SScaleMin(10 / 3))
|
||||
local iters = math.ceil(letterCount / letterChunks)
|
||||
local _, replaces = text:gsub("\\n", "\n")
|
||||
-- Add new line breaks
|
||||
iters = iters + replaces
|
||||
|
||||
-- Split string into lines
|
||||
self.height = 0
|
||||
local last = 1
|
||||
local lines = 1
|
||||
|
||||
for i = 1, iters do
|
||||
local part = text:sub(last, last + letterChunks - 1)
|
||||
local lastSpace = 0
|
||||
local len = string.len(part)
|
||||
local startStr = string.find(part, "\\n")
|
||||
|
||||
if startStr then
|
||||
lastSpace = startStr - 1
|
||||
last = last + 2
|
||||
end
|
||||
|
||||
if lastSpace == 0 then
|
||||
-- Finding last space
|
||||
for i2 = 1, len do
|
||||
if part:find(" ", -i2) then
|
||||
lastSpace = ((len - i2) + 1)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if lastSpace > 0 and i ~= iters then
|
||||
last = last + lastSpace
|
||||
part = part:sub(1, lastSpace)
|
||||
else
|
||||
last = last + letterChunks
|
||||
end
|
||||
|
||||
local line = self:Add("DLabel")
|
||||
line:SetText(part)
|
||||
line:SetFont("SmallerTitleFontNoBoldNoClampLessWeight")
|
||||
line:Dock(TOP)
|
||||
line:SetContentAlignment(5)
|
||||
line:SizeToContents()
|
||||
line:SetTextColor(self.color or color_white)
|
||||
lines = lines + 1
|
||||
|
||||
self.height = self.height + line:GetTall()
|
||||
end
|
||||
|
||||
self:SetSize(self.width, self.height)
|
||||
return self.width, self.height, lines - 1
|
||||
end
|
||||
|
||||
vgui.Register("ixCenterWrappedText", PANEL, "Panel")
|
||||
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
if (IsValid(ix.gui.intro)) then
|
||||
ix.gui.intro:Remove()
|
||||
end
|
||||
|
||||
ix.gui.intro = self
|
||||
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetPos(0, 0)
|
||||
self:SetZPos(99999)
|
||||
self:MakePopup()
|
||||
|
||||
self.volume = 1
|
||||
|
||||
self.backgroundPanel = self:Add("Panel")
|
||||
self.backgroundPanel:SetSize(self:GetSize())
|
||||
self.backgroundPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 255)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.firstText = self.backgroundPanel:Add("DLabel")
|
||||
self.firstText:SetText("Echo One - Willard Networks HL2RP")
|
||||
self.firstText:SetFont("WNSmallerMenuTitleNoBold")
|
||||
self.firstText:SizeToContents()
|
||||
self.firstText:SetAlpha(0)
|
||||
self.firstText:Center()
|
||||
|
||||
local sText = ix.config.Get("IntroTextLong", "")
|
||||
|
||||
self.secondText = self.backgroundPanel:Add("ixCenterWrappedText")
|
||||
self.secondText.width = ScrW() / 2
|
||||
self.secondText:SetText(sText)
|
||||
self.secondText:Center()
|
||||
self.secondText:SetY(self.secondText:GetY() - SScaleMin(25 / 3))
|
||||
self.secondText:SetAlpha(0)
|
||||
|
||||
if sText == "" then
|
||||
timer.Simple(10, function()
|
||||
if IsValid(self.secondText) then
|
||||
self.secondText:SetText(ix.config.Get("IntroTextLong", ""))
|
||||
self.secondText:Center()
|
||||
self.secondText:SetY(self.secondText:GetY() - SScaleMin(25 / 3))
|
||||
|
||||
self.continueText:Center()
|
||||
self.continueText:SetY(self.continueText:GetY() + self.secondText:GetTall() / 2 + SScaleMin(25 / 3))
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
self.continueText = self.backgroundPanel:Add("DLabel")
|
||||
self.continueText:SetText("Appuyez sur ESPACE pour continuer")
|
||||
self.continueText:SetFont("CharCreationBoldTitle")
|
||||
self.continueText:SizeToContents()
|
||||
self.continueText:SetAlpha(0)
|
||||
self.continueText:Center()
|
||||
self.continueText:SetY(self.continueText:GetY() + self.secondText:GetTall() / 2 + SScaleMin(25 / 3))
|
||||
|
||||
self:SetTimers()
|
||||
end
|
||||
|
||||
function PANEL:SetTimers()
|
||||
timer.Simple(8, function() -- 8
|
||||
self.firstText:AlphaTo( 255, 3, 0 )
|
||||
end)
|
||||
|
||||
timer.Simple(11, function() -- 11
|
||||
self.firstText:AlphaTo( 0, 3, 0 )
|
||||
end)
|
||||
|
||||
timer.Simple(14, function() -- 14
|
||||
self.secondText:AlphaTo( 255, 3, 0 )
|
||||
end)
|
||||
|
||||
timer.Simple(17, function() -- 17
|
||||
self.continueText:AlphaTo( 255, 1, 0 )
|
||||
end)
|
||||
end
|
||||
|
||||
-- @todo h a c k
|
||||
function PANEL:Think()
|
||||
if (IsValid(LocalPlayer())) then
|
||||
self:BeginIntro()
|
||||
self.Think = nil
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:BeginIntro()
|
||||
-- something could have errored on startup and invalidated all options, so we'll be extra careful with setting the option
|
||||
-- because if it errors here, the sound will play each tick and proceed to hurt ears
|
||||
local bLoaded = false
|
||||
|
||||
if (ix and ix.option and ix.option.Set) then
|
||||
local bSuccess, _ = pcall(ix.option.Set, "showIntro", true)
|
||||
bLoaded = bSuccess
|
||||
end
|
||||
|
||||
if (!bLoaded) then
|
||||
self:Remove()
|
||||
|
||||
if (ix and ix.gui and IsValid(ix.gui.characterMenu)) then
|
||||
ix.gui.characterMenu:Remove()
|
||||
end
|
||||
|
||||
ErrorNoHalt(
|
||||
"[Helix] Something has errored and prevented the framework from loading correctly - check your console for errors!\n")
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
self:MoveToFront()
|
||||
self:RequestFocus()
|
||||
|
||||
sound.PlayFile("sound/buttons/combine_button2.wav", "", function()
|
||||
timer.Create("ixIntroStart", 2, 1, function()
|
||||
sound.PlayFile("sound/willardnetworks/intro.mp3", "", function(channel, status, error)
|
||||
if (IsValid(channel)) then
|
||||
channel:SetVolume(self.volume)
|
||||
self.channel = channel
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function PANEL:OnKeyCodePressed(key)
|
||||
if (key == KEY_SPACE and self.continueText:GetAlpha() == 255) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnRemove()
|
||||
timer.Remove("ixIntroStart")
|
||||
|
||||
if (IsValid(self.channel)) then
|
||||
self.channel:Stop()
|
||||
end
|
||||
|
||||
if (IsValid(ix.gui.characterMenu)) then
|
||||
ix.gui.characterMenu:PlayMusic()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Remove(bForce)
|
||||
if (bForce) then
|
||||
BaseClass.Remove(self)
|
||||
return
|
||||
end
|
||||
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
self.bClosing = true
|
||||
self.bBackground = nil
|
||||
|
||||
self.backgroundPanel:AlphaTo( 0, 2, 0 )
|
||||
self.continueText:AlphaTo( 0, 2, 0 )
|
||||
|
||||
-- audio
|
||||
self:CreateAnimation(2, {
|
||||
index = 1,
|
||||
target = {volume = 0},
|
||||
|
||||
Think = function(anim, panel)
|
||||
if (IsValid(panel.channel)) then
|
||||
panel.channel:SetVolume(panel.volume)
|
||||
end
|
||||
end,
|
||||
|
||||
OnComplete = function()
|
||||
timer.Simple(0, function()
|
||||
BaseClass.Remove(self)
|
||||
end)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vgui.Register("ixIntro", PANEL, "EditablePanel")
|
||||
1399
gamemodes/helix/plugins/willardinterface/derma/cl_inventory.lua
Normal file
1399
gamemodes/helix/plugins/willardinterface/derma/cl_inventory.lua
Normal file
File diff suppressed because it is too large
Load Diff
318
gamemodes/helix/plugins/willardinterface/derma/cl_ix_credits.lua
Normal file
318
gamemodes/helix/plugins/willardinterface/derma/cl_ix_credits.lua
Normal file
@@ -0,0 +1,318 @@
|
||||
--[[
|
||||
| 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 CREDITS = {
|
||||
{"Alex Grist", "76561197979205163", {"creditLeadDeveloper", "creditManager"}},
|
||||
{"Igor Radovanovic", "76561197990111113", {"creditLeadDeveloper", "creditUIDesigner"}},
|
||||
{"Jaydawg", "76561197970371430", {"creditTester"}}
|
||||
}
|
||||
|
||||
local SPECIALS = {
|
||||
{
|
||||
{"Luna", "76561197988658543"},
|
||||
{"Rain GBizzle", "76561198036111376"}
|
||||
},
|
||||
{
|
||||
{"Black Tea", "76561197999893894"}
|
||||
}
|
||||
}
|
||||
|
||||
local MISC = {
|
||||
{"nebulous", "Les membres du staff trouvent des bugs et apportent leur contribution"},
|
||||
{"Contributors", "Soutien continu de la part de divers développeurs via GitHub"},
|
||||
{"NutScript", "Fournir un cadre de base sur lequel s'appuyer"}
|
||||
}
|
||||
|
||||
local url = "https://gethelix.co/"
|
||||
local padding = 32
|
||||
|
||||
-- logo
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetTall(ScrH() * 0.60)
|
||||
self:Dock(TOP)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
derma.SkinFunc("DrawHelixCurved", width * 0.5, height * 0.5, width * 0.15)
|
||||
|
||||
-- title
|
||||
surface.SetFont("ixIntroSubtitleFont")
|
||||
local text = L("helix"):lower()
|
||||
local textWidth, textHeight = surface.GetTextSize(text)
|
||||
|
||||
surface.SetTextColor(color_white)
|
||||
surface.SetTextPos(width * 0.5 - textWidth * 0.5, height * 0.5 - textHeight * 0.5)
|
||||
surface.DrawText(text)
|
||||
|
||||
-- version
|
||||
surface.SetFont("ixMenuMiniFont")
|
||||
surface.SetTextColor(200, 200, 200, 255)
|
||||
surface.SetTextPos(width * 0.5 + textWidth * 0.5, height * 0.5 - textHeight * 0.5)
|
||||
surface.DrawText(GAMEMODE.Version)
|
||||
end
|
||||
|
||||
vgui.Register("ixCreditsLogo", PANEL, "Panel")
|
||||
|
||||
-- nametag
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.name = self:Add("DLabel")
|
||||
self.name:SetFont("ixMenuButtonFontThick")
|
||||
|
||||
self.avatar = self:Add("AvatarImage")
|
||||
end
|
||||
|
||||
function PANEL:SetName(name)
|
||||
self.name:SetText(name)
|
||||
end
|
||||
|
||||
function PANEL:SetAvatar(steamid)
|
||||
self.avatar:SetSteamID(steamid, 64)
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
self.name:SetPos(width - self.name:GetWide(), 0)
|
||||
self.avatar:MoveLeftOf(self.name, padding * 0.5)
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
self.name:SizeToContents()
|
||||
|
||||
local tall = self.name:GetTall()
|
||||
self.avatar:SetSize(tall, tall)
|
||||
self:SetSize(self.name:GetWide() + self.avatar:GetWide() + padding * 0.5, self.name:GetTall())
|
||||
end
|
||||
|
||||
vgui.Register("ixCreditsNametag", PANEL, "Panel")
|
||||
|
||||
-- name row
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:DockMargin(0, padding, 0, 0)
|
||||
self:Dock(TOP)
|
||||
|
||||
self.nametag = self:Add("ixCreditsNametag")
|
||||
|
||||
self.tags = self:Add("DLabel")
|
||||
self.tags:SetFont("ixMenuButtonFont")
|
||||
|
||||
self:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:SetName(name)
|
||||
self.nametag:SetName(name)
|
||||
end
|
||||
|
||||
function PANEL:SetAvatar(steamid)
|
||||
self.nametag:SetAvatar(steamid)
|
||||
end
|
||||
|
||||
function PANEL:SetTags(tags)
|
||||
for i = 1, #tags do
|
||||
tags[i] = L(tags[i])
|
||||
end
|
||||
|
||||
self.tags:SetText(table.concat(tags, "\n"))
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(ix.config.Get("color"))
|
||||
surface.DrawRect(width * 0.5 - 1, 0, 1, height)
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
self.nametag:SetPos(width * 0.5 - self.nametag:GetWide() - padding, 0)
|
||||
self.tags:SetPos(width * 0.5 + padding, 0)
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
self.nametag:SizeToContents()
|
||||
self.tags:SizeToContents()
|
||||
|
||||
self:SetTall(math.max(self.nametag:GetTall(), self.tags:GetTall()))
|
||||
end
|
||||
|
||||
vgui.Register("ixCreditsRow", PANEL, "Panel")
|
||||
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.left = {}
|
||||
self.right = {}
|
||||
end
|
||||
|
||||
function PANEL:AddLeft(name, steamid)
|
||||
local nametag = self:Add("ixCreditsNametag")
|
||||
nametag:SetName(name)
|
||||
nametag:SetAvatar(steamid)
|
||||
nametag:SizeToContents()
|
||||
|
||||
self.left[#self.left + 1] = nametag
|
||||
end
|
||||
|
||||
function PANEL:AddRight(name, steamid)
|
||||
local nametag = self:Add("ixCreditsNametag")
|
||||
nametag:SetName(name)
|
||||
nametag:SetAvatar(steamid)
|
||||
nametag:SizeToContents()
|
||||
|
||||
self.right[#self.right + 1] = nametag
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
local y = 0
|
||||
|
||||
for _, v in ipairs(self.left) do
|
||||
v:SetPos(width * 0.25 - v:GetWide() * 0.5, y)
|
||||
y = y + v:GetTall() + padding
|
||||
end
|
||||
|
||||
y = 0
|
||||
|
||||
for _, v in ipairs(self.right) do
|
||||
v:SetPos(width * 0.75 - v:GetWide() * 0.5, y)
|
||||
y = y + v:GetTall() + padding
|
||||
end
|
||||
|
||||
if (IsValid(self.center)) then
|
||||
self.center:SetPos(width * 0.5 - self.center:GetWide() * 0.5, y)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local heightLeft, heightRight, centerHeight = 0, 0, 0
|
||||
|
||||
if (#self.left > #self.right) then
|
||||
local center = self.left[#self.left]
|
||||
centerHeight = center:GetTall()
|
||||
|
||||
self.center = center
|
||||
self.left[#self.left] = nil
|
||||
elseif (#self.right > #self.left) then
|
||||
local center = self.right[#self.right]
|
||||
centerHeight = center:GetTall()
|
||||
|
||||
self.center = center
|
||||
self.right[#self.right] = nil
|
||||
end
|
||||
|
||||
for _, v in ipairs(self.left) do
|
||||
heightLeft = heightLeft + v:GetTall() + padding
|
||||
end
|
||||
|
||||
for _, v in ipairs(self.right) do
|
||||
heightRight = heightRight + v:GetTall() + padding
|
||||
end
|
||||
|
||||
self:SetTall(math.max(heightLeft, heightRight) + centerHeight)
|
||||
end
|
||||
|
||||
vgui.Register("ixCreditsSpecials", PANEL, "Panel")
|
||||
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:Add("ixCreditsLogo")
|
||||
|
||||
local link = self:Add("DLabel", self)
|
||||
link:SetFont("ixMenuMiniFont")
|
||||
link:SetTextColor(Color(200, 200, 200, 255))
|
||||
link:SetText(url)
|
||||
link:SetContentAlignment(5)
|
||||
link:Dock(TOP)
|
||||
link:SizeToContents()
|
||||
link:SetMouseInputEnabled(true)
|
||||
link:SetCursor("hand")
|
||||
link.OnMousePressed = function()
|
||||
gui.OpenURL(url)
|
||||
end
|
||||
|
||||
for _, v in ipairs(CREDITS) do
|
||||
local row = self:Add("ixCreditsRow")
|
||||
row:SetName(v[1])
|
||||
row:SetAvatar(v[2])
|
||||
row:SetTags(v[3])
|
||||
row:SizeToContents()
|
||||
end
|
||||
|
||||
local specials = self:Add("ixLabel")
|
||||
specials:SetFont("ixMenuButtonFont")
|
||||
specials:SetText(L("creditSpecial"):utf8upper())
|
||||
specials:SetTextColor(ix.config.Get("color"))
|
||||
specials:SetDropShadow(1)
|
||||
specials:SetKerning(16)
|
||||
specials:SetContentAlignment(5)
|
||||
specials:DockMargin(0, padding * 2, 0, padding)
|
||||
specials:Dock(TOP)
|
||||
specials:SizeToContents()
|
||||
|
||||
local specialList = self:Add("ixCreditsSpecials")
|
||||
specialList:DockMargin(0, padding, 0, 0)
|
||||
specialList:Dock(TOP)
|
||||
|
||||
for _, v in ipairs(SPECIALS[1]) do
|
||||
specialList:AddLeft(v[1], v[2])
|
||||
end
|
||||
|
||||
for _, v in ipairs(SPECIALS[2]) do
|
||||
specialList:AddRight(v[1], v[2])
|
||||
end
|
||||
|
||||
specialList:SizeToContents()
|
||||
|
||||
-- less more padding if there's a center column nametag
|
||||
if (IsValid(specialList.center)) then
|
||||
specialList:DockMargin(0, padding, 0, padding)
|
||||
end
|
||||
|
||||
for _, v in ipairs(MISC) do
|
||||
local title = self:Add("DLabel")
|
||||
title:SetFont("ixMenuButtonFontThick")
|
||||
title:SetText(v[1])
|
||||
title:SetContentAlignment(5)
|
||||
title:SizeToContents()
|
||||
title:DockMargin(0, padding, 0, 0)
|
||||
title:Dock(TOP)
|
||||
|
||||
local description = self:Add("DLabel")
|
||||
description:SetFont("ixSmallTitleFont")
|
||||
description:SetText(v[2])
|
||||
description:SetContentAlignment(5)
|
||||
description:SizeToContents()
|
||||
description:Dock(TOP)
|
||||
end
|
||||
|
||||
self:Dock(TOP)
|
||||
self:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local height = padding
|
||||
|
||||
for _, v in pairs(self:GetChildren()) do
|
||||
local _, top, _, bottom = v:GetDockMargin()
|
||||
height = height + v:GetTall() + top + bottom
|
||||
end
|
||||
|
||||
self:SetTall(height)
|
||||
end
|
||||
|
||||
vgui.Register("ixCredits", PANEL, "Panel")
|
||||
|
||||
hook.Add("PopulateHelpMenu", "ixCredits", function(tabs)
|
||||
tabs["Crédits IX"] = function(container)
|
||||
container:Add("ixCredits")
|
||||
end
|
||||
end)
|
||||
405
gamemodes/helix/plugins/willardinterface/derma/cl_menu.lua
Normal file
405
gamemodes/helix/plugins/willardinterface/derma/cl_menu.lua
Normal file
@@ -0,0 +1,405 @@
|
||||
--[[
|
||||
| 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 animationTime = 1
|
||||
|
||||
DEFINE_BASECLASS("ixSubpanelParent")
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "bCharacterOverview", "CharacterOverview", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
if (IsValid(ix.gui.menu)) then
|
||||
ix.gui.menu:Remove()
|
||||
end
|
||||
|
||||
ix.gui.menu = self
|
||||
|
||||
-- properties
|
||||
self.manualChildren = {}
|
||||
self.noAnchor = CurTime() + 0.4
|
||||
self.anchorMode = true
|
||||
|
||||
self.currentAlpha = 0
|
||||
self.currentBlur = 0
|
||||
|
||||
-- setup
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetPos(0, 0)
|
||||
|
||||
-- Main panel
|
||||
self.topbar = self:Add("Panel")
|
||||
self.topbar:SetSize(ScrW(), ScreenScale(50 / 3))
|
||||
self.topbar.Paint = function( panel, width, height )
|
||||
-- background dim
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, self.topbar:GetWide(), self.topbar:GetTall())
|
||||
end
|
||||
|
||||
local arrow = self.topbar:Add("DImageButton")
|
||||
arrow:SetImage("willardnetworks/tabmenu/navicons/left_arrow.png")
|
||||
arrow:SetSize(ScreenScale(20 / 3), ScreenScale(20 / 3))
|
||||
arrow:Dock(LEFT)
|
||||
arrow:DockMargin(ScreenScale(50 / 3), ScreenScale(15 / 3), math.Clamp(ScreenScale(100 / 3), 0, 100), ScreenScale(15 / 3))
|
||||
arrow.DoClick = function()
|
||||
self:Remove()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
vgui.Create("ixCharMenu")
|
||||
end
|
||||
|
||||
local exit = self.topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(ScreenScale(20 / 3), ScreenScale(20 / 3))
|
||||
exit:Dock(RIGHT)
|
||||
exit:DockMargin(ScreenScale(100 / 3), ScreenScale(15 / 3), ScreenScale(50 / 3), ScreenScale(15 / 3))
|
||||
exit.DoClick = function()
|
||||
self:Remove()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
local l, _, r, _ = arrow:GetDockMargin()
|
||||
local l2, _, r2, _ = exit:GetDockMargin()
|
||||
local arrowWide = arrow:GetWide()
|
||||
local exitWide = exit:GetWide()
|
||||
|
||||
-- tabs
|
||||
self.tabs = self.topbar:Add("Panel")
|
||||
self.tabs.buttons = {}
|
||||
self.tabs:Dock(LEFT)
|
||||
self.tabs:SetSize(self.topbar:GetWide() - l - r - l2 - r2 - arrowWide - exitWide, ScreenScale(50 / 3))
|
||||
self:PopulateTabs()
|
||||
|
||||
self:MakePopup()
|
||||
self:OnOpened()
|
||||
end
|
||||
|
||||
function PANEL:OnOpened()
|
||||
self:SetAlpha(0)
|
||||
|
||||
self:CreateAnimation(animationTime, {
|
||||
target = {currentAlpha = 255},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.currentAlpha)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:GetActiveTab()
|
||||
return (self:GetActiveSubpanel() or {}).subpanelName
|
||||
end
|
||||
|
||||
function PANEL:TransitionSubpanel(id)
|
||||
local lastSubpanel = self:GetActiveSubpanel()
|
||||
|
||||
-- don't transition to the same panel
|
||||
if (IsValid(lastSubpanel) and lastSubpanel.subpanelID == id) then
|
||||
return
|
||||
end
|
||||
|
||||
local subpanel = self:GetSubpanel(id)
|
||||
|
||||
if (IsValid(subpanel)) then
|
||||
if (!subpanel.bPopulated) then
|
||||
local info = subpanel.info
|
||||
subpanel.Paint = nil
|
||||
|
||||
if (istable(info) and info.Create) then
|
||||
info:Create(subpanel)
|
||||
elseif (isfunction(info)) then
|
||||
info(subpanel)
|
||||
end
|
||||
|
||||
hook.Run("MenuSubpanelCreated", subpanel.subpanelName, subpanel)
|
||||
subpanel.bPopulated = true
|
||||
end
|
||||
|
||||
self:SetActiveSubpanel(id)
|
||||
end
|
||||
|
||||
subpanel = self:GetActiveSubpanel()
|
||||
|
||||
local info = subpanel.info
|
||||
local bHideBackground = istable(info) and (info.bHideBackground != nil and info.bHideBackground or false) or false
|
||||
|
||||
if (bHideBackground) then
|
||||
self:HideBackground()
|
||||
else
|
||||
self:ShowBackground()
|
||||
end
|
||||
|
||||
-- call hooks if we've changed subpanel
|
||||
if (IsValid(lastSubpanel) and istable(lastSubpanel.info) and lastSubpanel.info.OnDeselected) then
|
||||
lastSubpanel.info:OnDeselected(lastSubpanel)
|
||||
end
|
||||
|
||||
if (IsValid(subpanel) and istable(subpanel.info) and subpanel.info.OnSelected) then
|
||||
subpanel.info:OnSelected(subpanel)
|
||||
end
|
||||
|
||||
ix.gui.lastMenuTab = id
|
||||
end
|
||||
|
||||
function PANEL:HideBackground()
|
||||
self:CreateAnimation(animationTime, {
|
||||
index = 2,
|
||||
target = {currentBlur = 0},
|
||||
easing = "outQuint"
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:ShowBackground()
|
||||
self:CreateAnimation(animationTime, {
|
||||
index = 2,
|
||||
target = {currentBlur = 1},
|
||||
easing = "outQuint"
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:PopulateTabs()
|
||||
local default
|
||||
local tabs = {}
|
||||
|
||||
hook.Run("CreateMenuButtons", tabs)
|
||||
|
||||
for name, info in SortedPairsByMemberValue(tabs, "RowNumber", false) do
|
||||
local bTable = istable(info)
|
||||
local buttonColor = (bTable and info.buttonColor) or Color(163, 57, 59, 255)
|
||||
local bDefault = (bTable and info.bDefault) or false
|
||||
|
||||
-- setup subpanels without populating them so we can retain the order
|
||||
local subpanel = self:AddSubpanel(name, true)
|
||||
local id = subpanel.subpanelID
|
||||
subpanel.info = info
|
||||
subpanel:SetPaintedManually(true)
|
||||
subpanel:SetTitle(nil)
|
||||
subpanel:SetSize(ScrW(), ScrH())
|
||||
|
||||
-- this is called while the subpanel has not been populated
|
||||
subpanel.Paint = function(panel, width, height)
|
||||
end
|
||||
|
||||
local button = self.tabs:Add("ixMenuSelectionButton")
|
||||
button:SetText("")
|
||||
|
||||
if (info.Right) then
|
||||
button:Dock(RIGHT)
|
||||
else
|
||||
button:Dock(LEFT)
|
||||
end
|
||||
|
||||
button:SetButtonList(self.tabs.buttons)
|
||||
button:SetBackgroundColor(buttonColor)
|
||||
button.id = id
|
||||
button.OnSelected = function()
|
||||
self:TransitionSubpanel(id)
|
||||
end
|
||||
|
||||
local icon = button:Add("DImage")
|
||||
icon:SetImage(tostring(info.Icon))
|
||||
icon:SetSize(ScreenScale(info.Width / 3), ScreenScale(info.Height / 3))
|
||||
|
||||
local iconWidth = ScreenScale(info.Width / 3) or 0
|
||||
local iconHeight = ScreenScale(info.Height / 3) or 0
|
||||
|
||||
local title = button:Add("DLabel")
|
||||
title:SetFont("MenuFontNoClamp")
|
||||
title:SetText(L(name))
|
||||
title:SizeToContents()
|
||||
title:SetPos(button:GetWide() * 0.5 - title:GetWide() * 0.5 + iconWidth * 0.5 + ScreenScale(4 / 3), button:GetTall() * 0.5 - title:GetTall() * 0.5)
|
||||
|
||||
icon:MoveLeftOf(title)
|
||||
local x, y = icon:GetPos()
|
||||
|
||||
icon:SetPos(x - ScreenScale(8 / 3), button:GetTall() * 0.5 - iconHeight * 0.5)
|
||||
|
||||
if (bTable and info.PopulateTabButton) then
|
||||
info:PopulateTabButton(button)
|
||||
end
|
||||
|
||||
if (bDefault) then
|
||||
default = button
|
||||
end
|
||||
end
|
||||
|
||||
if (ix.gui.lastMenuTab) then
|
||||
for i = 1, #self.tabs.buttons do
|
||||
local button = self.tabs.buttons[i]
|
||||
|
||||
if (button.id == ix.gui.lastMenuTab) then
|
||||
default = button
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (!IsValid(default) and #self.tabs.buttons > 0) then
|
||||
default = self.tabs.buttons[1]
|
||||
end
|
||||
|
||||
if (IsValid(default)) then
|
||||
default:SetSelected(true)
|
||||
self:SetActiveSubpanel(default.id, 0)
|
||||
end
|
||||
|
||||
|
||||
self.topbar:MoveToFront()
|
||||
end
|
||||
|
||||
function PANEL:AddManuallyPaintedChild(panel)
|
||||
panel:SetParent(self)
|
||||
panel:SetPaintedManually(panel)
|
||||
|
||||
self.manualChildren[#self.manualChildren + 1] = panel
|
||||
end
|
||||
|
||||
function PANEL:OnKeyCodePressed(key)
|
||||
self.noAnchor = CurTime() + 0.5
|
||||
|
||||
if (key == KEY_TAB) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
local bTabDown = input.IsKeyDown(KEY_TAB)
|
||||
|
||||
if (bTabDown and (self.noAnchor or CurTime() + 0.4) < CurTime() and self.anchorMode) then
|
||||
self.anchorMode = false
|
||||
end
|
||||
|
||||
if ((!self.anchorMode and !bTabDown) or gui.IsGameUIVisible()) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
Derma_DrawBackgroundBlur( self, self.startTime )
|
||||
|
||||
BaseClass.Paint(self, width, height)
|
||||
self:PaintSubpanels(width, height)
|
||||
|
||||
for i = 1, #self.manualChildren do
|
||||
self.manualChildren[i]:PaintManual()
|
||||
end
|
||||
|
||||
if (IsValid(ix.gui.inv1) and ix.gui.inv1.childPanels) then
|
||||
for i = 1, #ix.gui.inv1.childPanels do
|
||||
local panel = ix.gui.inv1.childPanels[i]
|
||||
|
||||
if (IsValid(panel)) then
|
||||
panel:PaintManual()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (bShouldScale) then
|
||||
cam.PopModelMatrix()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
local id = ix.gui.lastMenuTab
|
||||
if self:GetSubpanel(id) then
|
||||
if self:GetSubpanel(id).info.model then
|
||||
self:GetSubpanel(id).info.model:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(ix.gui.characterpanel) then
|
||||
if ix.gui.characterpanel.model then
|
||||
ix.gui.characterpanel.model:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(ix.gui.inventoryModel) then
|
||||
ix.gui.inventoryModel:Remove()
|
||||
end
|
||||
|
||||
if IsValid(ix.gui.craftingpanel) then
|
||||
if ix.gui.craftingpanel.model then
|
||||
ix.gui.craftingpanel.model:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(ix.gui.barteringpanel) then
|
||||
if ix.gui.barteringpanel.model then
|
||||
ix.gui.barteringpanel.model:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(ix.gui.medicalpanel) then
|
||||
if ix.gui.medicalpanel.model then
|
||||
ix.gui.medicalpanel.model:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
self.bClosing = true
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
|
||||
-- remove input from opened child panels since they grab focus
|
||||
if (IsValid(ix.gui.inv1) and ix.gui.inv1.childPanels) then
|
||||
for i = 1, #ix.gui.inv1.childPanels do
|
||||
local panel = ix.gui.inv1.childPanels[i]
|
||||
|
||||
if (IsValid(panel)) then
|
||||
panel:SetMouseInputEnabled(false)
|
||||
panel:SetKeyboardInputEnabled(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
CloseDermaMenus()
|
||||
gui.EnableScreenClicker(false)
|
||||
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
index = 2,
|
||||
target = {currentBlur = 0},
|
||||
easing = "outQuint"
|
||||
})
|
||||
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
target = {currentAlpha = 0},
|
||||
easing = "outQuint",
|
||||
|
||||
-- we don't animate the blur because blurring doesn't draw things
|
||||
-- with amount < 1 very well, resulting in jarring transition
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.currentAlpha)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
if (IsValid(panel.projectedTexture)) then
|
||||
panel.projectedTexture:Remove()
|
||||
end
|
||||
|
||||
BaseClass.Remove(panel)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vgui.Register("ixMenu", PANEL, "ixSubpanelParent")
|
||||
|
||||
if (IsValid(ix.gui.menu)) then
|
||||
ix.gui.menu:Remove()
|
||||
end
|
||||
|
||||
ix.gui.lastMenuTab = nil
|
||||
183
gamemodes/helix/plugins/willardinterface/derma/cl_menubutton.lua
Normal file
183
gamemodes/helix/plugins/willardinterface/derma/cl_menubutton.lua
Normal file
@@ -0,0 +1,183 @@
|
||||
--[[
|
||||
| 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 buttonPadding = ScreenScale(14) * 0.5
|
||||
|
||||
-- base menu button
|
||||
DEFINE_BASECLASS("DButton")
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "backgroundColor", "BackgroundColor")
|
||||
AccessorFunc(PANEL, "backgroundAlpha", "BackgroundAlpha")
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetFont("MenuFontNoClamp")
|
||||
self:SetTextColor(color_white)
|
||||
self:SetPaintBackground(false)
|
||||
self:SetContentAlignment(5)
|
||||
self:SetTextInset(buttonPadding, 0)
|
||||
|
||||
self.backgroundColor = Color(0, 0, 0)
|
||||
self.backgroundAlpha = 128
|
||||
self.currentBackgroundAlpha = 0
|
||||
end
|
||||
|
||||
function PANEL:SetText(text, noTranslation)
|
||||
surface.SetFont("MenuFontNoClamp")
|
||||
BaseClass.SetText(self, noTranslation and text or L(text))
|
||||
|
||||
self:SetSize(ScreenScale(125 / 3), ScreenScale(50 / 3))
|
||||
end
|
||||
|
||||
function PANEL:PaintBackground(width, height)
|
||||
surface.SetDrawColor(ColorAlpha(self.backgroundColor, self.currentBackgroundAlpha))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
self:PaintBackground(width, height)
|
||||
BaseClass.Paint(self, width, height)
|
||||
end
|
||||
|
||||
function PANEL:SetTextColorInternal(color)
|
||||
BaseClass.SetTextColor(self, color)
|
||||
self:SetFGColor(color)
|
||||
end
|
||||
|
||||
function PANEL:SetTextColor(color)
|
||||
self:SetTextColorInternal(color)
|
||||
self.color = color
|
||||
end
|
||||
|
||||
function PANEL:SetDisabled(bValue)
|
||||
local color = self.color
|
||||
|
||||
if (bValue) then
|
||||
self:SetTextColorInternal(Color(math.max(color.r - 60, 0), math.max(color.g - 60, 0), math.max(color.b - 60, 0)))
|
||||
else
|
||||
self:SetTextColorInternal(color)
|
||||
end
|
||||
|
||||
BaseClass.SetDisabled(self, bValue)
|
||||
end
|
||||
|
||||
function PANEL:OnCursorEntered()
|
||||
if (self:GetDisabled()) then
|
||||
return
|
||||
end
|
||||
|
||||
local color = self:GetTextColor()
|
||||
|
||||
self:CreateAnimation(0.15, {
|
||||
target = {currentBackgroundAlpha = self.backgroundAlpha}
|
||||
})
|
||||
|
||||
LocalPlayer():EmitSound("Helix.Rollover")
|
||||
end
|
||||
|
||||
function PANEL:OnCursorExited()
|
||||
if (self:GetDisabled()) then
|
||||
return
|
||||
end
|
||||
|
||||
self:CreateAnimation(0.15, {
|
||||
target = {currentBackgroundAlpha = 0}
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed(code)
|
||||
if (self:GetDisabled()) then
|
||||
return
|
||||
end
|
||||
|
||||
if (self.color) then
|
||||
self:SetTextColor(self.color)
|
||||
else
|
||||
self:SetTextColor(ix.config.Get("color"))
|
||||
end
|
||||
|
||||
LocalPlayer():EmitSound("Helix.Press")
|
||||
|
||||
if (code == MOUSE_LEFT and self.DoClick) then
|
||||
self:DoClick(self)
|
||||
elseif (code == MOUSE_RIGHT and self.DoRightClick) then
|
||||
self:DoRightClick(self)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnMouseReleased(key)
|
||||
if (self:GetDisabled()) then
|
||||
return
|
||||
end
|
||||
|
||||
if (self.color) then
|
||||
self:SetTextColor(self.color)
|
||||
else
|
||||
self:SetTextColor(color_white)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixMenuButton", PANEL, "DButton")
|
||||
|
||||
-- selection menu button
|
||||
DEFINE_BASECLASS("ixMenuButton")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "backgroundColor", "BackgroundColor")
|
||||
AccessorFunc(PANEL, "selected", "Selected", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "buttonList", "ButtonList")
|
||||
|
||||
function PANEL:Init()
|
||||
self.backgroundColor = color_white
|
||||
self.selected = false
|
||||
self.buttonList = {}
|
||||
end
|
||||
|
||||
function PANEL:PaintBackground(width, height)
|
||||
local alpha = self.selected and 255 or self.currentBackgroundAlpha
|
||||
|
||||
color = ColorAlpha(self.backgroundColor, alpha)
|
||||
|
||||
surface.SetDrawColor(color)
|
||||
surface.DrawRect(0, 0, width, height, ColorAlpha(self.backgroundColor, alpha))
|
||||
end
|
||||
|
||||
function PANEL:SetSelected(bValue)
|
||||
self.selected = bValue
|
||||
|
||||
if (bValue) then
|
||||
self:OnSelected()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetButtonList(list, bNoAdd)
|
||||
if (!bNoAdd) then
|
||||
list[#list + 1] = self
|
||||
end
|
||||
|
||||
self.buttonList = list
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed(key)
|
||||
for _, v in pairs(self.buttonList) do
|
||||
if (IsValid(v)) then
|
||||
v:SetSelected(false)
|
||||
end
|
||||
end
|
||||
|
||||
self:SetSelected(true)
|
||||
BaseClass.OnMousePressed(self, key)
|
||||
end
|
||||
|
||||
function PANEL:OnSelected()
|
||||
end
|
||||
|
||||
vgui.Register("ixMenuSelectionButton", PANEL, "ixMenuButton")
|
||||
189
gamemodes/helix/plugins/willardinterface/derma/cl_modelpanel.lua
Normal file
189
gamemodes/helix/plugins/willardinterface/derma/cl_modelpanel.lua
Normal file
@@ -0,0 +1,189 @@
|
||||
--[[
|
||||
| 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("DModelPanel")
|
||||
|
||||
local PANEL = {}
|
||||
local MODEL_ANGLE = Angle(0, 45, 0)
|
||||
|
||||
function PANEL:Init()
|
||||
self.brightness = 1
|
||||
self:SetCursor("none")
|
||||
end
|
||||
|
||||
function PANEL:SetModel(model, skin, bodygroups)
|
||||
if (IsValid(self.Entity)) then
|
||||
self.Entity:Remove()
|
||||
self.Entity = nil
|
||||
end
|
||||
|
||||
if (!ClientsideModel) then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = ClientsideModel(model, RENDERGROUP_OPAQUE)
|
||||
|
||||
if (!IsValid(entity)) then
|
||||
return
|
||||
end
|
||||
|
||||
entity:SetNoDraw(true)
|
||||
entity:SetIK(false)
|
||||
|
||||
if (skin) then
|
||||
entity:SetSkin(skin)
|
||||
end
|
||||
|
||||
if bodygroups == true then
|
||||
for _, v in ipairs(LocalPlayer():GetBodyGroups() or {}) do
|
||||
entity:SetBodygroup(v.id, LocalPlayer():GetBodygroup(v.id))
|
||||
end
|
||||
end
|
||||
|
||||
local sequence = entity:LookupSequence("idle_unarmed")
|
||||
|
||||
if (sequence <= 0) then
|
||||
sequence = entity:SelectWeightedSequence(ACT_IDLE)
|
||||
end
|
||||
|
||||
if (sequence > 0) then
|
||||
entity:ResetSequence(sequence)
|
||||
else
|
||||
local found = false
|
||||
|
||||
for _, v in ipairs(entity:GetSequenceList()) do
|
||||
if ((v:utf8lower():find("idle") or v:utf8lower():find("fly")) and v != "idlenoise") then
|
||||
entity:ResetSequence(v)
|
||||
found = true
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (!found) then
|
||||
entity:ResetSequence(4)
|
||||
end
|
||||
end
|
||||
|
||||
entity.GetProxyColors = function()
|
||||
local char = LocalPlayer().GetCharacter and LocalPlayer():GetCharacter()
|
||||
local proxyColors = char and char.GetProxyColors and char:GetProxyColors() or {}
|
||||
|
||||
if self.overrideProxyColors and istable(self.overrideProxyColors) then
|
||||
proxyColors = self.overrideProxyColors
|
||||
end
|
||||
|
||||
return proxyColors
|
||||
end
|
||||
|
||||
entity:SetAngles(MODEL_ANGLE)
|
||||
|
||||
self.Entity = entity
|
||||
end
|
||||
|
||||
function PANEL:SetCorrectHair(oldHair)
|
||||
if !self.Entity or self.Entity and !IsValid(self.Entity) then return end
|
||||
if !self.Entity.GetNumBodyGroups then return end
|
||||
if !self.Entity.GetModel then return end
|
||||
if !self.Entity:GetModel():find("models/willardnetworks/citizens/") then return end
|
||||
|
||||
local hairBG = self.Entity:FindBodygroupByName( "hair" )
|
||||
local curHeadwearBG = self.Entity:GetBodygroup(self.Entity:FindBodygroupByName( "headwear" ))
|
||||
local curHairBG = self.Entity:GetBodygroup(hairBG)
|
||||
|
||||
local hairBgLength = 0
|
||||
for _, v in pairs(self.Entity:GetBodyGroups()) do
|
||||
if v.name != "hair" then continue end
|
||||
if !v.submodels then continue end
|
||||
if !istable(v.submodels) then continue end
|
||||
|
||||
hairBgLength = #v.submodels
|
||||
break
|
||||
end
|
||||
|
||||
if (curHeadwearBG != 0) then
|
||||
if curHairBG != 0 then
|
||||
self.Entity:SetBodygroup(hairBG, hairBgLength)
|
||||
end
|
||||
else
|
||||
if oldHair then
|
||||
self.Entity:SetBodygroup(hairBG, oldHair)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:LayoutEntity()
|
||||
local scrW, scrH = ScrW(), ScrH()
|
||||
local xRatio = gui.MouseX() / scrW
|
||||
local yRatio = gui.MouseY() / scrH
|
||||
local x, _ = self:LocalToScreen(self:GetWide() / 2)
|
||||
local xRatio2 = x / scrW
|
||||
local entity = self.Entity
|
||||
|
||||
entity:SetPoseParameter("head_pitch", yRatio*90 - 30)
|
||||
entity:SetPoseParameter("head_yaw", (xRatio - xRatio2)*90 - 5)
|
||||
entity:SetIK(false)
|
||||
|
||||
if (self.copyLocalSequence) then
|
||||
entity:SetSequence(LocalPlayer():GetSequence())
|
||||
entity:SetPoseParameter("move_yaw", 360 * LocalPlayer():GetPoseParameter("move_yaw") - 180)
|
||||
end
|
||||
|
||||
self:RunAnimation()
|
||||
|
||||
local character = LocalPlayer():GetCharacter()
|
||||
if (character) then
|
||||
local otherbone = hook.Run("CharacterAdjustModelPanelLookupBone", character)
|
||||
if otherbone and entity:LookupBone(otherbone) then
|
||||
local headpos = entity:GetBonePosition(entity:LookupBone(otherbone))
|
||||
entity:SetEyeTarget(headpos-Vector(-15, 0, 0))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
for i = 2, 7 do
|
||||
entity:SetFlexWeight( i, 0 )
|
||||
end
|
||||
|
||||
for i = 0, 1 do
|
||||
entity:SetFlexWeight( i, 1 )
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:DrawModel()
|
||||
local brightness = self.brightness * 0.4
|
||||
local brightness2 = self.brightness * 1.5
|
||||
|
||||
render.SetStencilEnable(false)
|
||||
render.SetColorMaterial()
|
||||
render.SetColorModulation(1, 1, 1)
|
||||
render.SetModelLighting(0, brightness2, brightness2, brightness2)
|
||||
|
||||
for i = 1, 4 do
|
||||
render.SetModelLighting(i, brightness, brightness, brightness)
|
||||
end
|
||||
|
||||
local fraction = (brightness / 1) * 0.1
|
||||
|
||||
render.SetModelLighting(5, fraction, fraction, fraction)
|
||||
|
||||
-- Excecute Some stuffs
|
||||
if (self.enableHook) then
|
||||
hook.Run("DrawHelixModelView", self, self.Entity)
|
||||
end
|
||||
|
||||
self.Entity:DrawModel()
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed()
|
||||
end
|
||||
|
||||
vgui.Register("ixModelPanel", PANEL, "DModelPanel")
|
||||
284
gamemodes/helix/plugins/willardinterface/derma/cl_notice.lua
Normal file
284
gamemodes/helix/plugins/willardinterface/derma/cl_notice.lua
Normal file
@@ -0,0 +1,284 @@
|
||||
--[[
|
||||
| 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 animationTime = 0.75
|
||||
|
||||
-- notice manager
|
||||
-- this manages positions/animations for notice panels
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "padding", "Padding", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW() * 0.4, ScrH())
|
||||
self:SetZPos(-99999)
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
|
||||
self.notices = {}
|
||||
self.padding = 4
|
||||
end
|
||||
|
||||
function PANEL:GetAll()
|
||||
return self.notices
|
||||
end
|
||||
|
||||
function PANEL:Clear()
|
||||
for _, v in ipairs(self.notices) do
|
||||
self:RemoveNotice(v)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:AddNotice(text, bError)
|
||||
if (IsValid(ix.gui.characterMenu) and !ix.gui.characterMenu.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
local panel = self:Add("ixNotice")
|
||||
panel:SetText(text)
|
||||
panel:SetError(bError or text:utf8sub(#text, #text) == "!")
|
||||
panel:SizeToContents()
|
||||
panel.currentY = -panel:GetTall()
|
||||
panel:SetPos(self.padding, panel.currentY)
|
||||
|
||||
-- setup duration timer
|
||||
panel:CreateAnimation(ix.option.Get("noticeDuration", 8), {
|
||||
index = 2,
|
||||
target = {duration = 1},
|
||||
bIgnoreConfig = true,
|
||||
|
||||
OnComplete = function(animation, this)
|
||||
self:RemoveNotice(this)
|
||||
end
|
||||
})
|
||||
|
||||
table.insert(self.notices, 1, panel)
|
||||
self:Organize()
|
||||
|
||||
-- remove old notice if we've hit the limit of notices
|
||||
if (#self.notices > ix.option.Get("noticeMax", 4)) then
|
||||
for i = #self.notices, 1, -1 do
|
||||
local notice = self.notices[i]
|
||||
|
||||
if (IsValid(notice) and !notice.bClosing) then
|
||||
self:RemoveNotice(notice)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:RemoveNotice(panel)
|
||||
panel.bClosing = true
|
||||
panel:CreateAnimation(animationTime, {
|
||||
index = 3,
|
||||
target = {outAnimation = 0},
|
||||
easing = "outQuint",
|
||||
|
||||
OnComplete = function(animation, this)
|
||||
local toRemove
|
||||
|
||||
for k, v in ipairs(self.notices) do
|
||||
if (v == this) then
|
||||
toRemove = k
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (toRemove) then
|
||||
table.remove(self.notices, toRemove)
|
||||
end
|
||||
|
||||
this:SetText("") -- (hack) text remains for a frame after remove is called, so let's make sure we don't draw it
|
||||
this:Remove()
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
-- update target Y positions and animations
|
||||
function PANEL:Organize()
|
||||
local currentTarget = self.padding
|
||||
|
||||
for _, v in ipairs(self.notices) do
|
||||
v:CreateAnimation(animationTime, {
|
||||
index = 1,
|
||||
target = {currentY = currentTarget},
|
||||
easing = "outElastic",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetPos(
|
||||
self:GetWide() - panel:GetWide() - self.padding,
|
||||
math.min(panel.currentY + 1, currentTarget) -- easing eventually hits subpixel movement so we level it off
|
||||
)
|
||||
end
|
||||
})
|
||||
|
||||
currentTarget = currentTarget + self.padding + v:GetTall()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if IsValid(ix.gui.menu) and ix.gui.menu:IsVisible() then
|
||||
self:SetPos(ScrW() - ScrW() * 0.4, SScaleMin(50 / 3))
|
||||
else
|
||||
self:SetPos(ScrW() - ScrW() * 0.4, 0)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixNoticeManager", PANEL, "Panel")
|
||||
|
||||
-- notice panel
|
||||
-- these do not manage their own enter/exit animations or lifetime
|
||||
DEFINE_BASECLASS("DLabel")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "bError", "Error", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "padding", "Padding", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(256, 36)
|
||||
self:SetContentAlignment(5)
|
||||
self:SetExpensiveShadow(1, Color(0, 0, 0, 150))
|
||||
self:SetFont("ixNoticeFont")
|
||||
self:SetTextColor(color_white)
|
||||
self:SetDrawOnTop(true)
|
||||
self:DockPadding(0, 0, 0, 0)
|
||||
self:DockMargin(0, 0, 0, 0)
|
||||
|
||||
self.bError = false
|
||||
self.bHovered = false
|
||||
|
||||
self.errorAnimation = 0
|
||||
self.padding = 8
|
||||
self.currentY = 0
|
||||
self.duration = 0
|
||||
self.outAnimation = 1
|
||||
self.alpha = 255
|
||||
|
||||
LocalPlayer():EmitSound("Helix.Notify")
|
||||
end
|
||||
|
||||
function PANEL:SetError(bValue)
|
||||
self.bError = tobool(bValue)
|
||||
|
||||
if (bValue) then
|
||||
self.errorAnimation = 1
|
||||
self:CreateAnimation(animationTime, {
|
||||
index = 5,
|
||||
target = {errorAnimation = 0},
|
||||
easing = "outQuint"
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local contentWidth, contentHeight = self:GetContentSize()
|
||||
contentWidth = contentWidth + self.padding * 2
|
||||
contentHeight = contentHeight + self.padding * 2
|
||||
|
||||
local manager = ix.gui.notices
|
||||
local maxWidth = math.min(IsValid(manager) and (manager:GetWide() - manager:GetPadding() * 2) or ScrW(), contentWidth)
|
||||
|
||||
if (contentWidth > maxWidth) then
|
||||
self:SetWide(maxWidth)
|
||||
self:SetTextInset(self.padding * 2, 0)
|
||||
self:SetWrap(true)
|
||||
|
||||
self:SizeToContentsY()
|
||||
self:SetWide(self:GetContentSize())
|
||||
else
|
||||
self:SetSize(contentWidth, contentHeight)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SizeToContentsY()
|
||||
BaseClass.SizeToContentsY(self)
|
||||
self:SetTall(self:GetTall() + self.padding * 2)
|
||||
end
|
||||
|
||||
function PANEL:OnMouseHover()
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
index = 4,
|
||||
target = {alpha = 0},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.alpha)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:OnMouseLeave()
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
index = 4,
|
||||
target = {alpha = 255},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.alpha)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
if (self.outAnimation < 1) then
|
||||
local x, y = self:LocalToScreen(0, 0)
|
||||
render.SetScissorRect(x, y, x + self:GetWide(), y + (self:GetTall() * self.outAnimation), true)
|
||||
end
|
||||
|
||||
local x, y = self:LocalToScreen(0, 0)
|
||||
local mouseX, mouseY = gui.MousePos()
|
||||
|
||||
if (mouseX >= x and mouseX <= x + width and
|
||||
mouseY >= y and mouseY <= y + height) then
|
||||
if (!self.bHovered) then
|
||||
self.bHovered = true
|
||||
self:OnMouseHover()
|
||||
end
|
||||
elseif (self.bHovered) then
|
||||
self.bHovered = false
|
||||
self:OnMouseLeave()
|
||||
end
|
||||
|
||||
ix.util.DrawBlur(self)
|
||||
|
||||
if (self.errorAnimation > 0) then
|
||||
local color = derma.GetColor("Error", self)
|
||||
|
||||
surface.SetDrawColor(
|
||||
color.r * self.errorAnimation,
|
||||
color.g * self.errorAnimation,
|
||||
color.b * self.errorAnimation,
|
||||
self.errorAnimation * 255 + ((1 - self.errorAnimation) * 66)
|
||||
)
|
||||
else
|
||||
surface.SetDrawColor(0, 0, 0, 66)
|
||||
end
|
||||
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
surface.SetDrawColor(self.bError and derma.GetColor("Error", self) or ix.config.Get("color"))
|
||||
surface.DrawRect(0, height - 1, width * self.duration, 1)
|
||||
end
|
||||
|
||||
function PANEL:PaintOver(width, height)
|
||||
render.SetScissorRect(0, 0, 0, 0, false)
|
||||
end
|
||||
|
||||
vgui.Register("ixNotice", PANEL, "DLabel")
|
||||
|
||||
if (IsValid(ix.gui.notices)) then
|
||||
ix.gui.notices:Remove()
|
||||
ix.gui.notices = vgui.Create("ixNoticeManager")
|
||||
else
|
||||
ix.gui.notices = vgui.Create("ixNoticeManager")
|
||||
end
|
||||
@@ -0,0 +1,108 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
-- plugin manager
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:Dock(FILL)
|
||||
self:SetSearchEnabled(true)
|
||||
|
||||
self.loadedCategory = L("loadedPlugins")
|
||||
self.unloadedCategory = L("unloadedPlugins")
|
||||
|
||||
if (!ix.gui.bReceivedUnloadedPlugins) then
|
||||
net.Start("ixConfigRequestUnloadedList")
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
self:Populate()
|
||||
end
|
||||
|
||||
function PANEL:OnPluginToggled(uniqueID, bEnabled)
|
||||
net.Start("ixConfigPluginToggle")
|
||||
net.WriteString(uniqueID)
|
||||
net.WriteBool(bEnabled)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
function PANEL:Populate()
|
||||
self:AddCategory(self.loadedCategory)
|
||||
self:AddCategory(self.unloadedCategory)
|
||||
|
||||
-- add loaded plugins
|
||||
for k, v in SortedPairsByMemberValue(ix.plugin.list, "name") do
|
||||
local row = self:AddRow(ix.type.bool, self.loadedCategory)
|
||||
row.id = k
|
||||
|
||||
row.setting:SizeToContents()
|
||||
|
||||
-- if this plugin is not in the unloaded list currently, then it's queued for an unload
|
||||
row:SetValue(!ix.plugin.unloaded[k], true)
|
||||
row:SetText(v.name)
|
||||
|
||||
row.OnValueChanged = function(panel, bEnabled)
|
||||
self:OnPluginToggled(k, bEnabled)
|
||||
end
|
||||
|
||||
row:GetLabel():SetHelixTooltip(function(tooltip)
|
||||
local title = tooltip:AddRow("name")
|
||||
title:SetImportant()
|
||||
title:SetText(v.name)
|
||||
title:SizeToContents()
|
||||
title:SetMaxWidth(math.max(title:GetMaxWidth(), ScrW() * 0.5))
|
||||
|
||||
local description = tooltip:AddRow("description")
|
||||
description:SetText(v.description)
|
||||
description:SizeToContents()
|
||||
end)
|
||||
end
|
||||
|
||||
self:UpdateUnloaded(true)
|
||||
self:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:UpdatePlugin(uniqueID, bEnabled)
|
||||
for _, v in pairs(self:GetRows()) do
|
||||
if (v.id == uniqueID) then
|
||||
v:SetValue(bEnabled, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- called from Populate and from the ixConfigUnloadedList net message
|
||||
function PANEL:UpdateUnloaded(bNoSizeToContents)
|
||||
for _, v in pairs(self:GetRows()) do
|
||||
if (ix.plugin.unloaded[v.id]) then
|
||||
v:SetValue(false, true)
|
||||
end
|
||||
end
|
||||
|
||||
for k, _ in SortedPairs(ix.plugin.unloaded) do
|
||||
if (ix.plugin.list[k]) then
|
||||
-- if this plugin is in the loaded plugins list then it's queued for an unload - don't display it in this category
|
||||
continue
|
||||
end
|
||||
|
||||
local row = self:AddRow(ix.type.bool, self.unloadedCategory)
|
||||
row:SetText(k)
|
||||
row:SetValue(false, true)
|
||||
|
||||
row.OnValueChanged = function(panel, bEnabled)
|
||||
self:OnPluginToggled(k, bEnabled)
|
||||
end
|
||||
end
|
||||
|
||||
if (!bNoSizeToContents) then
|
||||
self:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixPluginManager", PANEL, "ixSettings")
|
||||
148
gamemodes/helix/plugins/willardinterface/derma/cl_quiz.lua
Normal file
148
gamemodes/helix/plugins/willardinterface/derma/cl_quiz.lua
Normal file
@@ -0,0 +1,148 @@
|
||||
--[[
|
||||
| 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()
|
||||
ix.gui.quizAnswering = self
|
||||
self.comboboxes = {}
|
||||
|
||||
self:SetSize(SScaleMin(700 / 3), SScaleMin(700 / 3))
|
||||
self:Center()
|
||||
self:SetTitle("Quiz - Afin de créer un personnage, vous devrez répondre à quelques questions.")
|
||||
DFrameFixer(self, false, true, true)
|
||||
|
||||
self.quizContent = self:Add("DScrollPanel")
|
||||
self.quizContent:Dock(FILL)
|
||||
|
||||
self.loadingLabel = self:Add("DLabel")
|
||||
self.loadingLabel:SetText("Loading Quiz Questions...")
|
||||
self.loadingLabel:SetFont("TitlesFontNoClamp")
|
||||
self.loadingLabel:SizeToContents()
|
||||
self.loadingLabel:Center()
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
self:MoveToFront()
|
||||
end
|
||||
|
||||
function PANEL:Paint(w, h)
|
||||
if (self.m_bBackgroundBlur) then
|
||||
Derma_DrawBackgroundBlur(self, self.m_fCreateTime)
|
||||
end
|
||||
|
||||
surface.SetDrawColor(Color(40, 40, 40, 240))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(Color(111, 111, 136, 255 / 100 * 30))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
|
||||
surface.DrawRect(0, 0, w, self.lblTitle:GetTall() + SScaleMin(5 / 3))
|
||||
end
|
||||
|
||||
function PANEL:CreateQuizContent()
|
||||
if self.loadingLabel then
|
||||
self.loadingLabel:Remove()
|
||||
end
|
||||
|
||||
for k, table in pairs(PLUGIN.quizlist) do
|
||||
local question = table[1] or "NO QUESTION"
|
||||
local answers = table[2] or {}
|
||||
|
||||
local questionTitle = self.quizContent:Add("DLabel")
|
||||
questionTitle:SetFont("TitlesFontNoClamp")
|
||||
questionTitle:Dock(TOP)
|
||||
questionTitle:SetText(question or "")
|
||||
questionTitle:SetContentAlignment(5)
|
||||
questionTitle:DockMargin(SScaleMin(20 / 3), k == 1 and SScaleMin(20 / 3) or 0, SScaleMin(20 / 3), SScaleMin(10 / 3))
|
||||
questionTitle:SetWrap(true)
|
||||
questionTitle:SetAutoStretchVertical(true)
|
||||
|
||||
local answerPanel = self.quizContent:Add("DComboBox")
|
||||
answerPanel:Dock(TOP)
|
||||
answerPanel:SetTall(SScaleMin(30 / 3))
|
||||
answerPanel:SetValue("Choose Answer")
|
||||
answerPanel:SetFont("SmallerTitleFontNoBoldNoClamp")
|
||||
answerPanel.question = k
|
||||
answerPanel:SetContentAlignment(5)
|
||||
answerPanel.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
answerPanel.Think = function(self)
|
||||
if IsValid(self.Menu) then
|
||||
self.Menu:MoveToFront()
|
||||
end
|
||||
end
|
||||
|
||||
answerPanel:DockMargin(SScaleMin(20 / 3), 0, SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
|
||||
for _, answer in pairs(table[2]) do
|
||||
answerPanel:AddChoice(answer or "")
|
||||
end
|
||||
|
||||
self.comboboxes[#self.comboboxes + 1] = answerPanel
|
||||
end
|
||||
|
||||
local textPanel = self.quizContent:Add("Panel")
|
||||
textPanel:Dock(TOP)
|
||||
textPanel:SetTall(SScaleMin(20 / 3))
|
||||
|
||||
local warningIcon = textPanel:Add("DImage")
|
||||
warningIcon:SetSize(SScaleMin(12 / 3), SScaleMin(20 / 3))
|
||||
warningIcon:Dock(LEFT)
|
||||
warningIcon:DockMargin(0, 0, SScaleMin(8 / 3), 0)
|
||||
warningIcon:SetImage("willardnetworks/mainmenu/charcreation/warning.png")
|
||||
|
||||
local panelText = textPanel:Add("DLabel")
|
||||
panelText:SetText("Unsure about the answers? Check our forums for more information. ")
|
||||
panelText:SetFont("WNBackFontNoClamp")
|
||||
panelText:SetTextColor(Color(255, 204, 0, 255))
|
||||
panelText:Dock(LEFT)
|
||||
panelText:SetContentAlignment(4)
|
||||
panelText:SizeToContents()
|
||||
|
||||
local lrMargins = (self:GetWide() * 0.5) - ((warningIcon:GetWide() + SScaleMin(8 / 3)) * 0.5) - (panelText:GetWide() * 0.5)
|
||||
textPanel:DockMargin(lrMargins, 0, lrMargins, 0)
|
||||
|
||||
local finish = self:Add("DButton")
|
||||
finish:Dock(BOTTOM)
|
||||
finish:SetFont("TitlesFontNoClamp")
|
||||
finish:SetText("FINISH")
|
||||
finish:DockMargin(0, SScaleMin(20 / 3), 0, 0)
|
||||
finish:SetTall(SScaleMin(50 / 3))
|
||||
finish.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self:GetAnswers()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetAnswers()
|
||||
local answers = {}
|
||||
|
||||
for _, v in pairs(self.comboboxes) do
|
||||
if v:GetSelected() and v:GetSelected() != "" and v:GetSelected() != "Choose Answer" then
|
||||
answers[v.question] = v:GetSelected()
|
||||
end
|
||||
end
|
||||
|
||||
netstream.Start("CompleteQuiz", answers)
|
||||
end
|
||||
|
||||
vgui.Register("ixQuizMenu", PANEL, "DFrame")
|
||||
|
||||
netstream.Hook("RemoveQuizUI", function()
|
||||
if ix.gui.quizAnswering and IsValid(ix.gui.quizAnswering) then
|
||||
ix.gui.quizAnswering:Remove()
|
||||
end
|
||||
end)
|
||||
587
gamemodes/helix/plugins/willardinterface/derma/cl_scoreboard.lua
Normal file
587
gamemodes/helix/plugins/willardinterface/derma/cl_scoreboard.lua
Normal file
@@ -0,0 +1,587 @@
|
||||
--[[
|
||||
| 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 rowPaintFunctions = {
|
||||
function(width, height)
|
||||
end,
|
||||
|
||||
function(width, height)
|
||||
surface.SetDrawColor(0, 0, 0, 80)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
surface.SetDrawColor(50, 50, 50, 255)
|
||||
surface.DrawOutlinedRect(0, -1, width, height + 1)
|
||||
end
|
||||
}
|
||||
|
||||
-- character icon
|
||||
-- we can't customize the rendering of ModelImage so we have to do it ourselves
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "model", "Model", FORCE_STRING)
|
||||
AccessorFunc(PANEL, "bHidden", "Hidden", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(SScaleMin(43 / 3), SScaleMin(50 / 3))
|
||||
self.bodygroups = "000000000"
|
||||
end
|
||||
|
||||
function PANEL:SetModel(model, skin, bodygroups)
|
||||
model = model:gsub("\\", "/")
|
||||
|
||||
if (isstring(bodygroups) and bodygroups:utf8len() != 9) then
|
||||
self.bodygroups = "000000000"
|
||||
end
|
||||
|
||||
self.model = model
|
||||
self.skin = skin
|
||||
self.path = "materials/spawnicons/" ..
|
||||
model:utf8sub(1, #model - 4) .. -- remove extension
|
||||
((isnumber(skin) and skin > 0) and ("_skin" .. tostring(skin)) or "") .. -- skin number
|
||||
(self.bodygroups != "000000000" and ("_" .. self.bodygroups) or "") .. -- bodygroups
|
||||
".png"
|
||||
|
||||
local material = Material(self.path, "smooth")
|
||||
|
||||
-- we don't have a cached spawnicon texture, so we need to forcefully generate one
|
||||
if (material:IsError()) then
|
||||
self.id = "ixScoreboardIcon" .. self.path
|
||||
self.renderer = self:Add("ModelImage")
|
||||
self.renderer:SetVisible(false)
|
||||
self.renderer:SetModel(model, skin, self.bodygroups)
|
||||
self.renderer:RebuildSpawnIcon()
|
||||
|
||||
-- this is the only way to get a callback for generated spawn icons, it's bad but it's only done once
|
||||
hook.Add("SpawniconGenerated", self.id, function(lastModel, filePath, modelsLeft)
|
||||
filePath = filePath:gsub("\\", "/"):utf8lower()
|
||||
|
||||
if (filePath == self.path) then
|
||||
hook.Remove("SpawniconGenerated", self.id)
|
||||
|
||||
self.material = Material(filePath, "smooth")
|
||||
self.renderer:Remove()
|
||||
end
|
||||
end)
|
||||
else
|
||||
self.material = material
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetBodygroup(k, v)
|
||||
if (k < 0 or k > 9 or v < 0 or v > 9) then
|
||||
return
|
||||
end
|
||||
|
||||
self.bodygroups = self.bodygroups:SetChar(k + 1, v)
|
||||
end
|
||||
|
||||
function PANEL:GetModel()
|
||||
return self.model or "models/error.mdl"
|
||||
end
|
||||
|
||||
function PANEL:GetSkin()
|
||||
return self.skin or 1
|
||||
end
|
||||
|
||||
function PANEL:DoClick()
|
||||
end
|
||||
|
||||
function PANEL:DoRightClick()
|
||||
end
|
||||
|
||||
function PANEL:OnMouseReleased(key)
|
||||
if (key == MOUSE_LEFT) then
|
||||
self:DoClick()
|
||||
elseif (key == MOUSE_RIGHT) then
|
||||
self:DoRightClick()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
if (!self.material) then
|
||||
return
|
||||
end
|
||||
|
||||
surface.SetMaterial(self.material)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
if (self.id) then
|
||||
hook.Remove("SpawniconGenerated", self.id)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixScoreboardIcon", PANEL, "Panel")
|
||||
|
||||
-- player row
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "paintFunction", "BackgroundPaintFunction")
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetTall(SScaleMin(64 / 3))
|
||||
self.icon = self:Add("ixScoreboardIcon")
|
||||
self.icon:Dock(LEFT)
|
||||
self.icon:DockMargin(SScaleMin(20 / 3), SScaleMin(10 / 3), 0, SScaleMin(10 / 3))
|
||||
|
||||
local topPushDown = SScaleMin(150 / 3)
|
||||
self.leftSideFrame = self:Add("Panel")
|
||||
self.leftSideFrame:SetWide((ScrW() - (topPushDown * 2)) * 0.5)
|
||||
self.leftSideFrame:Dock(LEFT)
|
||||
self.leftSideFrame.Paint = nil
|
||||
|
||||
self.name = self.leftSideFrame:Add("DLabel")
|
||||
self.name:Dock(TOP)
|
||||
self.name:DockMargin(SScaleMin(20 / 3), SScaleMin(12 / 3), 0, 0)
|
||||
self.name:SetTextColor(color_white)
|
||||
self.name:SetFont("MenuFontBoldNoClamp")
|
||||
|
||||
self.description = self.leftSideFrame:Add("DLabel")
|
||||
self.description:Dock(TOP)
|
||||
self.description:DockMargin(SScaleMin(21 / 3), 0, 0, 0)
|
||||
self.description:SetTextColor(Color(230, 230, 230, 255))
|
||||
self.description:SetFont("MenuFontNoClamp")
|
||||
|
||||
self.rightSideFrame = self:Add("Panel")
|
||||
self.rightSideFrame:SetWide((ScrW() - (topPushDown * 2)) * 0.5)
|
||||
self.rightSideFrame:Dock(RIGHT)
|
||||
self.rightSideFrame.Paint = nil
|
||||
|
||||
self.ping = self.rightSideFrame:Add("DLabel")
|
||||
self.ping:Dock(RIGHT)
|
||||
self.ping:DockMargin(SScaleMin(30 / 3), 0, SScaleMin(30 / 3), 0)
|
||||
self.ping:SetTextColor(color_white)
|
||||
self.ping:SetFont("ixSmallFont")
|
||||
|
||||
self.pictureFrame = self.rightSideFrame:Add("Panel")
|
||||
self.pictureFrame:Dock(RIGHT)
|
||||
self.pictureFrame:DockMargin(SScaleMin(30 / 3), SScaleMin(8 / 3), 0, 0)
|
||||
self.pictureFrame:SetSize(SScaleMin(48 / 3), SScaleMin(32 / 3))
|
||||
self.pictureFrame.Paint = nil
|
||||
|
||||
self.steamImage = self.pictureFrame:Add("AvatarImage")
|
||||
self.steamImage:SetSize( SScaleMin(48 / 3), SScaleMin(48 / 3) )
|
||||
self.steamImage.OnMouseReleased = function(pnl, key)
|
||||
if (key != MOUSE_RIGHT) then return end
|
||||
|
||||
local client = self.player
|
||||
|
||||
if (!IsValid(client)) then
|
||||
return
|
||||
end
|
||||
|
||||
local menu = DermaMenu()
|
||||
|
||||
menu:AddOption(L("viewProfile"), function()
|
||||
client:ShowProfile()
|
||||
end)
|
||||
|
||||
menu:AddOption(L("copySteamID"), function()
|
||||
SetClipboardText(client:IsBot() and client:EntIndex() or client:SteamID())
|
||||
end)
|
||||
|
||||
hook.Run("PopulateScoreboardPlayerMenu", client, menu)
|
||||
|
||||
for _, v in pairs(menu:GetChildren()[1]:GetChildren()) do
|
||||
v:SetFont("MenuFontNoClamp")
|
||||
end
|
||||
|
||||
menu:Open()
|
||||
end
|
||||
|
||||
self.steamImage:SetHelixTooltip(function(tooltip)
|
||||
local client = self.player
|
||||
|
||||
if (IsValid(self) and IsValid(client)) then
|
||||
ix.hud.PopulatePlayerTooltip(tooltip, client)
|
||||
end
|
||||
end)
|
||||
|
||||
self.steamName = self.rightSideFrame:Add("DLabel")
|
||||
self.steamName:Dock(RIGHT)
|
||||
self.steamName:DockMargin(SScaleMin(30 / 3), 0, 0, 0)
|
||||
self.steamName:SetTextColor(color_white)
|
||||
self.steamName:SetFont("ixSmallFont")
|
||||
|
||||
self.paintFunction = rowPaintFunctions[1]
|
||||
self.nextThink = CurTime() + 1
|
||||
end
|
||||
|
||||
function PANEL:Update()
|
||||
local client = self.player
|
||||
local model = client:GetModel()
|
||||
local skin = client:GetSkin()
|
||||
local name = hook.Run("GetCharacterName", client, "scoreboard") or client:GetName()
|
||||
local steamName = client:SteamName()
|
||||
local ping = client:Ping()
|
||||
local description = hook.Run("GetCharacterDescription", client) or
|
||||
(client:GetCharacter() and client:GetCharacter():GetDescription()) or ""
|
||||
|
||||
local bRecognize = false
|
||||
local localCharacter = LocalPlayer():GetCharacter()
|
||||
local character = IsValid(self.player) and self.player:GetCharacter()
|
||||
|
||||
if (localCharacter and character) then
|
||||
bRecognize = hook.Run("IsCharacterRecognized", localCharacter, character:GetID())
|
||||
or hook.Run("IsPlayerRecognized", self.player)
|
||||
end
|
||||
|
||||
self.icon:SetHidden(!bRecognize)
|
||||
|
||||
if (!bRecognize) then
|
||||
self.icon.material = ix.util.GetMaterial("willardnetworks/tabmenu/scoreboard/question.png", "smooth nocull")
|
||||
end
|
||||
|
||||
self:SetZPos(bRecognize and 1 or 2)
|
||||
|
||||
if (bRecognize and (self.icon:GetModel() != model or self.icon:GetSkin() != skin)) then
|
||||
self.icon:SetModel(model, skin)
|
||||
self.icon:SetTooltip(nil)
|
||||
end
|
||||
|
||||
-- no easy way to check bodygroups so we'll just set them anyway
|
||||
for _, v in pairs(client:GetBodyGroups()) do
|
||||
self.icon:SetBodygroup(v.id, client:GetBodygroup(v.id))
|
||||
end
|
||||
|
||||
if (self.name:GetText() != name) then
|
||||
self.name:SetText(bRecognize and name or L("unknown"))
|
||||
self.name:SizeToContents()
|
||||
end
|
||||
|
||||
if (self.description:GetText() != description) then
|
||||
if string.utf8len( description ) > 80 then
|
||||
local shortenedDesc = string.utf8sub(description, 1, 80)
|
||||
self.description:SetText(shortenedDesc.."...")
|
||||
else
|
||||
self.description:SetText(description)
|
||||
end
|
||||
|
||||
self.description:SizeToContents()
|
||||
end
|
||||
|
||||
if (self.ping:GetText() != ping) then
|
||||
self.ping:SetText(ping)
|
||||
self.ping:SizeToContents()
|
||||
end
|
||||
|
||||
if (self.steamName:GetText() != steamName) then
|
||||
self.steamName:SetText(steamName)
|
||||
self.steamName:SizeToContents()
|
||||
end
|
||||
|
||||
self.steamImage:SetPlayer( self.player, SScaleMin(54 / 3) )
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (CurTime() >= self.nextThink) then
|
||||
self.nextThink = CurTime() + 1
|
||||
if (!IsValid(self.player)) then return end
|
||||
|
||||
local client = self.player
|
||||
local team = client:Team()
|
||||
local hasActiveCombineSuit = client:GetNetVar("combineMaskEquipped")
|
||||
if team == FACTION_CP and !hasActiveCombineSuit then
|
||||
team = FACTION_CITIZEN
|
||||
end
|
||||
|
||||
if (!IsValid(client) or !client:GetCharacter() or self.character != client:GetCharacter() or self.team != team) then
|
||||
if team == FACTION_CP and !hasActiveCombineSuit then
|
||||
return
|
||||
else
|
||||
self:Remove()
|
||||
self:GetParent():SizeToContents()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetPlayer(client)
|
||||
self.player = client
|
||||
self.team = client:Team()
|
||||
|
||||
if self.team == FACTION_CP and !client:GetNetVar("combineMaskEquipped") then
|
||||
self.team = FACTION_CITIZEN
|
||||
end
|
||||
|
||||
self.character = client:GetCharacter()
|
||||
|
||||
self:Update()
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
self.paintFunction(width, height)
|
||||
end
|
||||
|
||||
vgui.Register("ixScoreboardRow", PANEL, "EditablePanel")
|
||||
|
||||
-- faction grouping
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "faction", "Faction")
|
||||
|
||||
function PANEL:Init()
|
||||
self:DockMargin(0, 0, 0, 0)
|
||||
self:SetTall(SScaleMin(32 / 3))
|
||||
self:DockPadding(0, SScaleMin(31 / 3), 0, 0)
|
||||
|
||||
self.nextThink = 0
|
||||
end
|
||||
|
||||
function PANEL:AddPlayer(client, index)
|
||||
if (!IsValid(client) or !client:GetCharacter() or hook.Run("ShouldShowPlayerOnScoreboard", client, self) == false) then
|
||||
return false
|
||||
end
|
||||
|
||||
local id = index == 0 and 1 or 2
|
||||
local panel = self:Add("ixScoreboardRow")
|
||||
panel:SetPlayer(client)
|
||||
panel:Dock(TOP)
|
||||
panel:SetZPos(2)
|
||||
panel:SetBackgroundPaintFunction(rowPaintFunctions[id])
|
||||
|
||||
self:SizeToContents()
|
||||
client.ixScoreboardSlot = panel
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function PANEL:SetFaction(faction)
|
||||
self:SetColor(faction.color)
|
||||
|
||||
local scoreboardTitle = self:Add("DLabel")
|
||||
scoreboardTitle:SetText(L(faction.name))
|
||||
scoreboardTitle:SetFont("MenuFontLargerBoldNoFix")
|
||||
scoreboardTitle:SetPos(SScaleMin(50 / 3), SScaleMin(5 / 3))
|
||||
scoreboardTitle:SizeToContents()
|
||||
|
||||
self.faction = faction
|
||||
|
||||
self.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(ColorAlpha(faction.color, 40))
|
||||
surface.DrawRect(1, 0, this:GetWide() - 2, SScaleMin(31 / 3))
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Update()
|
||||
local faction = self.faction
|
||||
local players = team.GetPlayers(faction.index)
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
if faction.index == FACTION_CP then
|
||||
if !v:GetNetVar("combineMaskEquipped") and v:Team() == FACTION_CP then
|
||||
table.RemoveByValue(players, v)
|
||||
end
|
||||
|
||||
if !ix.config.Get("ShowCPsOnScoreboard", false) then
|
||||
if LocalPlayer():Team() != FACTION_ADMIN and LocalPlayer():Team() != FACTION_SERVERADMIN and LocalPlayer():Team() != FACTION_MCP and !LocalPlayer():IsCombine() then
|
||||
table.RemoveByValue(players, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if faction.index == FACTION_CITIZEN then
|
||||
if !v:GetNetVar("combineMaskEquipped") and v:Team() == FACTION_CP then
|
||||
table.insert(players, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local ownChar = LocalPlayer().GetCharacter and LocalPlayer():GetCharacter()
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
local targetChar = v.GetCharacter and v:GetCharacter()
|
||||
if (targetChar) then
|
||||
local playerFaction = ix.faction.Get(v:Team())
|
||||
if !v:GetNetVar("combineMaskEquipped") and v:Team() == FACTION_CP then
|
||||
playerFaction = ix.faction.Get(FACTION_CITIZEN)
|
||||
end
|
||||
|
||||
if playerFaction and playerFaction.index == FACTION_CP and !ix.config.Get("ShowCPsOnScoreboard", false) then
|
||||
if LocalPlayer():Team() != FACTION_ADMIN and LocalPlayer():Team() != FACTION_SERVERADMIN and LocalPlayer():Team() != FACTION_MCP and !LocalPlayer():IsCombine() then
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
||||
if !playerFaction then playerFaction = ix.faction.Get(FACTION_CITIZEN) end
|
||||
if !playerFaction then continue end
|
||||
|
||||
local separateTab = playerFaction.separateUnknownTab
|
||||
|
||||
if !ownChar then continue end
|
||||
local doesRecognizeTarget = ownChar.DoesRecognize and ownChar:DoesRecognize(targetChar)
|
||||
|
||||
v.unknown = !separateTab and !doesRecognizeTarget
|
||||
|
||||
if (self.unknown and v.unknown) then
|
||||
table.insert(players, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (self.group) then
|
||||
players = {}
|
||||
|
||||
for _, v in pairs(self.faction:GetOnlineMembers()) do
|
||||
if (v:GetCharacter() and LocalPlayer():GetCharacter():DoesRecognize(v:GetCharacter())) then
|
||||
v.group = faction
|
||||
table.insert(players, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (table.IsEmpty(players) or (self.group and faction.hidden)) then
|
||||
self:SetVisible(false)
|
||||
self:GetParent():InvalidateLayout()
|
||||
else
|
||||
local bHasPlayers
|
||||
|
||||
for k, v in ipairs(players) do
|
||||
if (!self.unknown and v.unknown) then continue end
|
||||
if (!self.group and v.group and !v.group.hidden and !faction.separateUnknownTab) then continue end
|
||||
|
||||
if (!IsValid(v.ixScoreboardSlot)) then
|
||||
if (self:AddPlayer(v, k)) then
|
||||
bHasPlayers = true
|
||||
end
|
||||
else
|
||||
v.ixScoreboardSlot:Update()
|
||||
bHasPlayers = true
|
||||
end
|
||||
end
|
||||
|
||||
self:SetVisible(bHasPlayers)
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixScoreboardFaction", PANEL, "ixCategoryPanel")
|
||||
|
||||
-- main scoreboard panel
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
if (IsValid(ix.gui.scoreboard)) then
|
||||
ix.gui.scoreboard:Remove()
|
||||
end
|
||||
|
||||
local titlePushDown = SScaleMin(30 / 3)
|
||||
local topPushDown = SScaleMin(150 / 3)
|
||||
local scale780 = SScaleMin(780 / 3)
|
||||
local scale120 = SScaleMin(120 / 3)
|
||||
|
||||
self:SetWide(ScrW() - (topPushDown * 2))
|
||||
|
||||
local sizeXtitle, sizeYtitle = self:GetWide(), scale120
|
||||
local sizeXcontent, sizeYcontent = self:GetWide(), (scale780)
|
||||
|
||||
self.titlePanel = self:Add("Panel")
|
||||
self.titlePanel:SetSize(sizeXtitle, sizeYtitle)
|
||||
self.titlePanel:SetPos(self:GetWide() * 0.5 - self.titlePanel:GetWide() * 0.5)
|
||||
|
||||
self:CreateTitleText()
|
||||
|
||||
self.contentFrame = self:Add("DScrollPanel")
|
||||
self.contentFrame:SetSize(sizeXcontent, sizeYcontent)
|
||||
self.contentFrame:SetPos(self:GetWide() * 0.5 - self.contentFrame:GetWide() * 0.5, titlePushDown)
|
||||
|
||||
self:SetTall(scale120 + scale780 + titlePushDown)
|
||||
self:Center()
|
||||
|
||||
self:Update()
|
||||
|
||||
ix.gui.scoreboard = self
|
||||
end
|
||||
|
||||
function PANEL:Update()
|
||||
self.contentFrame:Clear()
|
||||
|
||||
self.factions = {}
|
||||
self.groups = {}
|
||||
self.nextThink = 0
|
||||
|
||||
local groups = hook.Run("GetGroups")
|
||||
|
||||
if (groups) then
|
||||
for _, v in pairs(groups) do
|
||||
if (self.groups[v:GetID()]) then continue end
|
||||
if (!v.active) then continue end
|
||||
|
||||
local panel = self.contentFrame:Add("ixScoreboardFaction")
|
||||
panel:SetFaction(v)
|
||||
panel:Dock(TOP)
|
||||
panel.group = true
|
||||
|
||||
table.insert(self.factions, panel)
|
||||
|
||||
self.groups[v:GetID()] = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #ix.faction.indices do
|
||||
local faction = ix.faction.indices[i]
|
||||
|
||||
local panel = self.contentFrame:Add("ixScoreboardFaction")
|
||||
panel:SetFaction(faction)
|
||||
panel:Dock(TOP)
|
||||
|
||||
table.insert(self.factions, panel)
|
||||
end
|
||||
|
||||
local unknownFaction = self.contentFrame:Add("ixScoreboardFaction")
|
||||
unknownFaction.unknown = true
|
||||
unknownFaction:SetFaction({
|
||||
color = Color(200, 200, 200),
|
||||
name = "Inconnue"
|
||||
})
|
||||
unknownFaction:Dock(TOP)
|
||||
|
||||
table.insert(self.factions, unknownFaction)
|
||||
end
|
||||
|
||||
function PANEL:CreateTitleText()
|
||||
local scoreboardIcon = self.titlePanel:Add("DImage")
|
||||
scoreboardIcon:SetImage("willardnetworks/tabmenu/navicons/scoreboard.png")
|
||||
scoreboardIcon:SetSize(SScaleMin(23 / 3), SScaleMin(17 / 3))
|
||||
|
||||
local scoreboardTitle = self.titlePanel:Add("DLabel")
|
||||
scoreboardTitle:SetFont("TitlesFontNoClamp")
|
||||
scoreboardTitle:SetText("Joueurs")
|
||||
scoreboardTitle:SizeToContents()
|
||||
scoreboardTitle:SetPos(SScaleMin(30 / 3), scoreboardIcon:GetTall() * 0.5 - scoreboardTitle:GetTall() * 0.5)
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (CurTime() >= self.nextThink) then
|
||||
for _, v in pairs(self.factions) do
|
||||
v:Update()
|
||||
end
|
||||
|
||||
self.nextThink = CurTime() + 0.5
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixScoreboard", PANEL, "EditablePanel")
|
||||
|
||||
hook.Add("CreateMenuButtons", "ixScoreboard", function(tabs)
|
||||
tabs["scoreboard"] = {
|
||||
|
||||
RowNumber = 3,
|
||||
|
||||
Width = 23,
|
||||
|
||||
Height = 17,
|
||||
|
||||
Icon = "willardnetworks/tabmenu/navicons/scoreboard.png",
|
||||
|
||||
Create = function(info, container)
|
||||
container:Add("ixScoreboard")
|
||||
end
|
||||
}
|
||||
end)
|
||||
813
gamemodes/helix/plugins/willardinterface/derma/cl_settings.lua
Normal file
813
gamemodes/helix/plugins/willardinterface/derma/cl_settings.lua
Normal file
@@ -0,0 +1,813 @@
|
||||
--[[
|
||||
| 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 panelMap = {
|
||||
[ix.type.bool] = "ixSettingsRowBool",
|
||||
[ix.type.array] = "ixSettingsRowArray",
|
||||
[ix.type.string] = "ixSettingsRowString",
|
||||
[ix.type.number] = "ixSettingsRowNumber",
|
||||
[ix.type.color] = "ixSettingsRowColor"
|
||||
}
|
||||
|
||||
local function EmitChange(pitch)
|
||||
LocalPlayer():EmitSound("weapons/ar2/ar2_empty.wav", 75, pitch or 150, 0.25)
|
||||
end
|
||||
|
||||
-- color setting
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "padding", "Padding", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self.color = table.Copy(color_white)
|
||||
self.padding = SScaleMin ( 4 / 3 )
|
||||
|
||||
self.panel = self:Add("Panel")
|
||||
self.panel:SetCursor("hand")
|
||||
self.panel:SetMouseInputEnabled(true)
|
||||
self.panel:Dock(RIGHT)
|
||||
self.panel.Paint = function(panel, width, height)
|
||||
local padding = self.padding
|
||||
|
||||
surface.SetDrawColor(derma.GetColor("DarkerBackground", self))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
surface.SetDrawColor(self.color)
|
||||
surface.DrawRect(padding, padding, width - padding * 2, height - padding * 2)
|
||||
end
|
||||
|
||||
self.panel.OnMousePressed = function(panel, key)
|
||||
if (key == MOUSE_LEFT) then
|
||||
self:OpenPicker()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OpenPicker()
|
||||
if (IsValid(self.picker)) then
|
||||
self.picker:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
self.picker = vgui.Create("ixSettingsRowColorPicker")
|
||||
self.picker:Attach(self)
|
||||
self.picker:SetValue(self.color)
|
||||
|
||||
self.picker.OnValueChanged = function(panel)
|
||||
local newColor = panel:GetValue()
|
||||
|
||||
if (newColor != self.color) then
|
||||
self.color = newColor
|
||||
self:OnValueChanged(newColor)
|
||||
end
|
||||
end
|
||||
|
||||
self.picker.OnValueUpdated = function(panel)
|
||||
self.color = panel:GetValue()
|
||||
self:OnValueChanged(self.color)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value)
|
||||
self.color = Color(value.r or 255, value.g or 255, value.b or 255, value.a or 255)
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return self.color
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
surface.SetFont("TitlesFontNoBoldNoClamp")
|
||||
local totalWidth = surface.GetTextSize("999")
|
||||
|
||||
self.panel:SetSize(totalWidth + self.padding * 2, height)
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRowColor", PANEL, "ixSettingsRow")
|
||||
|
||||
-- color setting picker
|
||||
DEFINE_BASECLASS("Panel")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "bDeleteSelf", "DeleteSelf", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
self.m_bIsMenuComponent = true
|
||||
self.bDeleteSelf = true
|
||||
|
||||
self.realHeight = SScaleMin ( 200 / 3 )
|
||||
self.height = SScaleMin ( 200 / 3 )
|
||||
self:SetSize(SScaleMin ( 250 / 3 ), SScaleMin ( 200 / 3 ))
|
||||
self:DockPadding(SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ))
|
||||
|
||||
self.picker = self:Add("DColorMixer")
|
||||
self.picker:Dock(FILL)
|
||||
self.picker.ValueChanged = function()
|
||||
self:OnValueUpdated()
|
||||
end
|
||||
|
||||
self:MakePopup()
|
||||
RegisterDermaMenuForClose(self)
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value)
|
||||
self.picker:SetColor(Color(value.r or 255, value.g or 255, value.b or 255, value.a or 255))
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return self.picker:GetColor()
|
||||
end
|
||||
|
||||
function PANEL:Attach(panel)
|
||||
self.attached = panel
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
local panel = self.attached
|
||||
|
||||
if (IsValid(panel)) then
|
||||
local width, height = self:GetSize()
|
||||
local x, y = panel:LocalToScreen(0, 0)
|
||||
|
||||
self:SetPos(
|
||||
math.Clamp(x + panel:GetWide() - width, 0, ScrW() - width),
|
||||
math.Clamp(y + panel:GetTall(), 0, ScrH() - height)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(derma.GetColor("DarkerBackground", self))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function PANEL:OnValueChanged()
|
||||
end
|
||||
|
||||
function PANEL:OnValueUpdated()
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
self:OnValueChanged()
|
||||
|
||||
-- @todo open/close animations
|
||||
self.bClosing = true
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
BaseClass.Remove(self)
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRowColorPicker", PANEL, "EditablePanel")
|
||||
|
||||
-- number setting
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.setting = self:Add("ixNumSlider")
|
||||
self.setting.nextUpdate = 0
|
||||
self.setting:Dock(RIGHT)
|
||||
self.setting.OnValueChanged = function(panel)
|
||||
self:OnValueChanged(self:GetValue())
|
||||
end
|
||||
self.setting.OnValueUpdated = function(panel)
|
||||
local fraction = panel:GetFraction()
|
||||
|
||||
if (fraction == 0) then
|
||||
EmitChange(75)
|
||||
return
|
||||
elseif (fraction == 1) then
|
||||
EmitChange(120)
|
||||
return
|
||||
end
|
||||
|
||||
if (SysTime() > panel.nextUpdate) then
|
||||
EmitChange(85 + fraction * 15)
|
||||
panel.nextUpdate = SysTime() + 0.05
|
||||
end
|
||||
end
|
||||
|
||||
local panel = self.setting:GetLabel()
|
||||
panel:SetCursor("hand")
|
||||
panel:SetMouseInputEnabled(true)
|
||||
panel.OnMousePressed = function(_, key)
|
||||
if (key == MOUSE_LEFT) then
|
||||
self:OpenEntry()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OpenEntry()
|
||||
if (IsValid(self.entry)) then
|
||||
self.entry:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
self.entry = vgui.Create("ixSettingsRowNumberEntry")
|
||||
self.entry:Attach(self)
|
||||
self.entry:SetValue(self:GetValue(), true)
|
||||
self.entry.OnValueChanged = function(panel)
|
||||
local value = math.Round(panel:GetValue(), self:GetDecimals())
|
||||
|
||||
if (value != self:GetValue()) then
|
||||
self:SetValue(value, true)
|
||||
self:OnValueChanged(value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value, bNoNotify)
|
||||
self.setting:SetValue(value, bNoNotify)
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return self.setting:GetValue()
|
||||
end
|
||||
|
||||
function PANEL:SetMin(value)
|
||||
self.setting:SetMin(value)
|
||||
end
|
||||
|
||||
function PANEL:SetMax(value)
|
||||
self.setting:SetMax(value)
|
||||
end
|
||||
|
||||
function PANEL:SetDecimals(value)
|
||||
self.setting:SetDecimals(value)
|
||||
end
|
||||
|
||||
function PANEL:GetDecimals()
|
||||
return self.setting:GetDecimals()
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
self.setting:SetWide(width * 0.5)
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRowNumber", PANEL, "ixSettingsRow")
|
||||
|
||||
-- number setting entry
|
||||
DEFINE_BASECLASS("Panel")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "bDeleteSelf", "DeleteSelf", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
surface.SetFont("TitlesFontNoBoldNoClamp")
|
||||
local width, height = surface.GetTextSize("999999")
|
||||
|
||||
self.m_bIsMenuComponent = true
|
||||
self.bDeleteSelf = true
|
||||
|
||||
self.realHeight = SScaleMin ( 200 / 3 )
|
||||
self.height = SScaleMin ( 200 / 3 )
|
||||
self:SetSize(width, height)
|
||||
self:DockPadding(SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ))
|
||||
|
||||
self.textEntry = self:Add("ixTextEntry")
|
||||
self.textEntry:SetNumeric(true)
|
||||
self.textEntry:SetFont("TitlesFontNoBoldNoClamp")
|
||||
self.textEntry:Dock(FILL)
|
||||
self.textEntry:RequestFocus()
|
||||
self.textEntry.OnEnter = function()
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
self:MakePopup()
|
||||
RegisterDermaMenuForClose(self)
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value, bInitial)
|
||||
value = tostring(value)
|
||||
self.textEntry:SetValue(value)
|
||||
|
||||
if (bInitial) then
|
||||
self.textEntry:SetCaretPos(value:utf8len())
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return tonumber(self.textEntry:GetValue()) or 0
|
||||
end
|
||||
|
||||
function PANEL:Attach(panel)
|
||||
self.attached = panel
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
local panel = self.attached
|
||||
|
||||
if (IsValid(panel)) then
|
||||
local width, height = self:GetSize()
|
||||
local x, y = panel:LocalToScreen(0, 0)
|
||||
|
||||
self:SetPos(
|
||||
math.Clamp(x + panel:GetWide() - width, 0, ScrW() - width),
|
||||
math.Clamp(y + panel:GetTall(), 0, ScrH() - height)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(derma.GetColor("DarkerBackground", self))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function PANEL:OnValueChanged()
|
||||
end
|
||||
|
||||
function PANEL:OnValueUpdated()
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
self:OnValueChanged()
|
||||
|
||||
-- @todo open/close animations
|
||||
self.bClosing = true
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
BaseClass.Remove(self)
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRowNumberEntry", PANEL, "EditablePanel")
|
||||
|
||||
-- string setting
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.setting = self:Add("ixTextEntry")
|
||||
self.setting:Dock(RIGHT)
|
||||
self.setting:SetFont("TitlesFontNoBoldNoClamp")
|
||||
self.setting:SetBackgroundColor(derma.GetColor("DarkerBackground", self))
|
||||
self.setting.OnEnter = function()
|
||||
self:OnValueChanged(self:GetValue())
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value)
|
||||
self.setting:SetValue(tostring(value))
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return self.setting:GetValue()
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
self.setting:SetWide(width * 0.5)
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRowString", PANEL, "ixSettingsRow")
|
||||
|
||||
-- bool setting
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.setting = self:Add("ixCheckBox")
|
||||
self.setting:Dock(RIGHT)
|
||||
self.setting.DoClick = function(panel)
|
||||
self:OnValueChanged(self:GetValue())
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetValue(bValue)
|
||||
bValue = tobool(bValue)
|
||||
|
||||
self.setting:SetChecked(bValue, true)
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return self.setting:GetChecked()
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRowBool", PANEL, "ixSettingsRow")
|
||||
|
||||
-- array setting
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.array = {}
|
||||
|
||||
self.setting = self:Add("DComboBox")
|
||||
self.setting:Dock(RIGHT)
|
||||
self.setting:SetFont("TitlesFontNoBoldNoClamp")
|
||||
self.setting:SetTextColor(color_white)
|
||||
self.setting.OnSelect = function(panel)
|
||||
self:OnValueChanged(self:GetValue())
|
||||
|
||||
panel:SizeToContents()
|
||||
panel:SetWide(panel:GetWide() + SScaleMin ( 12 / 3 )) -- padding for arrow (nice)
|
||||
|
||||
if (!self.bInitial) then
|
||||
EmitChange()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Populate(key, info)
|
||||
if (!isfunction(info.populate)) then
|
||||
ErrorNoHalt(string.format("expected populate function for array option '%s'", key))
|
||||
return
|
||||
end
|
||||
|
||||
local entries = info.populate()
|
||||
local i = 1
|
||||
|
||||
for k, v in pairs(entries) do
|
||||
self.setting:AddChoice(v, k)
|
||||
self.array[k] = i
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value)
|
||||
--quick fix
|
||||
if (!self.array[value]) then return end
|
||||
|
||||
self.bInitial = true
|
||||
self.setting:ChooseOptionID(self.array[value])
|
||||
self.bInitial = false
|
||||
end
|
||||
|
||||
function PANEL:GetValue()
|
||||
return select(2, self.setting:GetSelected())
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRowArray", PANEL, "ixSettingsRow")
|
||||
|
||||
-- settings row
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "backgroundIndex", "BackgroundIndex", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "bShowReset", "ShowReset", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
self:DockPadding(SScaleMin ( 10 / 3 ), SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ), SScaleMin ( 4 / 3 ))
|
||||
|
||||
self.text = self:Add("DLabel")
|
||||
self.text:Dock(LEFT)
|
||||
self.text:SetFont("TitlesFontNoBoldNoClamp")
|
||||
self.text:SetExpensiveShadow(1, color_black)
|
||||
|
||||
self.backgroundIndex = 0
|
||||
end
|
||||
|
||||
function PANEL:SetShowReset(value, name, default)
|
||||
value = tobool(value)
|
||||
|
||||
if (value and !IsValid(self.reset)) then
|
||||
self.reset = self:Add("DButton")
|
||||
self.reset:SetFont("TitlesFontNoBoldNoClamp")
|
||||
self.reset:SetText("Réinitialiser")
|
||||
self.reset:SetTextColor(ColorAlpha(derma.GetColor("Warning", self), 100))
|
||||
self.reset:Dock(LEFT)
|
||||
self.reset:DockMargin(SScaleMin ( 4 / 3 ), 0, 0, 0)
|
||||
self.reset:SizeToContents()
|
||||
self.reset.Paint = nil
|
||||
self.reset.DoClick = function()
|
||||
self:OnResetClicked()
|
||||
end
|
||||
self.reset:SetHelixTooltip(function(tooltip)
|
||||
local title = tooltip:AddRow("title")
|
||||
title:SetImportant()
|
||||
title:SetText(L("resetDefault"))
|
||||
title:SetBackgroundColor(derma.GetColor("Warning", self))
|
||||
title:SizeToContents()
|
||||
|
||||
local description = tooltip:AddRow("description")
|
||||
description:SetText(L("resetDefaultDescription", tostring(name), tostring(default)))
|
||||
description:SizeToContents()
|
||||
end)
|
||||
elseif (!value and IsValid(self.reset)) then
|
||||
self.reset:Remove()
|
||||
end
|
||||
|
||||
self.bShowReset = value
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (IsValid(self.reset)) then
|
||||
self.reset:SetVisible(self:IsHovered() or self:IsOurChild(vgui.GetHoveredPanel()))
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnResetClicked()
|
||||
end
|
||||
|
||||
function PANEL:GetLabel()
|
||||
return self.text
|
||||
end
|
||||
|
||||
function PANEL:SetText(text)
|
||||
self.text:SetText(text)
|
||||
self:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:GetText()
|
||||
return self.text:GetText()
|
||||
end
|
||||
|
||||
-- implemented by row types
|
||||
function PANEL:GetValue()
|
||||
end
|
||||
|
||||
function PANEL:SetValue(value)
|
||||
end
|
||||
|
||||
-- meant for array types to populate combo box values
|
||||
function PANEL:Populate(key, info)
|
||||
end
|
||||
|
||||
-- called when value is changed by user
|
||||
function PANEL:OnValueChanged(newValue)
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local _, top, _, bottom = self:GetDockPadding()
|
||||
|
||||
self.text:SizeToContents()
|
||||
self:SetTall(self.text:GetTall() + top + bottom)
|
||||
self.ixRealHeight = self:GetTall()
|
||||
self.ixHeight = self.ixRealHeight
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
derma.SkinFunc("PaintSettingsRowBackground", self, width, height)
|
||||
end
|
||||
|
||||
vgui.Register("ixSettingsRow", PANEL, "EditablePanel")
|
||||
|
||||
-- settings panel
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
local titlePushDown = SScaleMin(30 / 3)
|
||||
local topPushDown = SScaleMin(150 / 3)
|
||||
local scale780 = SScaleMin(780 / 3)
|
||||
local scale120 = SScaleMin(120 / 3)
|
||||
|
||||
self:SetWide(ScrW() - (topPushDown * 2))
|
||||
|
||||
local sizeXtitle, sizeYtitle = self:GetWide(), scale120
|
||||
local sizeXcontent, sizeYcontent = self:GetWide(), (scale780)
|
||||
|
||||
self.titlePanel = self:Add("Panel")
|
||||
self.titlePanel:SetSize(sizeXtitle, sizeYtitle)
|
||||
self.titlePanel:SetPos(self:GetWide() * 0.5 - self.titlePanel:GetWide() * 0.5)
|
||||
|
||||
self:CreateTitleText()
|
||||
|
||||
self.contentFrame = self:Add("Panel")
|
||||
self.contentFrame:SetSize(sizeXcontent, sizeYcontent)
|
||||
self.contentFrame:SetPos(self:GetWide() * 0.5 - self.contentFrame:GetWide() * 0.5, titlePushDown)
|
||||
|
||||
self:SetTall(scale120 + scale780 + titlePushDown)
|
||||
self:Center()
|
||||
|
||||
self.rows = {}
|
||||
self.categories = {}
|
||||
|
||||
-- scroll panel
|
||||
DEFINE_BASECLASS("DScrollPanel")
|
||||
|
||||
self.canvas = self.contentFrame:Add("DScrollPanel")
|
||||
self.canvas:Dock(FILL)
|
||||
self.canvas.PerformLayout = function(panel)
|
||||
BaseClass.PerformLayout(panel)
|
||||
|
||||
if (!panel.VBar.Enabled) then
|
||||
panel.pnlCanvas:SetWide(panel:GetWide() - panel.VBar:GetWide())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateTitleText()
|
||||
self.settingsTitleIcon = self.titlePanel:Add("DImage")
|
||||
self.settingsTitleIcon:SetImage("willardnetworks/tabmenu/navicons/settings.png")
|
||||
self.settingsTitleIcon:SetSize(SScaleMin(20 / 3), SScaleMin(16 / 3))
|
||||
|
||||
self.settingsTitle = self.titlePanel:Add("DLabel")
|
||||
self.settingsTitle:SetFont("TitlesFontNoClamp")
|
||||
self.settingsTitle:SetText("Options")
|
||||
self.settingsTitle:SizeToContents()
|
||||
self.settingsTitle:SetPos(SScaleMin(32 / 3), self.settingsTitleIcon:GetTall() * 0.5 - self.settingsTitle:GetTall() * 0.5)
|
||||
end
|
||||
|
||||
function PANEL:GetRowPanelName(type)
|
||||
return panelMap[type] or "ixSettingsRow"
|
||||
end
|
||||
|
||||
function PANEL:AddCategory(name)
|
||||
local panel = self.categories[name]
|
||||
|
||||
if (!IsValid(panel)) then
|
||||
panel = self.canvas:Add("ixCategoryPanel")
|
||||
panel:SetText(name)
|
||||
panel:Dock(TOP)
|
||||
panel:DockMargin(0, SScaleMin(8 / 3), 0, 0)
|
||||
|
||||
self.categories[name] = panel
|
||||
return panel
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:AddRow(type, category)
|
||||
category = self.categories[category]
|
||||
local id = panelMap[type]
|
||||
|
||||
if (!id) then
|
||||
ErrorNoHalt("attempted to create row with unimplemented type '" .. tostring(ix.type[type]) .. "'\n")
|
||||
id = "ixSettingsRow"
|
||||
end
|
||||
|
||||
local panel = (IsValid(category) and category or self.canvas):Add(id)
|
||||
panel:Dock(TOP)
|
||||
panel:SetBackgroundIndex(#self.rows % 2)
|
||||
|
||||
self.rows[#self.rows + 1] = panel
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:GetRows()
|
||||
return self.rows
|
||||
end
|
||||
|
||||
function PANEL:Clear()
|
||||
for _, v in ipairs(self.rows) do
|
||||
if (IsValid(v)) then
|
||||
v:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
self.rows = {}
|
||||
end
|
||||
|
||||
function PANEL:SetSearchEnabled(bValue)
|
||||
if (!bValue) then
|
||||
if (IsValid(self.searchEntry)) then
|
||||
self.searchEntry:Remove()
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- search entry
|
||||
self.searchEntry = self.contentFrame:Add("ixIconTextEntry")
|
||||
self.searchEntry:Dock(TOP)
|
||||
self.searchEntry:SetEnterAllowed(false)
|
||||
|
||||
self.searchEntry.OnChange = function(entry)
|
||||
self:FilterRows(entry:GetValue())
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:FilterRows(query)
|
||||
query = string.PatternSafe(query:utf8lower())
|
||||
|
||||
local bEmpty = query == ""
|
||||
|
||||
for categoryName, category in pairs(self.categories) do
|
||||
category.size = 0
|
||||
category:CreateAnimation(0.5, {
|
||||
index = 21,
|
||||
target = {size = 1},
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SizeToContents()
|
||||
end
|
||||
})
|
||||
|
||||
for _, row in ipairs(category:GetChildren()) do
|
||||
local bFound = bEmpty or row:GetText():utf8lower():find(query) or categoryName:utf8lower():find(query)
|
||||
|
||||
row:SetVisible(true)
|
||||
row:CreateAnimation(0.5, {
|
||||
index = 21,
|
||||
target = {ixHeight = bFound and row.ixRealHeight or 0},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetTall(bFound and math.min(panel.ixHeight + SScaleMin ( 2 / 3 ), panel.ixRealHeight) or math.max(panel.ixHeight - SScaleMin ( 2 / 3 ), 0))
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
panel:SetVisible(bFound)
|
||||
|
||||
-- need this so categories are sized properly when animations are disabled - there is no guaranteed order
|
||||
-- that animations will think so we SizeToContents here. putting it here will result in redundant calls but
|
||||
-- I guess we have the performance to spare
|
||||
if (ix.option.Get("disableAnimations", false)) then
|
||||
category:SizeToContents()
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
for _, v in pairs(self.categories) do
|
||||
v:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixSettings", PANEL, "Panel")
|
||||
|
||||
hook.Add("CreateMenuButtons", "ixSettings", function(tabs)
|
||||
tabs["Options"] = {
|
||||
|
||||
RowNumber = 5,
|
||||
|
||||
Width = 20,
|
||||
|
||||
Height = 16,
|
||||
|
||||
Right = true,
|
||||
|
||||
Icon = "willardnetworks/tabmenu/navicons/settings.png",
|
||||
|
||||
Create = function(info, container)
|
||||
local panel = container:Add("ixSettings")
|
||||
panel:SetSearchEnabled(true)
|
||||
|
||||
for category, options in SortedPairs(ix.option.GetAllByCategories(true)) do
|
||||
category = L(category)
|
||||
panel:AddCategory(category)
|
||||
|
||||
-- sort options by language phrase rather than the key
|
||||
table.sort(options, function(a, b)
|
||||
return L(a.phrase) < L(b.phrase)
|
||||
end)
|
||||
|
||||
for _, data in pairs(options) do
|
||||
local key = data.key
|
||||
local row = panel:AddRow(data.type, category)
|
||||
local value = ix.util.SanitizeType(data.type, ix.option.Get(key))
|
||||
|
||||
row:SetText(L(data.phrase))
|
||||
row:Populate(key, data)
|
||||
|
||||
-- type-specific properties
|
||||
if (data.type == ix.type.number) then
|
||||
row:SetMin(data.min or 0)
|
||||
row:SetMax(data.max or 10)
|
||||
row:SetDecimals(data.decimals or 0)
|
||||
end
|
||||
|
||||
row:SetValue(value, true)
|
||||
row:SetShowReset(value != data.default, key, data.default)
|
||||
row.OnValueChanged = function()
|
||||
local newValue = row:GetValue()
|
||||
|
||||
row:SetShowReset(newValue != data.default, key, data.default)
|
||||
ix.option.Set(key, newValue)
|
||||
end
|
||||
|
||||
row.OnResetClicked = function()
|
||||
row:SetShowReset(false)
|
||||
row:SetValue(data.default, true)
|
||||
|
||||
ix.option.Set(key, data.default)
|
||||
end
|
||||
|
||||
row:GetLabel():SetHelixTooltip(function(tooltip)
|
||||
local title = tooltip:AddRow("name")
|
||||
title:SetImportant()
|
||||
title:SetText(key)
|
||||
title:SizeToContents()
|
||||
title:SetMaxWidth(math.max(title:GetMaxWidth(), ScrW() * 0.5))
|
||||
|
||||
local description = tooltip:AddRow("description")
|
||||
description:SetText(L(data.description))
|
||||
description:SizeToContents()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
panel:SizeToContents()
|
||||
container.panel = panel
|
||||
end,
|
||||
|
||||
OnSelected = function(info, container)
|
||||
container.panel.searchEntry:RequestFocus()
|
||||
end
|
||||
}
|
||||
end)
|
||||
184
gamemodes/helix/plugins/willardinterface/derma/cl_shipment.lua
Normal file
184
gamemodes/helix/plugins/willardinterface/derma/cl_shipment.lua
Normal file
@@ -0,0 +1,184 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetAlpha(0)
|
||||
self:AlphaTo(255, 0.5, 0)
|
||||
self.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
Derma_DrawBackgroundBlur( self, 1 )
|
||||
end
|
||||
|
||||
self.innerContent = self:Add("Panel")
|
||||
self.innerContent:SetSize(460, 360)
|
||||
self.innerContent:Center()
|
||||
self.innerContent:MakePopup()
|
||||
self.innerContent.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local topbar = self.innerContent:Add("Panel")
|
||||
topbar:SetSize(self.innerContent:GetWide(), 50)
|
||||
topbar:Dock(TOP)
|
||||
topbar.Paint = function( self, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local titleText = topbar:Add("DLabel")
|
||||
titleText:SetFont("CharCreationBoldTitle")
|
||||
titleText:Dock(LEFT)
|
||||
titleText:SetText("Livraisons")
|
||||
titleText:DockMargin(10, 0, 0, 0)
|
||||
titleText:SetContentAlignment(4)
|
||||
titleText:SizeToContents()
|
||||
|
||||
local exit = topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(20, 20)
|
||||
exit:DockMargin(0, 15, 10, 15)
|
||||
exit:Dock(RIGHT)
|
||||
exit.DoClick = function()
|
||||
self:Close()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
self.scroll = self.innerContent:Add("DScrollPanel")
|
||||
self.scroll:Dock(FILL)
|
||||
|
||||
self.list = self.scroll:Add("DListLayout")
|
||||
self.list:Dock(FILL)
|
||||
end
|
||||
|
||||
function PANEL:SetItems(entity, items)
|
||||
self.entity = entity
|
||||
self.items = true
|
||||
self.itemPanels = {}
|
||||
|
||||
for k, v in SortedPairs(items) do
|
||||
local itemTable = ix.item.list[k]
|
||||
|
||||
if (itemTable) then
|
||||
local function ButtonPaint(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)
|
||||
end
|
||||
|
||||
local item = self.list:Add("Panel")
|
||||
item:SetTall(36)
|
||||
item:Dock(TOP)
|
||||
item:DockMargin(4, 4, 4, 0)
|
||||
item.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(Color(0, 0, 0, 100))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
item.icon = item:Add("SpawnIcon")
|
||||
item.icon:SetPos(5, 2)
|
||||
item.icon:SetSize(32, 32)
|
||||
item.icon:SetModel(itemTable:GetModel())
|
||||
item.icon:SetHelixTooltip(function(tooltip)
|
||||
ix.hud.PopulateItemTooltip(tooltip, itemTable)
|
||||
end)
|
||||
|
||||
item.quantity = item.icon:Add("DLabel")
|
||||
item.quantity:SetSize(32, 32)
|
||||
item.quantity:SetContentAlignment(3)
|
||||
item.quantity:SetTextInset(0, 0)
|
||||
item.quantity:SetText(v)
|
||||
item.quantity:SetFont("DermaDefaultBold")
|
||||
item.quantity:SetExpensiveShadow(1, Color(0, 0, 0, 150))
|
||||
|
||||
item.name = item:Add("DLabel")
|
||||
item.name:SetPos(45, 0)
|
||||
item.name:SetSize(200, 36)
|
||||
item.name:SetFont("ixSmallFont")
|
||||
item.name:SetText(L(itemTable.name))
|
||||
item.name:SetContentAlignment(4)
|
||||
item.name:SetTextColor(color_white)
|
||||
|
||||
item.take = item:Add("DButton")
|
||||
item.take:Dock(RIGHT)
|
||||
item.take:SetText(L"take")
|
||||
item.take:SetWide(48)
|
||||
item.take:DockMargin(3, 3, 3, 3)
|
||||
item.take:SetTextColor(color_white)
|
||||
item.take.Paint = function(self, w, h) ButtonPaint(self, w, h) end
|
||||
item.take.DoClick = function(this)
|
||||
net.Start("ixShipmentUse")
|
||||
net.WriteString(k)
|
||||
net.WriteBool(false)
|
||||
net.SendToServer()
|
||||
|
||||
items[k] = items[k] - 1
|
||||
|
||||
item.quantity:SetText(items[k])
|
||||
|
||||
if (items[k] <= 0) then
|
||||
item:Remove()
|
||||
items[k] = nil
|
||||
end
|
||||
|
||||
if (table.IsEmpty(items)) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
item.drop = item:Add("DButton")
|
||||
item.drop:Dock(RIGHT)
|
||||
item.drop:SetText(L"drop")
|
||||
item.drop:SetWide(48)
|
||||
item.drop:DockMargin(3, 3, 0, 3)
|
||||
item.drop:SetTextColor(color_white)
|
||||
item.drop.Paint = function(self, w, h) ButtonPaint(self, w, h) end
|
||||
item.drop.DoClick = function(this)
|
||||
net.Start("ixShipmentUse")
|
||||
net.WriteString(k)
|
||||
net.WriteBool(true)
|
||||
net.SendToServer()
|
||||
|
||||
items[k] = items[k] - 1
|
||||
|
||||
item.quantity:SetText(items[k])
|
||||
|
||||
if (items[k] <= 0) then
|
||||
item:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
self.itemPanels[k] = item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Close()
|
||||
net.Start("ixShipmentClose")
|
||||
net.SendToServer()
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (self.items and !IsValid(self.entity)) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixShipment", PANEL, "Panel")
|
||||
532
gamemodes/helix/plugins/willardinterface/derma/cl_skin.lua
Normal file
532
gamemodes/helix/plugins/willardinterface/derma/cl_skin.lua
Normal file
@@ -0,0 +1,532 @@
|
||||
--[[
|
||||
| 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 gradient = surface.GetTextureID("vgui/gradient-d")
|
||||
local gradientUp = surface.GetTextureID("vgui/gradient-u")
|
||||
local gradientLeft = surface.GetTextureID("vgui/gradient-l")
|
||||
local gradientRadial = ix.util.GetMaterial("helix/gui/radial-gradient.png")
|
||||
local defaultBackgroundColor = Color(30, 30, 30, 200)
|
||||
|
||||
local SKIN = {}
|
||||
derma.DefineSkin("helix", "The base skin for the Helix framework.", SKIN)
|
||||
|
||||
SKIN.fontCategory = "ixMediumLightFont"
|
||||
SKIN.fontCategoryBlur = "ixMediumLightBlurFont"
|
||||
SKIN.fontSegmentedProgress = "ixMediumLightFont"
|
||||
|
||||
SKIN.Colours = table.Copy(derma.SkinList.Default.Colours)
|
||||
|
||||
SKIN.Colours.Info = Color(100, 185, 255)
|
||||
SKIN.Colours.Success = Color(64, 185, 85)
|
||||
SKIN.Colours.Error = Color(255, 100, 100)
|
||||
SKIN.Colours.Warning = Color(230, 180, 0)
|
||||
SKIN.Colours.MenuLabel = color_white
|
||||
SKIN.Colours.DarkerBackground = Color(0, 0, 0, 77)
|
||||
|
||||
SKIN.Colours.SegmentedProgress = {}
|
||||
SKIN.Colours.SegmentedProgress.Bar = Color(64, 185, 85)
|
||||
SKIN.Colours.SegmentedProgress.Text = color_white
|
||||
|
||||
SKIN.Colours.Area = {}
|
||||
|
||||
SKIN.Colours.Window.TitleActive = color_white
|
||||
SKIN.Colours.Window.TitleInactive = color_white
|
||||
|
||||
SKIN.Colours.Button.Normal = color_white
|
||||
SKIN.Colours.Button.Hover = color_white
|
||||
SKIN.Colours.Button.Down = Color(180, 180, 180)
|
||||
SKIN.Colours.Button.Disabled = Color(0, 0, 0, 100)
|
||||
|
||||
SKIN.Colours.Label.Default = color_white
|
||||
|
||||
function SKIN.tex.Menu_Strip(x, y, width, height, color)
|
||||
surface.SetDrawColor(0, 0, 0, 200)
|
||||
surface.DrawRect(x, y, width, height)
|
||||
|
||||
surface.SetDrawColor(ColorAlpha(color or ix.config.Get("color"), 175))
|
||||
surface.SetTexture(gradient)
|
||||
surface.DrawTexturedRect(x, y, width, height)
|
||||
|
||||
surface.SetTextColor(color_white)
|
||||
end
|
||||
|
||||
hook.Add("ColorSchemeChanged", "ixSkin", function(color)
|
||||
SKIN.Colours.Area.Background = color
|
||||
end)
|
||||
|
||||
function SKIN:DrawHelixCurved(x, y, radius, segments, barHeight, fraction, color)
|
||||
radius = radius or math.min(ScreenScale(72), 128) * 2
|
||||
segments = segments or 76
|
||||
barHeight = barHeight or 64
|
||||
color = color or ix.config.Get("color")
|
||||
fraction = fraction or 1
|
||||
|
||||
surface.SetTexture(-1)
|
||||
|
||||
for i = 1, math.ceil(segments) do
|
||||
local angle = math.rad((i / segments) * -360)
|
||||
local barX = x + math.sin(angle + (fraction * math.pi * 2)) * radius
|
||||
local barY = y + math.cos(angle + (fraction * math.pi * 2)) * radius
|
||||
local barOffset = math.sin(SysTime() + i * 0.5)
|
||||
|
||||
if (barOffset > 0) then
|
||||
surface.SetDrawColor(color)
|
||||
else
|
||||
surface.SetDrawColor(color.r * 0.5, color.g * 0.5, color.b * 0.5, color.a)
|
||||
end
|
||||
|
||||
surface.DrawTexturedRectRotated(barX, barY, 4, barOffset * (barHeight * fraction), math.deg(angle))
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:DrawHelix(x, y, width, height, segments, color, fraction, speed)
|
||||
segments = segments or width * 0.05
|
||||
color = color or ix.config.Get("color")
|
||||
fraction = fraction or 0.25
|
||||
speed = speed or 1
|
||||
|
||||
for i = 1, math.ceil(segments) do
|
||||
local offset = math.sin((SysTime() + speed) + i * fraction)
|
||||
local barHeight = height * offset
|
||||
|
||||
surface.SetTexture(-1)
|
||||
|
||||
if (offset > 0) then
|
||||
surface.SetDrawColor(color)
|
||||
else
|
||||
surface.SetDrawColor(color.r * 0.5, color.g * 0.5, color.b * 0.5, color.a)
|
||||
end
|
||||
|
||||
surface.DrawTexturedRectRotated(x + (i / segments) * width, y + height * 0.5, 4, barHeight, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintFrame(panel)
|
||||
if (!panel.bNoBackgroundBlur) then
|
||||
ix.util.DrawBlur(panel, 10)
|
||||
end
|
||||
|
||||
surface.SetDrawColor(30, 30, 30, 150)
|
||||
surface.DrawRect(0, 0, panel:GetWide(), panel:GetTall())
|
||||
|
||||
if (panel:GetTitle() != "" or panel.btnClose:IsVisible()) then
|
||||
surface.SetDrawColor(ix.config.Get("color"))
|
||||
surface.DrawRect(0, 0, panel:GetWide(), 24)
|
||||
|
||||
if (panel.bHighlighted) then
|
||||
self:DrawImportantBackground(0, 0, panel:GetWide(), 24, ColorAlpha(color_white, 22))
|
||||
end
|
||||
end
|
||||
|
||||
surface.SetDrawColor(ix.config.Get("color"))
|
||||
surface.DrawOutlinedRect(0, 0, panel:GetWide(), panel:GetTall())
|
||||
end
|
||||
|
||||
function SKIN:PaintBaseFrame(panel, width, height)
|
||||
if (!panel.bNoBackgroundBlur) then
|
||||
ix.util.DrawBlur(panel, 10)
|
||||
end
|
||||
|
||||
surface.SetDrawColor(30, 30, 30, 150)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
surface.SetDrawColor(ix.config.Get("color"))
|
||||
surface.DrawOutlinedRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:DrawImportantBackground(x, y, width, height, color)
|
||||
color = color or defaultBackgroundColor
|
||||
|
||||
surface.SetDrawColor(color)
|
||||
surface.DrawRect(x, y, width, height)
|
||||
end
|
||||
|
||||
function SKIN:DrawCharacterStatusBackground(panel, fraction)
|
||||
surface.SetDrawColor(0, 0, 0, fraction * 100)
|
||||
surface.DrawRect(0, 0, ScrW(), ScrH())
|
||||
ix.util.DrawBlurAt(0, 0, ScrW(), ScrH(), 5, nil, fraction * 255)
|
||||
end
|
||||
|
||||
function SKIN:PaintPanel(panel)
|
||||
if (panel.m_bBackground) then
|
||||
local width, height = panel:GetSize()
|
||||
if (panel.m_bgColor) then
|
||||
surface.SetDrawColor(panel.m_bgColor)
|
||||
else
|
||||
surface.SetDrawColor(30, 30, 30, 100)
|
||||
end
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
surface.SetDrawColor(0, 0, 0, 150)
|
||||
surface.DrawOutlinedRect(0, 0, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintMenuBackground(panel, width, height, alphaFraction)
|
||||
alphaFraction = alphaFraction or 1
|
||||
|
||||
surface.SetDrawColor(ColorAlpha(color_black, alphaFraction * 255))
|
||||
surface.SetTexture(gradient)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
|
||||
ix.util.DrawBlur(panel, alphaFraction * 15, nil, 200)
|
||||
end
|
||||
|
||||
function SKIN:PaintPlaceholderPanel(panel, width, height, barWidth, padding)
|
||||
local size = math.max(width, height)
|
||||
barWidth = barWidth or size * 0.05
|
||||
|
||||
local segments = size / barWidth
|
||||
|
||||
for i = 1, segments do
|
||||
surface.SetTexture(-1)
|
||||
surface.SetDrawColor(0, 0, 0, 88)
|
||||
surface.DrawTexturedRectRotated(i * barWidth, i * barWidth, barWidth, size * 2, -45)
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintCategoryPanel(panel, text, color)
|
||||
text = text or ""
|
||||
color = color or ix.config.Get("color")
|
||||
|
||||
surface.SetFont(self.fontCategoryBlur)
|
||||
|
||||
local textHeight = select(2, surface.GetTextSize(text)) + 6
|
||||
local width, height = panel:GetSize()
|
||||
|
||||
surface.SetDrawColor(0, 0, 0, 100)
|
||||
surface.DrawRect(0, textHeight, width, height - textHeight)
|
||||
|
||||
self:DrawImportantBackground(0, 0, width, textHeight, color)
|
||||
|
||||
surface.SetTextColor(color_black)
|
||||
surface.SetTextPos(4, 4)
|
||||
surface.DrawText(text)
|
||||
|
||||
surface.SetFont(self.fontCategory)
|
||||
surface.SetTextColor(color_white)
|
||||
surface.SetTextPos(4, 4)
|
||||
surface.DrawText(text)
|
||||
|
||||
surface.SetDrawColor(color)
|
||||
surface.DrawOutlinedRect(0, 0, width, height)
|
||||
|
||||
return 1, textHeight, 1, 1
|
||||
end
|
||||
|
||||
function SKIN:PaintButton(panel)
|
||||
if (panel.m_bBackground) then
|
||||
local w, h = panel:GetWide(), panel:GetTall()
|
||||
local alpha = 50
|
||||
|
||||
if (panel:GetDisabled()) then
|
||||
alpha = 10
|
||||
elseif (panel.Depressed) then
|
||||
alpha = 180
|
||||
elseif (panel.Hovered) then
|
||||
alpha = 75
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintEntityInfoBackground(panel, width, height)
|
||||
ix.util.DrawBlur(panel, 1)
|
||||
|
||||
surface.SetDrawColor(self.Colours.DarkerBackground)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintTooltipBackground(panel, width, height)
|
||||
ix.util.DrawBlur(panel, 1)
|
||||
|
||||
surface.SetDrawColor(self.Colours.DarkerBackground)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintTooltipMinimalBackground(panel, width, height)
|
||||
surface.SetDrawColor(0, 0, 0, 150 * panel.fraction)
|
||||
surface.SetMaterial(gradientRadial)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintSegmentedProgressBackground(panel, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintSegmentedProgress(panel, width, height)
|
||||
local font = panel:GetFont() or self.fontSegmentedProgress
|
||||
local textColor = panel:GetTextColor() or self.Colours.SegmentedProgress.Text
|
||||
local barColor = panel:GetBarColor() or self.Colours.SegmentedProgress.Bar
|
||||
local segments = panel:GetSegments()
|
||||
local segmentHalfWidth = width / #segments * 0.5
|
||||
|
||||
surface.SetDrawColor(barColor)
|
||||
surface.DrawRect(0, 0, panel:GetFraction() * width, height)
|
||||
|
||||
for i = 1, #segments do
|
||||
local text = segments[i]
|
||||
local x = (i - 1) / #segments * width + segmentHalfWidth
|
||||
local y = height * 0.5
|
||||
|
||||
draw.SimpleText(text, font, x, y, textColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintCharacterCreateBackground(panel, width, height)
|
||||
surface.SetDrawColor(40, 40, 40, 255)
|
||||
surface.SetTexture(gradient)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintCharacterLoadBackground(panel, width, height)
|
||||
surface.SetDrawColor(40, 40, 40, panel:GetBackgroundFraction() * 255)
|
||||
surface.SetTexture(gradient)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintCharacterTransitionOverlay(panel, x, y, width, height, color)
|
||||
color = color or ix.config.Get("color")
|
||||
|
||||
surface.SetDrawColor(color)
|
||||
surface.DrawRect(x, y, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintAreaEntry(panel, width, height)
|
||||
local color = ColorAlpha(panel:GetBackgroundColor() or self.Colours.Area.Background, panel:GetBackgroundAlpha())
|
||||
|
||||
self:DrawImportantBackground(0, 0, width, height, color)
|
||||
end
|
||||
|
||||
function SKIN:PaintListRow(panel, width, height)
|
||||
surface.SetDrawColor(0, 0, 0, 150)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintSettingsRowBackground(panel, width, height)
|
||||
local index = panel:GetBackgroundIndex()
|
||||
local bReset = panel:GetShowReset()
|
||||
|
||||
if (index == 0) then
|
||||
surface.SetDrawColor(30, 30, 30, 45)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
if (bReset) then
|
||||
surface.SetDrawColor(self.Colours.Warning)
|
||||
surface.DrawRect(0, 0, 2, height)
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintVScrollBar(panel, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintScrollBarGrip(panel, width, height)
|
||||
local parent = panel:GetParent()
|
||||
local upButtonHeight = parent.btnUp:GetTall()
|
||||
local downButtonHeight = parent.btnDown:GetTall()
|
||||
|
||||
DisableClipping(true)
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawRect(4, -upButtonHeight, width - 8, height + upButtonHeight + downButtonHeight)
|
||||
DisableClipping(false)
|
||||
end
|
||||
|
||||
function SKIN:PaintButtonUp(panel, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintButtonDown(panel, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintComboBox(panel, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintComboDownArrow(panel, width, height)
|
||||
local alpha = (panel.ComboBox:IsMenuOpen() or panel.ComboBox.Hovered) and 200 or 100
|
||||
surface.SetDrawColor(ColorAlpha(Color(255, 255, 255, 255), alpha))
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/mainmenu/charcreation/combodownarrow.png"))
|
||||
surface.DrawTexturedRect(0, height * 0.5 - 5 * 0.5, 9, 5)
|
||||
end
|
||||
|
||||
function SKIN:PaintMenu(panel, width, height)
|
||||
ix.util.DrawBlur(panel)
|
||||
|
||||
surface.SetDrawColor(30, 30, 30, 150)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintMenuOption(panel, width, height)
|
||||
if (panel.m_bBackground and (panel.Hovered or panel.Highlight)) then
|
||||
self:DrawImportantBackground(0, 0, width, height, ix.config.Get("color"))
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintHelixSlider(panel, width, height)
|
||||
surface.SetDrawColor(self.Colours.DarkerBackground)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
surface.SetDrawColor(self.Colours.Success)
|
||||
surface.DrawRect(0, 0, panel:GetVisualFraction() * width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintChatboxTabButton(panel, width, height)
|
||||
if (panel:GetActive()) then
|
||||
surface.SetDrawColor(ix.config.Get("color"))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
else
|
||||
surface.SetDrawColor(0, 0, 0, 100)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function SKIN:PaintChatboxTabs(panel, width, height, alpha)
|
||||
surface.SetDrawColor(0, 0, 0, 33)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
surface.SetDrawColor(0, 0, 0, 100)
|
||||
surface.SetTexture(gradient)
|
||||
surface.DrawTexturedRect(0, height * 0.5, width, height * 0.5)
|
||||
end
|
||||
|
||||
function SKIN:PaintChatboxBackground(self, w, h)
|
||||
local matBlurScreen = Material( "pp/blurscreen" )
|
||||
|
||||
local function Derma_DrawBackgroundBlurInside( panel )
|
||||
local x, y = panel:LocalToScreen( 0, 0 )
|
||||
|
||||
surface.SetMaterial( matBlurScreen )
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
|
||||
for i=0.33, 1, 0.33 do
|
||||
matBlurScreen:SetFloat( "$blur", 5 * i ) -- Increase number 5 for more blur
|
||||
matBlurScreen:Recompute()
|
||||
if ( render ) then render.UpdateScreenEffectTexture() end
|
||||
surface.DrawTexturedRect( x * -1, y * -1, ScrW(), ScrH() )
|
||||
end
|
||||
|
||||
-- The line below gives the background a dark tint
|
||||
surface.SetDrawColor( 10, 10, 10, 150 )
|
||||
surface.DrawRect( x * -1, y * -1, ScrW(), ScrH() )
|
||||
end
|
||||
|
||||
Derma_DrawBackgroundBlurInside( self )
|
||||
end
|
||||
|
||||
function SKIN:PaintChatboxEntry(panel, width, height)
|
||||
surface.SetDrawColor(0, 0, 0, 66)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
panel:DrawTextEntryText(color_white, ix.config.Get("color"), color_white)
|
||||
end
|
||||
|
||||
function SKIN:DrawChatboxPreviewBox(x, y, text, color)
|
||||
color = color or ix.config.Get("color")
|
||||
|
||||
local textWidth, textHeight = surface.GetTextSize(text)
|
||||
local width, height = textWidth + SScaleMin(8 / 3), textHeight + SScaleMin( 8 / 3 )
|
||||
|
||||
-- background
|
||||
surface.SetDrawColor(color)
|
||||
surface.DrawRect(x, y, width, height)
|
||||
|
||||
-- text
|
||||
surface.SetTextColor(color_white)
|
||||
surface.SetTextPos(x + width * 0.5 - textWidth * 0.5, y + height * 0.5 - textHeight * 0.5)
|
||||
surface.DrawText(text)
|
||||
|
||||
return width
|
||||
end
|
||||
|
||||
function SKIN:DrawChatboxPrefixBox(panel, width, height)
|
||||
local color = panel:GetBackgroundColor()
|
||||
|
||||
-- background
|
||||
surface.SetDrawColor(color)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
-- outline
|
||||
surface.SetDrawColor(color.r * 0.5, color.g * 0.5, color.b * 0.5, 255)
|
||||
surface.DrawOutlinedRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
|
||||
function SKIN:PaintChatboxAutocompleteEntry(panel, width, height)
|
||||
-- selected background
|
||||
if (panel.highlightAlpha > 0) then
|
||||
self:DrawImportantBackground(0, 0, width, height, ColorAlpha(ix.config.Get("color"), panel.highlightAlpha * 66))
|
||||
end
|
||||
|
||||
-- lower border
|
||||
surface.SetDrawColor(200, 200, 200, 33)
|
||||
surface.DrawRect(0, height - 1, width, 1)
|
||||
end
|
||||
|
||||
function SKIN:PaintWindowMinimizeButton(panel, width, height)
|
||||
end
|
||||
|
||||
function SKIN:PaintWindowMaximizeButton(panel, width, height)
|
||||
end
|
||||
|
||||
do
|
||||
-- check if sounds exist, otherwise fall back to default UI sounds
|
||||
local bWhoosh = file.Exists("sound/helix/ui/whoosh1.wav", "GAME")
|
||||
local bRollover = file.Exists("sound/helix/ui/rollover.wav", "GAME")
|
||||
local bPress = file.Exists("sound/helix/ui/press.wav", "GAME")
|
||||
local bNotify = file.Exists("sound/helix/ui/REPLACEME.wav", "GAME") -- @todo
|
||||
|
||||
sound.Add({
|
||||
name = "Helix.Whoosh",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 0.4,
|
||||
level = 80,
|
||||
pitch = bWhoosh and {90, 105} or 100,
|
||||
sound = bWhoosh and {
|
||||
"helix/ui/whoosh1.wav",
|
||||
"helix/ui/whoosh2.wav",
|
||||
"helix/ui/whoosh3.wav",
|
||||
"helix/ui/whoosh4.wav",
|
||||
"helix/ui/whoosh5.wav",
|
||||
"helix/ui/whoosh6.wav"
|
||||
} or ""
|
||||
})
|
||||
|
||||
sound.Add({
|
||||
name = "Helix.Rollover",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 0.5,
|
||||
level = 80,
|
||||
pitch = {95, 105},
|
||||
sound = bRollover and "helix/ui/rollover.wav" or "ui/buttonrollover.wav"
|
||||
})
|
||||
|
||||
sound.Add({
|
||||
name = "Helix.Press",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 0.5,
|
||||
level = 80,
|
||||
pitch = bPress and {95, 110} or 100,
|
||||
sound = bPress and "helix/ui/press.wav" or "ui/buttonclickrelease.wav"
|
||||
})
|
||||
|
||||
sound.Add({
|
||||
name = "Helix.Notify",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 0.35,
|
||||
level = 80,
|
||||
pitch = 140,
|
||||
sound = bNotify and "helix/ui/REPLACEME.wav" or "weapons/grenade/tick1.wav"
|
||||
})
|
||||
end
|
||||
|
||||
derma.RefreshSkins()
|
||||
492
gamemodes/helix/plugins/willardinterface/derma/cl_storage.lua
Normal file
492
gamemodes/helix/plugins/willardinterface/derma/cl_storage.lua
Normal file
@@ -0,0 +1,492 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
AccessorFunc(PANEL, "money", "Money", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self:DockPadding(1, 1, 1, 1)
|
||||
self:SetTall(SScaleMin(64 / 3))
|
||||
|
||||
local textPanel = self:Add("EditablePanel")
|
||||
textPanel:Dock(TOP)
|
||||
textPanel:SetTall(SScaleMin(18 / 3))
|
||||
|
||||
self.moneyLabel = textPanel:Add("DLabel")
|
||||
self.moneyLabel:SetFont("MenuFontNoClamp")
|
||||
self.moneyLabel:SetText("")
|
||||
self.moneyLabel:SetTextInset(SScaleMin(2 / 3), 0)
|
||||
|
||||
self.creditText = textPanel:Add("DLabel")
|
||||
self.creditText:Dock(LEFT)
|
||||
self.creditText:SetFont("MenuFontNoClamp")
|
||||
self.creditText:SetText(string.utf8upper(" Crédits"))
|
||||
self.creditText:SetTextInset(SScaleMin(2 / 3), 0)
|
||||
self.creditText:SizeToContents()
|
||||
|
||||
local amountPanel = self:Add("EditablePanel")
|
||||
amountPanel:Dock(FILL)
|
||||
amountPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(35, 35, 35, 85)
|
||||
surface.DrawRect(1, 1, w - 2, h - 2)
|
||||
|
||||
surface.SetDrawColor(80, 80, 80, 255)
|
||||
surface.DrawOutlinedRect(1, 1, w - 2, h - 2)
|
||||
end
|
||||
|
||||
self.amountEntry = amountPanel:Add("DTextEntry")
|
||||
self.amountEntry:SetFont("MenuFontNoClamp")
|
||||
self.amountEntry:Dock(FILL)
|
||||
self.amountEntry:SetNumeric(true)
|
||||
self.amountEntry:SetValue("0")
|
||||
self.amountEntry.Paint = function(this, w, h)
|
||||
this:DrawTextEntryText( Color(255, 255, 255, 255), this:GetHighlightColor(), this:GetCursorColor() )
|
||||
end
|
||||
|
||||
self.transferButton = amountPanel:Add("DButton")
|
||||
self.transferButton:SetFont("ixIconsMedium")
|
||||
self.transferButton:Dock(LEFT)
|
||||
self.transferButton:SetWide(SScaleMin(50 / 3))
|
||||
self:SetLeft(false)
|
||||
self.transferButton.DoClick = function()
|
||||
local amount = math.max(0, math.Round(tonumber(self.amountEntry:GetValue()) or 0))
|
||||
self.amountEntry:SetValue("0")
|
||||
|
||||
if (amount != 0) then
|
||||
self:OnTransfer(amount)
|
||||
end
|
||||
end
|
||||
|
||||
self.bNoBackgroundBlur = true
|
||||
self.transferButton.Paint = nil
|
||||
end
|
||||
|
||||
function PANEL:SetLeft(bValue)
|
||||
if (bValue) then
|
||||
self.transferButton:Dock(RIGHT)
|
||||
self.transferButton:SetText("t")
|
||||
else
|
||||
self.transferButton:Dock(LEFT)
|
||||
self.amountEntry:DockMargin(SScaleMin(10 / 3), 0, 0, 0)
|
||||
self.transferButton:SetText("s")
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetMoney(money)
|
||||
self.money = math.max(math.Round(tonumber(money) or 0), 0)
|
||||
|
||||
self.moneyLabel:SetText(money)
|
||||
self.moneyLabel:Dock(LEFT)
|
||||
self.moneyLabel:SizeToContents()
|
||||
self.moneyLabel:SetTextColor(Color(255, 204, 0, 255))
|
||||
end
|
||||
|
||||
function PANEL:OnTransfer(amount)
|
||||
end
|
||||
|
||||
vgui.Register("ixStorageMoney", PANEL, "EditablePanel")
|
||||
|
||||
DEFINE_BASECLASS("EditablePanel")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "fadeTime", "FadeTime", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "frameMargin", "FrameMargin", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "storageID", "StorageID", FORCE_NUMBER)
|
||||
|
||||
local dividerWidth = SScaleMin(1920 / 3)
|
||||
local dividerHeight = SScaleMin(1080 / 3)
|
||||
local halfWidth = dividerWidth * 0.5
|
||||
|
||||
function PANEL:Init()
|
||||
if (IsValid(ix.gui.openedStorage)) then
|
||||
ix.gui.openedStorage:Remove()
|
||||
end
|
||||
|
||||
ix.gui.openedStorage = self
|
||||
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetFadeTime(0.25)
|
||||
self:SetFrameMargin(4)
|
||||
|
||||
local background = self:Add("EditablePanel")
|
||||
background:SetSize(ScrW(), ScrH())
|
||||
background.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
Derma_DrawBackgroundBlur( this, 1 )
|
||||
end
|
||||
|
||||
background:MakePopup()
|
||||
|
||||
self.dividerPanel = background:Add("EditablePanel")
|
||||
self.dividerPanel:SetSize(dividerWidth, dividerHeight)
|
||||
self.dividerPanel:Center()
|
||||
|
||||
self.leftSide = self.dividerPanel:Add("EditablePanel")
|
||||
self.leftSide:Dock(LEFT)
|
||||
self.leftSide:SetSize(self.dividerPanel:GetWide() * 0.5, dividerHeight)
|
||||
self.leftSide.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawLine(w - 1, SScaleMin(50 / 3), w - 1, h)
|
||||
end
|
||||
|
||||
self.storageIcon = self.dividerPanel:Add("DImage")
|
||||
self.storageIcon:SetSize(SScaleMin(90 / 3), SScaleMin(90 / 3))
|
||||
self.storageIcon:SetImage("willardnetworks/storage/icon.png")
|
||||
self.storageIcon:Center()
|
||||
|
||||
local topbar = background:Add("EditablePanel")
|
||||
topbar:SetSize(background:GetWide(), SScaleMin(50 / 3))
|
||||
topbar:Dock(TOP)
|
||||
topbar.Paint = function( this, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.titleText = topbar:Add("DLabel")
|
||||
self.titleText:SetFont("CharCreationBoldTitleNoClamp")
|
||||
self.titleText:SetText("Conteneur de stockage")
|
||||
self.titleText:SetContentAlignment(5)
|
||||
self.titleText:SizeToContents()
|
||||
self.titleText:Center()
|
||||
|
||||
local exit = topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
exit:DockMargin(0, SScaleMin(15 / 3), SScaleMin(20 / 3), SScaleMin(15 / 3))
|
||||
exit:Dock(RIGHT)
|
||||
exit.DoClick = function()
|
||||
self:Remove()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateContents(data, entity)
|
||||
local isEquipSlots = data and data.vars and data.vars.equipSlots or false
|
||||
|
||||
self.storageInventory = self.dividerPanel:Add(isEquipSlots and "ixEquipSlots" or "ixInventory")
|
||||
self.storageInventory.bNoBackgroundBlur = true
|
||||
self.storageInventory:MoveToBack()
|
||||
self.storageInventory.Close = function(this)
|
||||
net.Start("ixStorageClose")
|
||||
net.SendToServer()
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
hook.Run("CreateStoreViewContents", self, data, entity)
|
||||
if entity and IsValid(entity) then
|
||||
if ix.plugin.list["inventoryslots"] and entity.GetCharacter then
|
||||
if entity:GetCharacter() and ix.plugin.list["inventoryslots"].noEquipFactions[entity:GetCharacter():GetFaction()] then
|
||||
self.storageInventory.isNoEquipFaction = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if !isEquipSlots then
|
||||
self.storageMoney = self.dividerPanel:Add("ixStorageMoney")
|
||||
self.storageMoney:SetVisible(false)
|
||||
self.storageMoney.OnTransfer = function(_, amount)
|
||||
net.Start("ixStorageMoneyTake")
|
||||
net.WriteUInt(self.storageID, 32)
|
||||
net.WriteUInt(amount, 32)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
if (self.storageMoney.creditText) then
|
||||
self.storageMoney.creditText:SetText(" CRÉDITS DANS LE STOCKAGE")
|
||||
self.storageMoney.creditText:SizeToContents()
|
||||
self.storageMoney.creditText:Dock(LEFT)
|
||||
end
|
||||
end
|
||||
|
||||
ix.gui.inv1 = self.leftSide:Add("ixInventory")
|
||||
ix.gui.inv1.bNoBackgroundBlur = true
|
||||
ix.gui.inv1.Close = function(this)
|
||||
net.Start("ixStorageClose")
|
||||
net.SendToServer()
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
ix.gui.equipSlots = self.leftSide:Add("ixEquipSlots")
|
||||
|
||||
self.localMoney = ix.gui.inv1:Add("ixStorageMoney")
|
||||
self.localMoney:SetVisible(false)
|
||||
self.localMoney:SetLeft(true)
|
||||
self.localMoney.OnTransfer = function(_, amount)
|
||||
net.Start("ixStorageMoneyGive")
|
||||
net.WriteUInt(self.storageID, 32)
|
||||
net.WriteUInt(amount, 32)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
self:SetAlpha(0)
|
||||
self:AlphaTo(255, self:GetFadeTime())
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if self.bagFrame and IsValid(self.bagFrame) then
|
||||
self.bagFrame:MoveToFront()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:OnChildAdded(panel)
|
||||
panel:SetPaintedManually(true)
|
||||
end
|
||||
|
||||
function PANEL:OnKeyCodePressed(key)
|
||||
if (key == KEY_TAB and IsValid(self)) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetLocalInventory(inventory)
|
||||
if (IsValid(ix.gui.inv1) and !IsValid(ix.gui.menu)) then
|
||||
ix.gui.inv1:SetInventory(inventory)
|
||||
|
||||
ix.gui.inv1:Center()
|
||||
|
||||
local x2, y2 = ix.gui.inv1:GetPos()
|
||||
|
||||
self.localMoney:Dock(NODOCK)
|
||||
self.localMoney:SetWide(ix.gui.inv1:GetWide())
|
||||
self.localMoney:SetPos(0, ix.gui.inv1:GetTall() + SScaleMin(10 / 3))
|
||||
|
||||
local padding = SScaleMin(10 / 3)
|
||||
|
||||
ix.gui.inv1.invTitleIcon = self.dividerPanel:Add("DImage")
|
||||
ix.gui.inv1.invTitleIcon:SetImage("willardnetworks/tabmenu/navicons/inventory.png")
|
||||
ix.gui.inv1.invTitleIcon:SetSize(SScaleMin(19 / 3), SScaleMin(17 / 3))
|
||||
ix.gui.inv1.invTitleIcon:SetPos(x2, y2 - ix.gui.inv1.invTitleIcon:GetTall() - padding)
|
||||
|
||||
ix.gui.inv1.invTitle = self.dividerPanel:Add("DLabel")
|
||||
ix.gui.inv1.invTitle:SetFont("TitlesFontNoClamp")
|
||||
ix.gui.inv1.invTitle:SetText("Inventaire")
|
||||
ix.gui.inv1.invTitle:SizeToContents()
|
||||
ix.gui.inv1.invTitle:SetPos(x2 + SScaleMin(27 / 3), y2 - (ix.gui.inv1.invTitle:GetTall() * 0.8) - padding)
|
||||
ix.gui.inv1:MoveToBack()
|
||||
|
||||
self.changeInv = self.dividerPanel:Add("DButton")
|
||||
self.changeInv:SetFont("MenuFontNoClamp")
|
||||
self.changeInv:SetText("VOIR INVENTAIRE DES ÉQUIPEMENTS")
|
||||
self.changeInv:SizeToContents()
|
||||
self.changeInv:SetWide(self.changeInv:GetWide() + (padding * 2))
|
||||
self.changeInv:SetPos(x2 + ix.gui.inv1:GetWide() - self.changeInv:GetWide(), y2 - (ix.gui.inv1.invTitle:GetTall() * 0.8) - padding)
|
||||
self.changeInv.DoClick = function()
|
||||
if !ix.gui.inv1 or ix.gui.inv1 and !IsValid(ix.gui.inv1) then return end
|
||||
if !ix.gui.equipSlots or ix.gui.equipSlots and !IsValid(ix.gui.equipSlots) then return end
|
||||
|
||||
if ix.gui.inv1:IsVisible() then
|
||||
ix.gui.inv1:SetVisible(false)
|
||||
ix.gui.inv1.invTitleIcon:SetVisible(false)
|
||||
ix.gui.inv1.invTitle:SetVisible(false)
|
||||
|
||||
ix.gui.equipSlots:SetVisible(true)
|
||||
ix.gui.equipSlots.invTitleIcon:SetVisible(true)
|
||||
ix.gui.equipSlots.invTitle:SetVisible(true)
|
||||
|
||||
local _, y3 = ix.gui.equipSlots:GetPos()
|
||||
self.changeInv:SetText("VOIR L'INVENTAIRE PAR DÉFAUT")
|
||||
self.changeInv:SizeToContents()
|
||||
self.changeInv:SetWide(self.changeInv:GetWide() + (padding * 2))
|
||||
|
||||
-- Get the new pos if we need the button in the alternate position
|
||||
if (self.changeInv.altPos) then
|
||||
x2, y2 = ix.gui.inv1:GetPos()
|
||||
end
|
||||
|
||||
self.changeInv:SetPos(x2 + ix.gui.inv1:GetWide() - self.changeInv:GetWide(), y3 - (ix.gui.inv1.invTitle:GetTall() * 0.8) - padding)
|
||||
else
|
||||
ix.gui.equipSlots:SetVisible(false)
|
||||
ix.gui.equipSlots.invTitleIcon:SetVisible(false)
|
||||
ix.gui.equipSlots.invTitle:SetVisible(false)
|
||||
|
||||
ix.gui.inv1:SetVisible(true)
|
||||
ix.gui.inv1.invTitleIcon:SetVisible(true)
|
||||
ix.gui.inv1.invTitle:SetVisible(true)
|
||||
|
||||
self.changeInv:SetText("VOIR L'INVENTAIRE DES ÉQUIPEMENTS")
|
||||
self.changeInv:SizeToContents()
|
||||
self.changeInv:SetWide(self.changeInv:GetWide() + (padding * 2))
|
||||
|
||||
-- Get the new pos if we need the button in the alternate position
|
||||
if (self.changeInv.altPos) then
|
||||
x2, y2 = ix.gui.inv1:GetPos()
|
||||
end
|
||||
|
||||
self.changeInv:SetPos(x2 + ix.gui.inv1:GetWide() - self.changeInv:GetWide(), y2 - (ix.gui.inv1.invTitle:GetTall() * 0.8) - padding)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetEquipInv(inventory)
|
||||
if (IsValid(ix.gui.equipSlots) and !IsValid(ix.gui.menu)) then
|
||||
ix.gui.equipSlots:SetInventory(inventory)
|
||||
ix.gui.equipSlots:PaintParts()
|
||||
ix.gui["inv" .. inventory.id] = ix.gui.equipSlots
|
||||
|
||||
ix.gui.equipSlots:Center()
|
||||
|
||||
local x2, y2 = ix.gui.equipSlots:GetPos()
|
||||
local padding = SScaleMin(10 / 3)
|
||||
|
||||
ix.gui.equipSlots.invTitleIcon = self.dividerPanel:Add("DImage")
|
||||
ix.gui.equipSlots.invTitleIcon:SetImage("willardnetworks/tabmenu/navicons/inventory.png")
|
||||
ix.gui.equipSlots.invTitleIcon:SetSize(SScaleMin(19 / 3), SScaleMin(17 / 3))
|
||||
ix.gui.equipSlots.invTitleIcon:SetPos(x2, y2 - ix.gui.equipSlots.invTitleIcon:GetTall() - padding)
|
||||
|
||||
ix.gui.equipSlots.invTitle = self.dividerPanel:Add("DLabel")
|
||||
ix.gui.equipSlots.invTitle:SetFont("TitlesFontNoClamp")
|
||||
ix.gui.equipSlots.invTitle:SetText("Inventaire des équipements")
|
||||
ix.gui.equipSlots.invTitle:SizeToContents()
|
||||
ix.gui.equipSlots.invTitle:SetPos(x2 + SScaleMin(27 / 3), y2 - (ix.gui.equipSlots.invTitle:GetTall() * 0.8) - padding)
|
||||
|
||||
ix.gui.equipSlots:MoveToBack()
|
||||
ix.gui.equipSlots:SetVisible(false)
|
||||
ix.gui.equipSlots.invTitleIcon:SetVisible(false)
|
||||
ix.gui.equipSlots.invTitle:SetVisible(false)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetLocalMoney(money)
|
||||
if (!self.localMoney:IsVisible()) then
|
||||
self.localMoney:SetVisible(true)
|
||||
ix.gui.inv1:SetTall(ix.gui.inv1:GetTall() + self.localMoney:GetTall() + SScaleMin(10 / 3))
|
||||
end
|
||||
|
||||
self.localMoney:SetMoney(money)
|
||||
end
|
||||
|
||||
function PANEL:SetStorageTitle(title)
|
||||
end
|
||||
|
||||
function PANEL:SetStorageInventory(inventory)
|
||||
local isEquipSlots = inventory and inventory.vars and inventory.vars.equipSlots or false
|
||||
local isStash = inventory and inventory.vars and inventory.vars.isStash or false
|
||||
local isBag = inventory and inventory.vars and inventory.vars.noEquipInv or false
|
||||
local isCardDeck = inventory and inventory.w == 13 and inventory.h == 4 and true or false -- I know this is dumb, but helix has forced my hand.
|
||||
self.storageInventory:SetInventory(inventory)
|
||||
|
||||
if (isEquipSlots) then
|
||||
self.storageInventory:PaintParts()
|
||||
if self.changeInv then self.changeInv:SetVisible(false) end
|
||||
end
|
||||
|
||||
self.storageInventory:SetPos(halfWidth + (halfWidth * (isCardDeck and 0.335 or 0.5)) - self.storageInventory:GetWide() * 0.5, dividerHeight * 0.5 - self.storageInventory:GetTall() * 0.5)
|
||||
|
||||
if (!isEquipSlots) then
|
||||
local x2, y2 = self.storageInventory:GetPos()
|
||||
|
||||
self.storageMoney:Dock(NODOCK)
|
||||
self.storageMoney:SetWide(self.storageInventory:GetWide())
|
||||
self.storageMoney:SetPos(x2, y2 + self.storageInventory:GetTall() + SScaleMin(10 / 3))
|
||||
end
|
||||
|
||||
if (isCardDeck) then -- Force some things to move around.
|
||||
self.leftSide:SetSize(self.dividerPanel:GetWide() * 0.335, dividerHeight)
|
||||
|
||||
ix.gui.inv1:Center()
|
||||
ix.gui.equipSlots:Center()
|
||||
|
||||
local x2, y2 = ix.gui.inv1:GetPos()
|
||||
local padding = SScaleMin(10 / 3)
|
||||
|
||||
ix.gui.inv1.invTitleIcon:SetPos(x2, y2 - ix.gui.inv1.invTitleIcon:GetTall() - padding)
|
||||
ix.gui.inv1.invTitle:SetPos(x2 + SScaleMin(27 / 3), y2 - (ix.gui.inv1.invTitle:GetTall() * 0.8) - padding)
|
||||
|
||||
self.changeInv.altPos = true
|
||||
self.changeInv:SetPos(x2 + ix.gui.inv1:GetWide() - self.changeInv:GetWide(), y2 - (ix.gui.inv1.invTitle:GetTall() * 0.8) - padding)
|
||||
|
||||
x2, y2 = ix.gui.equipSlots:GetPos()
|
||||
|
||||
ix.gui.equipSlots.invTitleIcon:SetPos(x2, y2 - ix.gui.equipSlots.invTitleIcon:GetTall() - padding)
|
||||
ix.gui.equipSlots.invTitle:SetPos(x2 + SScaleMin(27 / 3), y2 - (ix.gui.equipSlots.invTitle:GetTall() * 0.8) - padding)
|
||||
|
||||
self.storageIcon:SetX(self.dividerPanel:GetWide() * 0.335 - (SScaleMin(90 / 3) * 0.5))
|
||||
end
|
||||
|
||||
local x, y = self.storageInventory:GetPos()
|
||||
local padding = SScaleMin(10 / 3)
|
||||
|
||||
local invTitleIcon = self.dividerPanel:Add("DImage")
|
||||
invTitleIcon:SetImage("willardnetworks/mainmenu/content.png")
|
||||
invTitleIcon:SetSize(SScaleMin(16 / 3), SScaleMin(16 / 3))
|
||||
invTitleIcon:SetPos(x, y - invTitleIcon:GetTall() - padding)
|
||||
|
||||
local invTitle = self.dividerPanel:Add("DLabel")
|
||||
invTitle:SetFont("TitlesFontNoClamp")
|
||||
invTitle:SetText("Stockage")
|
||||
invTitle:SizeToContents()
|
||||
invTitle:SetPos(x + SScaleMin(27 / 3), y - (invTitle:GetTall() * 0.8) - padding)
|
||||
|
||||
ix.gui["inv" .. inventory:GetID()] = self.storageInventory
|
||||
|
||||
if (inventory.owner and !isStash and !isBag) then
|
||||
self.changeStorageInv = self.dividerPanel:Add("DButton")
|
||||
self.changeStorageInv:SetFont("MenuFontNoClamp")
|
||||
self.changeStorageInv:SetText(!isEquipSlots and "VOIR L'INVENTAIRE DES ÉQUIPEMENTS" or "AFFICHER L'INVENTAIRE PAR DÉFAUT")
|
||||
self.changeStorageInv:SizeToContents()
|
||||
self.changeStorageInv:SetWide(self.changeStorageInv:GetWide() + (padding * 2))
|
||||
self.changeStorageInv:SetPos(x + self.storageInventory:GetWide() - self.changeStorageInv:GetWide(), y - (invTitle:GetTall() * 0.8) - padding)
|
||||
self.changeStorageInv.DoClick = function()
|
||||
if (!IsValid(ix.gui.menu)) then
|
||||
self.shouldntRunStorage = true
|
||||
|
||||
BaseClass.Remove(self)
|
||||
self.storageInventory:Remove()
|
||||
ix.gui.inv1:Remove()
|
||||
|
||||
net.Start("ixSwitchPlayerInv")
|
||||
net.SendToServer()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetStorageMoney(money)
|
||||
if !self.storageMoney then return end
|
||||
|
||||
if (!self.storageMoney:IsVisible()) then
|
||||
self.storageMoney:SetVisible(true)
|
||||
self.storageInventory:SetTall(self.storageInventory:GetTall() + self.storageMoney:GetTall() + SScaleMin(2 / 3))
|
||||
end
|
||||
|
||||
self.storageMoney:SetMoney(money)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
ix.util.DrawBlurAt(0, 0, width, height)
|
||||
|
||||
for _, v in ipairs(self:GetChildren()) do
|
||||
v:PaintManual()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
self:SetAlpha(255)
|
||||
self:AlphaTo(0, self:GetFadeTime(), 0, function()
|
||||
BaseClass.Remove(self)
|
||||
end)
|
||||
end
|
||||
|
||||
function PANEL:OnRemove()
|
||||
if (!IsValid(ix.gui.menu) and !self.shouldntRunStorage) then
|
||||
self.storageInventory:Remove()
|
||||
ix.gui.inv1:Remove()
|
||||
|
||||
net.Start("ixStorageClose")
|
||||
net.SendToServer()
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixStorageView", PANEL, "EditablePanel")
|
||||
314
gamemodes/helix/plugins/willardinterface/derma/cl_subpanel.lua
Normal file
314
gamemodes/helix/plugins/willardinterface/derma/cl_subpanel.lua
Normal file
@@ -0,0 +1,314 @@
|
||||
--[[
|
||||
| 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 DEFAULT_PADDING = 0
|
||||
local DEFAULT_ANIMATION_TIME = 1
|
||||
local DEFAULT_SUBPANEL_ANIMATION_TIME = 0.5
|
||||
|
||||
-- parent subpanel
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
end
|
||||
|
||||
function PANEL:SetTitle(text, bNoTranslation, bNoUpper)
|
||||
if (text == nil) then
|
||||
if (IsValid(self.title)) then
|
||||
self.title:Remove()
|
||||
end
|
||||
|
||||
return
|
||||
elseif (!IsValid(self.title)) then
|
||||
self.title = self:Add("DLabel")
|
||||
self.title:SetFont("ixTitleFont")
|
||||
self.title:SizeToContents()
|
||||
self.title:SetTextColor(ix.config.Get("color") or color_white)
|
||||
end
|
||||
|
||||
local newText = bNoTranslation and text or L(text)
|
||||
newText = bNoUpper and newText or newText:utf8upper()
|
||||
|
||||
self.title:SetText(newText)
|
||||
self.title:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:SetLeftPanel(panel)
|
||||
self.left = panel
|
||||
end
|
||||
|
||||
function PANEL:GetLeftPanel()
|
||||
return self.left
|
||||
end
|
||||
|
||||
function PANEL:SetRightPanel(panel)
|
||||
self.right = panel
|
||||
end
|
||||
|
||||
function PANEL:GetRightPanel()
|
||||
return self.right
|
||||
end
|
||||
|
||||
function PANEL:OnSetActive()
|
||||
end
|
||||
|
||||
vgui.Register("ixSubpanel", PANEL, "EditablePanel")
|
||||
|
||||
-- subpanel parent
|
||||
DEFINE_BASECLASS("EditablePanel")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "padding", "Padding", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "animationTime", "AnimationTime", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "subpanelAnimationTime", "SubpanelAnimationTime", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "leftOffset", "LeftOffset", FORCE_NUMBER)
|
||||
|
||||
function PANEL:Init()
|
||||
self.subpanels = {}
|
||||
self.childPanels = {}
|
||||
|
||||
self.currentSubpanelX = DEFAULT_PADDING
|
||||
self.targetSubpanelX = DEFAULT_PADDING
|
||||
self.padding = 0
|
||||
self.leftOffset = 0
|
||||
|
||||
self.animationTime = DEFAULT_ANIMATION_TIME
|
||||
self.subpanelAnimationTime = DEFAULT_SUBPANEL_ANIMATION_TIME
|
||||
end
|
||||
|
||||
function PANEL:SetPadding(amount, bSetDockPadding)
|
||||
self.currentSubpanelX = amount
|
||||
self.targetSubpanelX = amount
|
||||
self.padding = 0
|
||||
|
||||
if (bSetDockPadding) then
|
||||
self:DockPadding(0, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Add(name)
|
||||
local panel = BaseClass.Add(self, name)
|
||||
|
||||
if (panel.SetPaintedManually) then
|
||||
panel:SetPaintedManually(true)
|
||||
self.childPanels[#self.childPanels + 1] = panel
|
||||
end
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:AddSubpanel(name)
|
||||
local id = #self.subpanels + 1
|
||||
local panel = BaseClass.Add(self, "ixSubpanel")
|
||||
panel.subpanelName = name
|
||||
panel.subpanelID = id
|
||||
panel:SetTitle(name)
|
||||
|
||||
self.subpanels[id] = panel
|
||||
self:SetupSubpanelReferences()
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:SetupSubpanelReferences()
|
||||
local lastPanel
|
||||
|
||||
for i = 1, #self.subpanels do
|
||||
local panel = self.subpanels[i]
|
||||
local nextPanel = self.subpanels[i + 1]
|
||||
|
||||
if (IsValid(lastPanel)) then
|
||||
lastPanel:SetRightPanel(panel)
|
||||
panel:SetLeftPanel(lastPanel)
|
||||
end
|
||||
|
||||
if (IsValid(nextPanel)) then
|
||||
panel:SetRightPanel(nextPanel)
|
||||
end
|
||||
|
||||
lastPanel = panel
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetSubpanelPos(id, x)
|
||||
local currentPanel = self.subpanels[id]
|
||||
|
||||
if (!currentPanel) then
|
||||
return
|
||||
end
|
||||
|
||||
local paddingW = (ScrW() - currentPanel:GetWide()) / 2
|
||||
local topPushDown = ScreenScale(75 / 3)
|
||||
|
||||
if currentPanel.avoidPadding != true then
|
||||
currentPanel:SetPos(paddingW, topPushDown)
|
||||
end
|
||||
|
||||
local _, oldY = currentPanel:GetPos()
|
||||
currentPanel:SetPos(x, oldY)
|
||||
|
||||
-- traverse left
|
||||
while (IsValid(currentPanel)) do
|
||||
local left = currentPanel:GetLeftPanel()
|
||||
|
||||
if (IsValid(left)) then
|
||||
left:MoveLeftOf(currentPanel, self.padding + self.leftOffset)
|
||||
end
|
||||
|
||||
currentPanel = left
|
||||
end
|
||||
|
||||
currentPanel = self.subpanels[id]
|
||||
|
||||
-- traverse right
|
||||
while (IsValid(currentPanel)) do
|
||||
local right = currentPanel:GetRightPanel()
|
||||
|
||||
if (IsValid(right)) then
|
||||
right:MoveRightOf(currentPanel, self.padding)
|
||||
end
|
||||
|
||||
currentPanel = right
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SetActiveSubpanel(id, length)
|
||||
if (isstring(id)) then
|
||||
for i = 1, #self.subpanels do
|
||||
if (self.subpanels[i].subpanelName == id) then
|
||||
id = i
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local activePanel = self.subpanels[id]
|
||||
|
||||
if (!activePanel) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (length == 0 or !self.activeSubpanel) then
|
||||
self:SetSubpanelPos(id, self.padding + self.leftOffset)
|
||||
else
|
||||
local x, _ = activePanel:GetPos()
|
||||
local target = self.targetSubpanelX + self.leftOffset
|
||||
self.currentSubpanelX = x + self.padding + self.leftOffset
|
||||
|
||||
self:CreateAnimation(length or self.subpanelAnimationTime, {
|
||||
index = 420,
|
||||
target = {currentSubpanelX = target},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetSubpanelPos(id, panel.currentSubpanelX)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
panel:SetSubpanelPos(id, target)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
self.activeSubpanel = id
|
||||
activePanel:OnSetActive()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function PANEL:GetSubpanel(id)
|
||||
return self.subpanels[id]
|
||||
end
|
||||
|
||||
function PANEL:GetActiveSubpanel()
|
||||
return self.subpanels[self.activeSubpanel]
|
||||
end
|
||||
|
||||
function PANEL:GetActiveSubpanelID()
|
||||
return self.activeSubpanel
|
||||
end
|
||||
|
||||
function PANEL:Slide(direction, length, callback, bIgnoreConfig)
|
||||
local _, height = self:GetParent():GetSize()
|
||||
local x, _ = self:GetPos()
|
||||
local targetY = direction == "up" and 0 or height
|
||||
|
||||
self:SetVisible(true)
|
||||
|
||||
if (length == 0) then
|
||||
self:SetPos(x, targetY)
|
||||
else
|
||||
length = length or self.animationTime
|
||||
self.currentY = direction == "up" and height or 0
|
||||
|
||||
self:CreateAnimation(length or self.animationTime, {
|
||||
index = -1,
|
||||
target = {currentY = targetY},
|
||||
easing = "outExpo",
|
||||
bIgnoreConfig = bIgnoreConfig,
|
||||
|
||||
Think = function(animation, panel)
|
||||
local currentX, _ = panel:GetPos()
|
||||
|
||||
panel:SetPos(currentX, panel.currentY)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
if (direction == "down") then
|
||||
panel:SetVisible(false)
|
||||
end
|
||||
|
||||
if (callback) then
|
||||
callback(panel)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SlideUp(...)
|
||||
self:SetMouseInputEnabled(true)
|
||||
self:SetKeyboardInputEnabled(true)
|
||||
|
||||
self:OnSlideUp()
|
||||
self:Slide("up", ...)
|
||||
end
|
||||
|
||||
function PANEL:SlideDown(...)
|
||||
self:SetMouseInputEnabled(false)
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
|
||||
self:OnSlideDown()
|
||||
self:Slide("down", ...)
|
||||
end
|
||||
|
||||
function PANEL:OnSlideUp()
|
||||
end
|
||||
|
||||
function PANEL:OnSlideDown()
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
for i = 1, #self.childPanels do
|
||||
self.childPanels[i]:PaintManual()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:PaintSubpanels(width, height)
|
||||
for i = 1, #self.subpanels do
|
||||
self.subpanels[i]:PaintManual()
|
||||
end
|
||||
end
|
||||
|
||||
-- ????
|
||||
PANEL.Remove = BaseClass.Remove
|
||||
|
||||
vgui.Register("ixSubpanelParent", PANEL, "EditablePanel")
|
||||
603
gamemodes/helix/plugins/willardinterface/derma/cl_tooltip.lua
Normal file
603
gamemodes/helix/plugins/willardinterface/derma/cl_tooltip.lua
Normal file
@@ -0,0 +1,603 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
--- Text container for `ixTooltip`.
|
||||
-- Rows are the main way of interacting with `ixTooltip`s. These derive from
|
||||
-- [DLabel](https://wiki.garrysmod.com/page/Category:DLabel) panels, which means that making use of this panel
|
||||
-- will be largely the same as any DLabel panel.
|
||||
-- @panel ixTooltipRow
|
||||
|
||||
local animationTime = 1
|
||||
|
||||
-- panel meta
|
||||
do
|
||||
local PANEL = FindMetaTable("Panel")
|
||||
local ixChangeTooltip = ChangeTooltip
|
||||
local ixRemoveTooltip = RemoveTooltip
|
||||
local tooltip
|
||||
local lastHover
|
||||
|
||||
function PANEL:SetHelixTooltip(callback)
|
||||
self:SetMouseInputEnabled(true)
|
||||
self.ixTooltip = callback
|
||||
end
|
||||
|
||||
function ChangeTooltip(panel, ...) -- luacheck: globals ChangeTooltip
|
||||
if (!panel.ixTooltip) then
|
||||
return ixChangeTooltip(panel, ...)
|
||||
end
|
||||
|
||||
RemoveTooltip()
|
||||
|
||||
timer.Create("ixTooltip", 0.1, 1, function()
|
||||
if (!IsValid(panel) or lastHover != panel) then
|
||||
return
|
||||
end
|
||||
|
||||
tooltip = vgui.Create("ixTooltip")
|
||||
panel.ixTooltip(tooltip)
|
||||
tooltip:SizeToContents()
|
||||
end)
|
||||
|
||||
lastHover = panel
|
||||
end
|
||||
|
||||
function RemoveTooltip() -- luacheck: globals RemoveTooltip
|
||||
if (IsValid(tooltip)) then
|
||||
tooltip:Remove()
|
||||
tooltip = nil
|
||||
end
|
||||
|
||||
timer.Remove("ixTooltip")
|
||||
lastHover = nil
|
||||
|
||||
return ixRemoveTooltip()
|
||||
end
|
||||
end
|
||||
|
||||
DEFINE_BASECLASS("DLabel")
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "backgroundColor", "BackgroundColor")
|
||||
AccessorFunc(PANEL, "maxWidth", "MaxWidth", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "bNoMinimal", "MinimalHidden", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetFont("ixSmallFont")
|
||||
self:SetText(L("unknown"))
|
||||
self:SetTextColor(color_white)
|
||||
self:SetTextInset(15, 0)
|
||||
self:SetContentAlignment(4)
|
||||
self:Dock(TOP)
|
||||
|
||||
self.maxWidth = ScrW() * 0.2
|
||||
self.bNoMinimal = false
|
||||
self.bMinimal = false
|
||||
end
|
||||
|
||||
--- Whether or not this tooltip row should be displayed in a minimal format. This usually means no background and/or
|
||||
-- smaller font. You probably won't need this if you're using regular `ixTooltipRow` panels, but you should take into
|
||||
-- account if you're creating your own panels that derive from `ixTooltipRow`.
|
||||
-- @realm client
|
||||
-- @treturn bool True if this tooltip row should be displayed in a minimal format
|
||||
function PANEL:IsMinimal()
|
||||
return self.bMinimal
|
||||
end
|
||||
|
||||
--- Sets this row to be more prominent with a larger font and more noticable background color. This should usually
|
||||
-- be used once per tooltip as a title row. For example, item tooltips have one "important" row consisting of the
|
||||
-- item's name. Note that this function is a fire-and-forget function; you cannot revert a row back to it's regular state
|
||||
-- unless you set the font/colors manually.
|
||||
-- @realm client
|
||||
function PANEL:SetImportant()
|
||||
self:SetFont("TitlesFontNoClamp")
|
||||
self:SetBackgroundColor(ix.config.Get("color"))
|
||||
end
|
||||
|
||||
--- Sets the background color of this row. This should be used sparingly to avoid overwhelming players with a
|
||||
-- bunch of different colors that could convey different meanings.
|
||||
-- @realm client
|
||||
-- @color color New color of the background. The alpha is clamped to 100-255 to ensure visibility
|
||||
function PANEL:SetBackgroundColor(color)
|
||||
color = table.Copy(color)
|
||||
color.a = math.min(color.a or 255, 100)
|
||||
|
||||
self.backgroundColor = color
|
||||
end
|
||||
|
||||
--- Resizes this panel to fit its contents. This should be called after setting the text.
|
||||
-- @realm client
|
||||
function PANEL:SizeToContents()
|
||||
local contentWidth, contentHeight = self:GetContentSize()
|
||||
contentWidth = contentWidth
|
||||
contentHeight = contentHeight
|
||||
|
||||
if (contentWidth > self.maxWidth) then
|
||||
self:SetWide(self.maxWidth - 15) -- to account for text inset
|
||||
self:SetTextInset(15, 0)
|
||||
self:SetWrap(true)
|
||||
|
||||
self:SizeToContentsY()
|
||||
self:SetWide(self:GetContentSize() + 15)
|
||||
else
|
||||
self:SetSize(contentWidth + 15, contentHeight + 15)
|
||||
end
|
||||
end
|
||||
|
||||
--- Resizes the height of this panel to fit its contents.
|
||||
-- @internal
|
||||
-- @realm client
|
||||
function PANEL:SizeToContentsY()
|
||||
BaseClass.SizeToContentsY(self)
|
||||
self:SetTall(self:GetTall() + 15)
|
||||
end
|
||||
|
||||
--- Called when the background of this row should be painted. This will paint the background with the
|
||||
-- `DrawImportantBackground` function set in the skin by default.
|
||||
-- @realm client
|
||||
-- @number width Width of the panel
|
||||
-- @number height Height of the panel
|
||||
function PANEL:PaintBackground(width, height)
|
||||
if (self.backgroundColor) then
|
||||
derma.SkinFunc("DrawImportantBackground", 0, 0, width, height, self.backgroundColor)
|
||||
end
|
||||
end
|
||||
|
||||
--- Called when the foreground of this row should be painted. If you are overriding this in a subclassed panel,
|
||||
-- make sure you call `ixTooltipRow:PaintBackground` at the *beginning* of your function to make its style
|
||||
-- consistent with the rest of the framework.
|
||||
-- @realm client
|
||||
-- @number width Width of the panel
|
||||
-- @number height Height of the panel
|
||||
function PANEL:Paint(width, height)
|
||||
self:PaintBackground(width, height)
|
||||
end
|
||||
|
||||
vgui.Register("ixTooltipRow", PANEL, "DLabel")
|
||||
|
||||
--- Generic information panel.
|
||||
-- Tooltips are used extensively throughout Helix: for item information, character displays, entity status, etc.
|
||||
-- The tooltip system can be used on any panel or entity you would like to show standardized information for. Tooltips
|
||||
-- consist of the parent container panel (`ixTooltip`), which is filled with rows of information (usually
|
||||
-- `ixTooltipRow`, but can be any docked panel if non-text information needs to be shown, like an item's size).
|
||||
--
|
||||
-- Tooltips can be added to panel with `panel:SetHelixTooltip()`. An example taken from the scoreboard:
|
||||
-- panel:SetHelixTooltip(function(tooltip)
|
||||
-- local name = tooltip:AddRow("name")
|
||||
-- name:SetImportant()
|
||||
-- name:SetText(client:SteamName())
|
||||
-- name:SetBackgroundColor(team.GetColor(client:Team()))
|
||||
-- name:SizeToContents()
|
||||
--
|
||||
-- tooltip:SizeToContents()
|
||||
-- end)
|
||||
-- @panel ixTooltip
|
||||
DEFINE_BASECLASS("Panel")
|
||||
PANEL = {}
|
||||
|
||||
AccessorFunc(PANEL, "entity", "Entity")
|
||||
AccessorFunc(PANEL, "mousePadding", "MousePadding", FORCE_NUMBER)
|
||||
AccessorFunc(PANEL, "bDrawArrow", "DrawArrow", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "arrowColor", "ArrowColor")
|
||||
AccessorFunc(PANEL, "bHideArrowWhenRaised", "HideArrowWhenRaised", FORCE_BOOL)
|
||||
AccessorFunc(PANEL, "bArrowFollowEntity", "ArrowFollowEntity", FORCE_BOOL)
|
||||
|
||||
function PANEL:Init()
|
||||
self.fraction = 0
|
||||
self.mousePadding = 16
|
||||
self.arrowColor = ix.config.Get("color")
|
||||
self.bHideArrowWhenRaised = true
|
||||
self.bArrowFollowEntity = true
|
||||
self.bMinimal = false
|
||||
|
||||
self.lastX, self.lastY = self:GetCursorPosition()
|
||||
self.arrowX, self.arrowY = ScrW() * 0.5, ScrH() * 0.5
|
||||
|
||||
self:SetAlpha(0)
|
||||
self:SetSize(0, 0)
|
||||
self:SetDrawOnTop(true)
|
||||
|
||||
self:CreateAnimation(animationTime, {
|
||||
index = 1,
|
||||
target = {fraction = 1},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.fraction * 255)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
--- Whether or not this tooltip should be displayed in a minimal format.
|
||||
-- @realm client
|
||||
-- @treturn bool True if this tooltip should be displayed in a minimal format
|
||||
-- @see ixTooltipRow:IsMinimal
|
||||
function PANEL:IsMinimal()
|
||||
return self.bMinimal
|
||||
end
|
||||
|
||||
-- ensure all children are painted manually
|
||||
function PANEL:Add(...)
|
||||
local panel = BaseClass.Add(self, ...)
|
||||
panel:SetPaintedManually(true)
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
--- Creates a new `ixTooltipRow` panel and adds it to the bottom of this tooltip.
|
||||
-- @realm client
|
||||
-- @string id Name of the new row. This is used to reorder rows if needed
|
||||
-- @treturn panel Created row
|
||||
function PANEL:AddRow(id)
|
||||
local panel = self:Add("ixTooltipRow")
|
||||
panel.id = id
|
||||
panel:SetZPos(#self:GetChildren() * 10)
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
--- Creates a new `ixTooltipRow` and adds it after the row with the given `id`. The order of the rows is set via
|
||||
-- setting the Z position of the panels, as this is how VGUI handles ordering with docked panels.
|
||||
-- @realm client
|
||||
-- @string after Name of the row to insert after
|
||||
-- @string id Name of the newly created row
|
||||
-- @treturn panel Created row
|
||||
function PANEL:AddRowAfter(after, id)
|
||||
local panel = self:AddRow(id)
|
||||
after = self:GetRow(after)
|
||||
|
||||
if (!IsValid(after)) then
|
||||
return panel
|
||||
end
|
||||
|
||||
panel:SetZPos(after:GetZPos() + 1)
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
--- Sets the entity associated with this tooltip. Note that this function is not how you get entities to show tooltips.
|
||||
-- @internal
|
||||
-- @realm client
|
||||
-- @entity entity Entity to associate with this tooltip
|
||||
function PANEL:SetEntity(entity)
|
||||
if (!IsValid(entity)) then
|
||||
self.bEntity = false
|
||||
return
|
||||
end
|
||||
|
||||
-- don't show entity tooltips if we have an entity menu open
|
||||
if (IsValid(ix.menu.panel)) then
|
||||
self:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
if (entity:IsPlayer()) then
|
||||
local character = entity:GetCharacter()
|
||||
|
||||
if (character) then
|
||||
-- we want to group things that will most likely have backgrounds (e.g name/health status)
|
||||
hook.Run("PopulateImportantCharacterInfo", entity, character, self)
|
||||
hook.Run("PopulateCharacterInfo", entity, character, self)
|
||||
end
|
||||
else
|
||||
if (entity.OnPopulateEntityInfo) then
|
||||
entity:OnPopulateEntityInfo(self)
|
||||
else
|
||||
hook.Run("PopulateEntityInfo", entity, self)
|
||||
end
|
||||
end
|
||||
|
||||
self:SizeToContents()
|
||||
|
||||
self.entity = entity
|
||||
self.bEntity = true
|
||||
end
|
||||
|
||||
function PANEL:PaintUnder(width, height)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
self:PaintUnder()
|
||||
|
||||
-- directional arrow
|
||||
self.bRaised = LocalPlayer():IsWepRaised()
|
||||
|
||||
if (!self.bClosing) then
|
||||
if (self.bEntity and IsValid(self.entity) and self.bArrowFollowEntity) then
|
||||
local entity = self.entity
|
||||
local position = select(1, entity:GetBonePosition(entity:LookupBone("ValveBiped.Bip01_Spine") or -1)) or
|
||||
entity:LocalToWorld(entity:OBBCenter())
|
||||
|
||||
position = position:ToScreen()
|
||||
self.arrowX = math.Clamp(position.x, 0, ScrW())
|
||||
self.arrowY = math.Clamp(position.y, 0, ScrH())
|
||||
end
|
||||
end
|
||||
|
||||
-- arrow
|
||||
if (self.bDrawArrow or (self.bDrawArrow and self.bRaised and !self.bHideArrowWhenRaised)) then
|
||||
local x, y = self:ScreenToLocal(self.arrowX, self.arrowY)
|
||||
|
||||
DisableClipping(true)
|
||||
surface.SetDrawColor(self.arrowColor)
|
||||
surface.DrawLine(0, 0, x * self.fraction, y * self.fraction)
|
||||
surface.DrawRect((x - 2) * self.fraction, (y - 2) * self.fraction, 15, 15)
|
||||
DisableClipping(false)
|
||||
end
|
||||
|
||||
-- contents
|
||||
local x, y = self:GetPos()
|
||||
|
||||
render.SetScissorRect(x, y, x + width * self.fraction, y + height, true)
|
||||
derma.SkinFunc("PaintTooltipBackground", self, width, height)
|
||||
|
||||
for _, v in ipairs(self:GetChildren()) do
|
||||
if (IsValid(v)) then
|
||||
v:PaintManual()
|
||||
end
|
||||
end
|
||||
render.SetScissorRect(0, 0, 0, 0, false)
|
||||
end
|
||||
|
||||
--- Returns the current position of the mouse cursor on the screen.
|
||||
-- @realm client
|
||||
-- @treturn number X position of cursor
|
||||
-- @treturn number Y position of cursor
|
||||
function PANEL:GetCursorPosition()
|
||||
local width, height = self:GetSize()
|
||||
local mouseX, mouseY = gui.MousePos()
|
||||
|
||||
return math.Clamp(mouseX + self.mousePadding, 0, ScrW() - width), math.Clamp(mouseY, 0, ScrH() - height)
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (!self.bEntity) then
|
||||
if (!vgui.CursorVisible()) then
|
||||
self:SetPos(self.lastX, self.lastY)
|
||||
|
||||
-- if the cursor isn't visible then we don't really need the tooltip to be shown
|
||||
if (!self.bClosing) then
|
||||
self:Remove()
|
||||
end
|
||||
else
|
||||
local newX, newY = self:GetCursorPosition()
|
||||
|
||||
self:SetPos(newX, newY)
|
||||
self.lastX, self.lastY = newX, newY
|
||||
end
|
||||
|
||||
self:MoveToFront() -- dragging a panel w/ tooltip will push the tooltip beneath even the menu panel(???)
|
||||
elseif (IsValid(self.entity) and !self.bClosing) then
|
||||
if (self.bRaised) then
|
||||
self:SetPos(
|
||||
ScrW() * 0.5 - self:GetWide() * 0.5,
|
||||
math.min(ScrH() * 0.5 + self:GetTall() + 32, ScrH() - self:GetTall())
|
||||
)
|
||||
else
|
||||
local entity = self.entity
|
||||
local min, max = entity:GetRotatedAABB(entity:OBBMins() * 0.5, entity:OBBMaxs() * 0.5)
|
||||
min = entity:LocalToWorld(min):ToScreen().x
|
||||
max = entity:LocalToWorld(max):ToScreen().x
|
||||
|
||||
self:SetPos(
|
||||
math.Clamp(math.max(min, max), ScrW() * 0.5 + 32, ScrW() * 0.66 - self:GetWide()),
|
||||
ScrH() * 0.5 - self:GetTall() * 0.5
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns an `ixTooltipRow` corresponding to the given name.
|
||||
-- @realm client
|
||||
-- @string id Name of the row
|
||||
-- @treturn[1] panel Corresponding row
|
||||
-- @treturn[2] nil If the row doesn't exist
|
||||
function PANEL:GetRow(id)
|
||||
for _, v in ipairs(self:GetChildren()) do
|
||||
if (IsValid(v) and v.id == id) then
|
||||
return v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Resizes the tooltip to fit all of the child panels. You should always call this after you are done
|
||||
-- adding all of your rows.
|
||||
-- @realm client
|
||||
function PANEL:SizeToContents()
|
||||
local height = 0
|
||||
local width = 0
|
||||
|
||||
for _, v in ipairs(self:GetChildren()) do
|
||||
if (v:GetWide() > width) then
|
||||
width = v:GetWide()
|
||||
end
|
||||
|
||||
height = height + v:GetTall()
|
||||
end
|
||||
|
||||
self:SetSize(width, height)
|
||||
end
|
||||
|
||||
function PANEL:Remove()
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
self.bClosing = true
|
||||
self:CreateAnimation(animationTime * 0.5, {
|
||||
target = {fraction = 0},
|
||||
easing = "outQuint",
|
||||
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.fraction * 255)
|
||||
end,
|
||||
|
||||
OnComplete = function(animation, panel)
|
||||
BaseClass.Remove(panel)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vgui.Register("ixTooltip", PANEL, "Panel")
|
||||
|
||||
-- legacy tooltip row
|
||||
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.bMinimal = true
|
||||
self.ixAlpha = 0 -- to avoid conflicts if we're animating a non-tooltip panel
|
||||
|
||||
self:SetExpensiveShadow(1, color_black)
|
||||
self:SetContentAlignment(5)
|
||||
end
|
||||
|
||||
function PANEL:SetImportant()
|
||||
self:SetFont("ixMinimalTitleFont")
|
||||
self:SetBackgroundColor(ix.config.Get("color"))
|
||||
end
|
||||
|
||||
-- background color will affect text instead in minimal tooltips
|
||||
function PANEL:SetBackgroundColor(color)
|
||||
color = table.Copy(color)
|
||||
color.a = math.min(color.a or 255, 100)
|
||||
|
||||
self:SetTextColor(color)
|
||||
self.backgroundColor = color
|
||||
end
|
||||
|
||||
function PANEL:PaintBackground()
|
||||
end
|
||||
|
||||
vgui.Register("ixTooltipMinimalRow", PANEL, "ixTooltipRow")
|
||||
|
||||
-- legacy tooltip
|
||||
DEFINE_BASECLASS("ixTooltip")
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.bMinimal = true
|
||||
|
||||
-- we don't want to animate the alpha since children will handle their own animation, but we want to keep the fraction
|
||||
-- for the background to animate
|
||||
self:CreateAnimation(animationTime, {
|
||||
index = 1,
|
||||
target = {fraction = 1},
|
||||
easing = "outQuint",
|
||||
})
|
||||
|
||||
self:SetAlpha(255)
|
||||
end
|
||||
|
||||
-- we don't need the children to be painted manually
|
||||
function PANEL:Add(...)
|
||||
local panel = BaseClass.Add(self, ...)
|
||||
panel:SetPaintedManually(false)
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:AddRow(id)
|
||||
local panel = self:Add("ixTooltipMinimalRow")
|
||||
panel.id = id
|
||||
panel:SetZPos(#self:GetChildren() * 10)
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
self:PaintUnder()
|
||||
|
||||
derma.SkinFunc("PaintTooltipMinimalBackground", self, width, height)
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
-- remove any panels that shouldn't be shown in a minimal tooltip
|
||||
for _, v in ipairs(self:GetChildren()) do
|
||||
if (v.bNoMinimal) then
|
||||
v:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
BaseClass.SizeToContents(self)
|
||||
self:SetPos(ScrW() * 0.5 - self:GetWide() * 0.5, ScrH() * 0.5 + self.mousePadding)
|
||||
|
||||
-- we create animation here since this is the only function that usually gets called after all the rows are populated
|
||||
local children = self:GetChildren()
|
||||
|
||||
-- sort by z index so we can animate them in order
|
||||
table.sort(children, function(a, b)
|
||||
return a:GetZPos() < b:GetZPos()
|
||||
end)
|
||||
|
||||
local i = 1
|
||||
local count = table.Count(children)
|
||||
|
||||
for _, v in ipairs(children) do
|
||||
v.ixAlpha = v.ixAlpha or 0
|
||||
|
||||
v:CreateAnimation((animationTime / count) * i, {
|
||||
easing = "inSine",
|
||||
target = {ixAlpha = 255},
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.ixAlpha)
|
||||
end
|
||||
})
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
DEFINE_BASECLASS("Panel")
|
||||
function PANEL:Remove()
|
||||
if (self.bClosing) then
|
||||
return
|
||||
end
|
||||
|
||||
self.bClosing = true
|
||||
|
||||
-- we create animation here since this is the only function that usually gets called after all the rows are populated
|
||||
local children = self:GetChildren()
|
||||
|
||||
-- sort by z index so we can animate them in order
|
||||
table.sort(children, function(a, b)
|
||||
return a:GetZPos() > b:GetZPos()
|
||||
end)
|
||||
|
||||
local duration = animationTime * 0.5
|
||||
local i = 1
|
||||
local count = table.Count(children)
|
||||
|
||||
for _, v in ipairs(children) do
|
||||
v.ixAlpha = v.ixAlpha or 255
|
||||
|
||||
v:CreateAnimation(duration / count * i, {
|
||||
target = {ixAlpha = 0},
|
||||
Think = function(animation, panel)
|
||||
panel:SetAlpha(panel.ixAlpha)
|
||||
end
|
||||
})
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
self:CreateAnimation(duration, {
|
||||
target = {fraction = 0},
|
||||
OnComplete = function(animation, panel)
|
||||
BaseClass.Remove(panel)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vgui.Register("ixTooltipMinimal", PANEL, "ixTooltip")
|
||||
349
gamemodes/helix/plugins/willardinterface/derma/cl_wn_credits.lua
Normal file
349
gamemodes/helix/plugins/willardinterface/derma/cl_wn_credits.lua
Normal file
@@ -0,0 +1,349 @@
|
||||
--[[
|
||||
| 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 CREDITS = {
|
||||
{"Atle", "76561198002319944", {"Chef de projet", "Concept Art" }},
|
||||
{"Aspect", "76561198251001690", {"Développeur principal", "Développement accéléré"}},
|
||||
{"Fruity", "76561198068753895", {"Développeur UI principal", "Modélisation 3D"}},
|
||||
{"Gr4Ss", "76561197997384060", {"Développeur", "Magicien de Lua"}},
|
||||
{"Robert", "76561198032327315", {"Développeur", "HR Dev Cat"}},
|
||||
{"Geferon", "76561198026760063", {"Développeur"}},
|
||||
{"Whitehole", "76561198034272701", {"Développeur"}},
|
||||
{"Naast Kyram'la", "76561198380784421", {"Développeur"}},
|
||||
{"M!NT", "76561198201768255", {"Développeur", "Ingénieur du son"}},
|
||||
{"AleXXX_007", "76561198050171407", {"Développeur indépendant"}},
|
||||
{"Adi", "76561198138418837", {"Modélisation 3D"}},
|
||||
{"Lurondor", "76561198088832581", {"Modélisation 3D"}},
|
||||
{"Hawke", "76561197999982690", {"Designer graphique", "Ingénieur du son"}}
|
||||
}
|
||||
|
||||
local SPECIALS = {
|
||||
{
|
||||
{"LORD-RAD-X", "76561197986444716"},
|
||||
{"Robert", "76561198032327315"},
|
||||
{"Votton", "76561198052727595"},
|
||||
{"Mullin", "76561197972315523"}
|
||||
},
|
||||
{
|
||||
{"Kena", "76561198186266199"},
|
||||
{"DeNuke", "76561198009096978"},
|
||||
{"Legion", "76561198108804650"},
|
||||
{"Pixel", "76561198112973827"}
|
||||
}
|
||||
}
|
||||
|
||||
local MISC = {
|
||||
{"Soutien communautaire", "Notre profonde gratitude et nos remerciements pour tout le soutien de la communauté !"},
|
||||
}
|
||||
|
||||
local url = "https://willard.network/"
|
||||
local padding = SScaleMin(32 / 3)
|
||||
|
||||
-- logo
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetTall(SScaleMin(230 / 3))
|
||||
self:Dock(TOP)
|
||||
self:DockMargin(0, SScaleMin(30 / 3), 0, 0)
|
||||
end
|
||||
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
local curTime = CurTime()
|
||||
|
||||
surface.SetDrawColor(Color(255, 255, 255, 255))
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_base.png"))
|
||||
surface.DrawTexturedRect(width * 0.5 - SScaleMin(195 / 3) * 0.5, height * 0.5 - SScaleMin(196 / 3) * 0.5, SScaleMin(195 / 3), SScaleMin(196 / 3))
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_circle1.png"))
|
||||
surface.DrawTexturedRectRotated((width * 0.5) + 2, (height * 0.5) - 2, SScaleMin(195 / 3), SScaleMin(196 / 3), curTime * -15)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_circle2.png"))
|
||||
surface.DrawTexturedRectRotated((width * 0.5) - 2, (height * 0.5) + 2, SScaleMin(195 / 3), SScaleMin(196 / 3), curTime * -15)
|
||||
end
|
||||
|
||||
vgui.Register("ixWillardCreditsLogo", PANEL, "Panel")
|
||||
|
||||
-- logo
|
||||
local PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetTall(SScaleMin(230 / 3))
|
||||
self:Dock(TOP)
|
||||
self:DockMargin(0, SScaleMin(30 / 3), 0, 0)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
local curTime = CurTime()
|
||||
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_base_new.png"))
|
||||
surface.DrawTexturedRect(width * 0.5 - SScaleMin(69 / 3) * 0.5, height * 0.5 - SScaleMin(59 / 3) * 0.5, SScaleMin(69 / 3), SScaleMin(59 / 3))
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_circle1_new.png"))
|
||||
surface.DrawTexturedRectRotated((width * 0.5) + 2, (height * 0.5) - 2, SScaleMin(125 / 3), SScaleMin(122 / 3), curTime * -15)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/wn_logo_circle2_new.png"))
|
||||
surface.DrawTexturedRectRotated((width * 0.5) - 2, (height * 0.5) + 2, SScaleMin(125 / 3), SScaleMin(122 / 3), curTime * -15)
|
||||
end
|
||||
|
||||
vgui.Register("ixWillardCreditsLogoSmall", PANEL, "Panel")
|
||||
|
||||
-- nametag
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.name = self:Add("DLabel")
|
||||
self.name:SetFont("WNSmallerMenuTitleNoBoldNoClamp")
|
||||
|
||||
self.avatar = self:Add("AvatarImage")
|
||||
end
|
||||
|
||||
function PANEL:SetName(name)
|
||||
self.name:SetText(name)
|
||||
end
|
||||
|
||||
function PANEL:SetAvatar(steamid)
|
||||
self.avatar:SetSteamID(steamid, SScaleMin(64 / 3))
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
self.name:SetPos(width - self.name:GetWide(), 0)
|
||||
self.avatar:MoveLeftOf(self.name, padding * 0.5)
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
self.name:SizeToContents()
|
||||
|
||||
local tall = self.name:GetTall()
|
||||
self.avatar:SetSize(tall, tall)
|
||||
self:SetSize(self.name:GetWide() + self.avatar:GetWide() + padding * 0.5, self.name:GetTall())
|
||||
end
|
||||
|
||||
vgui.Register("ixCreditsNametag", PANEL, "Panel")
|
||||
|
||||
-- name row
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:DockMargin(0, padding, 0, 0)
|
||||
self:Dock(TOP)
|
||||
|
||||
self.nametag = self:Add("ixCreditsNametag")
|
||||
|
||||
self.tags = self:Add("DLabel")
|
||||
self.tags:SetFont("TitlesFontNoBoldNoClamp")
|
||||
|
||||
self:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:SetName(name)
|
||||
self.nametag:SetName(name)
|
||||
end
|
||||
|
||||
function PANEL:SetAvatar(steamid)
|
||||
self.nametag:SetAvatar(steamid)
|
||||
end
|
||||
|
||||
function PANEL:SetTags(tags)
|
||||
for i = 1, #tags do
|
||||
tags[i] = L(tags[i])
|
||||
end
|
||||
|
||||
self.tags:SetText(table.concat(tags, "\n"))
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(ix.config.Get("color"))
|
||||
surface.DrawRect(width * 0.5 - 1, 0, 1, height)
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
self.nametag:SetPos(width * 0.5 - self.nametag:GetWide() - padding, 0)
|
||||
self.tags:SetPos(width * 0.5 + padding, 0)
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
self.nametag:SizeToContents()
|
||||
self.tags:SizeToContents()
|
||||
|
||||
self:SetTall(math.max(self.nametag:GetTall(), self.tags:GetTall()))
|
||||
end
|
||||
|
||||
vgui.Register("ixCreditsRow", PANEL, "Panel")
|
||||
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self.left = {}
|
||||
self.right = {}
|
||||
end
|
||||
|
||||
function PANEL:AddLeft(name, steamid)
|
||||
local nametag = self:Add("ixCreditsNametag")
|
||||
nametag:SetName(name)
|
||||
nametag:SetAvatar(steamid)
|
||||
nametag:SizeToContents()
|
||||
|
||||
self.left[#self.left + 1] = nametag
|
||||
end
|
||||
|
||||
function PANEL:AddRight(name, steamid)
|
||||
local nametag = self:Add("ixCreditsNametag")
|
||||
nametag:SetName(name)
|
||||
nametag:SetAvatar(steamid)
|
||||
nametag:SizeToContents()
|
||||
|
||||
self.right[#self.right + 1] = nametag
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout(width, height)
|
||||
local y = 0
|
||||
|
||||
for _, v in ipairs(self.left) do
|
||||
v:SetPos(width * 0.25 - v:GetWide() * 0.5, y)
|
||||
y = y + v:GetTall() + padding
|
||||
end
|
||||
|
||||
y = 0
|
||||
|
||||
for _, v in ipairs(self.right) do
|
||||
v:SetPos(width * 0.75 - v:GetWide() * 0.5, y)
|
||||
y = y + v:GetTall() + padding
|
||||
end
|
||||
|
||||
if (IsValid(self.center)) then
|
||||
self.center:SetPos(width * 0.5 - self.center:GetWide() * 0.5, y)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local heightLeft, heightRight, centerHeight = 0, 0, 0
|
||||
|
||||
if (#self.left > #self.right) then
|
||||
local center = self.left[#self.left]
|
||||
centerHeight = center:GetTall()
|
||||
|
||||
self.center = center
|
||||
self.left[#self.left] = nil
|
||||
elseif (#self.right > #self.left) then
|
||||
local center = self.right[#self.right]
|
||||
centerHeight = center:GetTall()
|
||||
|
||||
self.center = center
|
||||
self.right[#self.right] = nil
|
||||
end
|
||||
|
||||
for _, v in ipairs(self.left) do
|
||||
heightLeft = heightLeft + v:GetTall() + padding
|
||||
end
|
||||
|
||||
for _, v in ipairs(self.right) do
|
||||
heightRight = heightRight + v:GetTall() + padding
|
||||
end
|
||||
|
||||
self:SetTall(math.max(heightLeft, heightRight) + centerHeight)
|
||||
end
|
||||
|
||||
vgui.Register("ixCreditsSpecials", PANEL, "Panel")
|
||||
|
||||
PANEL = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:Add("ixWillardCreditsLogo")
|
||||
|
||||
local link = self:Add("DLabel", self)
|
||||
link:SetFont("MenuFontNoClamp")
|
||||
link:SetTextColor(Color(200, 200, 200, 255))
|
||||
link:SetText(url)
|
||||
link:SetContentAlignment(5)
|
||||
link:Dock(TOP)
|
||||
link:SizeToContents()
|
||||
link:SetMouseInputEnabled(true)
|
||||
link:SetCursor("hand")
|
||||
link.OnMousePressed = function()
|
||||
gui.OpenURL(url)
|
||||
end
|
||||
|
||||
for _, v in ipairs(CREDITS) do
|
||||
local row = self:Add("ixCreditsRow")
|
||||
row:SetName(v[1])
|
||||
row:SetAvatar(v[2])
|
||||
row:SetTags(v[3])
|
||||
row:SizeToContents()
|
||||
end
|
||||
|
||||
local specials = self:Add("ixKLabel")
|
||||
specials:SetText(L("creditSpecial"):utf8upper())
|
||||
specials:SetTextColor(ix.config.Get("color"))
|
||||
specials:SetExpensiveShadow(1)
|
||||
specials:SetKerning(16)
|
||||
specials:SetCentered(true)
|
||||
specials:DockMargin(0, padding * 2, 0, padding)
|
||||
specials:Dock(TOP)
|
||||
specials:SetFont("WNSmallerMenuTitleNoBoldNoClamp")
|
||||
specials:SizeToContents()
|
||||
|
||||
local specialList = self:Add("ixCreditsSpecials")
|
||||
specialList:DockMargin(0, padding, 0, 0)
|
||||
specialList:Dock(TOP)
|
||||
|
||||
for _, v in ipairs(SPECIALS[1]) do
|
||||
specialList:AddLeft(v[1], v[2])
|
||||
end
|
||||
|
||||
for _, v in ipairs(SPECIALS[2]) do
|
||||
specialList:AddRight(v[1], v[2])
|
||||
end
|
||||
|
||||
specialList:SizeToContents()
|
||||
|
||||
-- less more padding if there's a center column nametag
|
||||
if (IsValid(specialList.center)) then
|
||||
specialList:DockMargin(0, padding, 0, padding)
|
||||
end
|
||||
|
||||
for _, v in ipairs(MISC) do
|
||||
local title = self:Add("DLabel")
|
||||
title:SetFont("WNSmallerMenuTitleNoBoldNoClamp")
|
||||
title:SetText(v[1])
|
||||
title:SetContentAlignment(5)
|
||||
title:SizeToContents()
|
||||
title:DockMargin(0, padding, 0, 0)
|
||||
title:Dock(TOP)
|
||||
|
||||
local description = self:Add("DLabel")
|
||||
description:SetFont("TitlesFontNoBoldNoClamp")
|
||||
description:SetText(v[2])
|
||||
description:SetContentAlignment(5)
|
||||
description:SizeToContents()
|
||||
description:Dock(TOP)
|
||||
end
|
||||
|
||||
self:Dock(TOP)
|
||||
self:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:SizeToContents()
|
||||
local height = padding
|
||||
|
||||
for _, v in pairs(self:GetChildren()) do
|
||||
local _, top, _, bottom = v:GetDockMargin()
|
||||
height = height + v:GetTall() + top + bottom
|
||||
end
|
||||
|
||||
self:SetTall(height)
|
||||
end
|
||||
|
||||
vgui.Register("ixWillardCredits", PANEL, "Panel")
|
||||
|
||||
hook.Add("PopulateHelpMenu", "ixHelixCredits", function(tabs)
|
||||
tabs["Crédits WN"] = function(container)
|
||||
container:Add("ixWillardCredits")
|
||||
end
|
||||
end)
|
||||
@@ -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 PLUGIN = PLUGIN
|
||||
|
||||
function PLUGIN:AddQuiz(question, answers, bPermanent)
|
||||
netstream.Start("AddQuiz", question, answers, bPermanent)
|
||||
end
|
||||
|
||||
function PLUGIN:RemoveQuiz(id)
|
||||
netstream.Start("RemoveQuiz", id)
|
||||
end
|
||||
|
||||
function PLUGIN:EditQuiz(id, question, answers, bPermanent)
|
||||
netstream.Start("EditQuiz", id, question, answers, bPermanent)
|
||||
end
|
||||
|
||||
-- Hooks
|
||||
netstream.Hook("SyncQuiz", function(list)
|
||||
PLUGIN.quizlist = list
|
||||
if IsValid(ix.gui.quizAnswering) then
|
||||
if (ix.gui.quizAnswering.CreateQuizContent) then
|
||||
ix.gui.quizAnswering:CreateQuizContent()
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(ix.gui.quizMenu) then
|
||||
if (ix.gui.quizMenu.CreateLeftSide) then
|
||||
ix.gui.quizMenu:CreateLeftSide()
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,291 @@
|
||||
--[[
|
||||
| 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 margin10 = SScaleMin(10 / 3)
|
||||
local size50 = SScaleMin(50 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
ix.gui.quizMenu = self
|
||||
|
||||
self:SetSize(SScaleMin(600 / 3), SScaleMin(500 / 3))
|
||||
self:Center()
|
||||
self:SetTitle("Quiz Manager")
|
||||
DFrameFixer(self)
|
||||
|
||||
self.leftSide = self:Add("Panel")
|
||||
self.leftSide:Dock(LEFT)
|
||||
self.leftSide:SetWide(self:GetWide() * 0.5)
|
||||
self.leftSide:DockMargin(0, 0, margin10, 0)
|
||||
|
||||
local divider = self:Add("DShape")
|
||||
divider:Dock(LEFT)
|
||||
divider:SetWide(SScaleMin(1 / 3))
|
||||
divider:SetType("Rect")
|
||||
divider:DockMargin(0, 0, margin10, 0)
|
||||
divider:SetColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
|
||||
self.rightSide = self:Add("Panel")
|
||||
self.rightSide:Dock(FILL)
|
||||
|
||||
self:CreateRightSide()
|
||||
netstream.Start("RequestQuizzes", true)
|
||||
end
|
||||
|
||||
function PANEL:CreateRightTitle()
|
||||
self:CreateTitle(self.rightSide, "Question Editor")
|
||||
end
|
||||
|
||||
function PANEL:CreateLeftTitle()
|
||||
self:CreateTitle(self.leftSide, "Current Questions")
|
||||
end
|
||||
|
||||
function PANEL:CreateTitle(parent, text, font)
|
||||
local title = parent:Add("DLabel")
|
||||
title:Dock(TOP)
|
||||
title:SetText(text)
|
||||
title:SetFont(font or "LargerTitlesFontNoClamp")
|
||||
title:SetContentAlignment(5)
|
||||
title:SizeToContents()
|
||||
title:DockMargin(0, 0, 0, margin10)
|
||||
end
|
||||
|
||||
function PANEL:CreateLeftSide()
|
||||
for _, v in pairs(self.leftSide:GetChildren()) do
|
||||
v:Remove()
|
||||
end
|
||||
|
||||
self:CreateLeftTitle()
|
||||
|
||||
local addQuiz = self.leftSide:Add("DButton")
|
||||
addQuiz:Dock(BOTTOM)
|
||||
addQuiz:SetTall(size50)
|
||||
addQuiz:SetText("ADD QUESTION")
|
||||
addQuiz:SetFont("MenuFontLargerNoClamp")
|
||||
addQuiz:DockMargin(0, margin10, 0, 0)
|
||||
addQuiz.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
if self.quizAddEditPanel then
|
||||
self.quizAddEditPanel:Remove()
|
||||
self.quizAddEditPanel = nil
|
||||
end
|
||||
|
||||
self:CreateQuizAddPanel()
|
||||
end
|
||||
|
||||
self.quizScroll = self.leftSide:Add("DScrollPanel")
|
||||
self.quizScroll:Dock(FILL)
|
||||
|
||||
self:RefreshQuizzes()
|
||||
end
|
||||
|
||||
function PANEL:CreateRightSide()
|
||||
self:CreateRightTitle()
|
||||
end
|
||||
|
||||
function PANEL:RefreshQuizzes()
|
||||
for id, table in pairs(PLUGIN.quizlist) do
|
||||
local question = table[1] or "NO QUESTION"
|
||||
local answers = table[2] or {}
|
||||
|
||||
local quiz = self.quizScroll:Add("DButton")
|
||||
quiz:Dock(TOP)
|
||||
quiz:SetTall(size50)
|
||||
quiz:SetText(question and (string.len(question) > 30 and string.Left(question, 30).."..." or question) or "")
|
||||
quiz:SetContentAlignment(4)
|
||||
quiz:SetTextInset(margin10, 0)
|
||||
quiz:SetFont("MenuFontLargerNoClamp")
|
||||
quiz.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
if self.quizAddEditPanel then
|
||||
self.quizAddEditPanel:Remove()
|
||||
self.quizAddEditPanel = nil
|
||||
end
|
||||
|
||||
self:CreateQuizAddPanel(id, table)
|
||||
end
|
||||
|
||||
local deleteQuiz = quiz:Add("DButton")
|
||||
deleteQuiz:Dock(RIGHT)
|
||||
deleteQuiz:DockMargin(margin10, margin10 * 1.5, 0, margin10 * 1.5)
|
||||
deleteQuiz:SetWide(SScaleMin(30 / 3))
|
||||
deleteQuiz:SetText("")
|
||||
deleteQuiz.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("materials/willardnetworks/tabmenu/navicons/exit.png"))
|
||||
surface.DrawTexturedRect(0, 0, w - SScaleMin(10 / 3), h)
|
||||
end
|
||||
|
||||
deleteQuiz.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
PLUGIN:RemoveQuiz(id)
|
||||
quiz:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateQuizAddPanel(id, table)
|
||||
self.answers = {}
|
||||
self.question = ""
|
||||
|
||||
self.quizAddEditPanel = self.rightSide:Add("EditablePanel")
|
||||
self.quizAddEditPanel:Dock(FILL)
|
||||
|
||||
self:CreateTitle(self.quizAddEditPanel, "Question", "MenuFontNoClamp")
|
||||
|
||||
local question = self.quizAddEditPanel:Add("DTextEntry")
|
||||
question:Dock(TOP)
|
||||
question:SetTall(SScaleMin(30 / 3))
|
||||
question:DockMargin(0, 0, 0, margin10)
|
||||
question:SetZPos(1)
|
||||
self:CreateTextEntry(question, id and table[1] or "A cool question")
|
||||
|
||||
local addAnswer = self.quizAddEditPanel:Add("DButton")
|
||||
addAnswer:Dock(TOP)
|
||||
addAnswer:DockMargin(0, 0, 0, margin10)
|
||||
addAnswer:SetFont("MenuFontLargerNoClamp")
|
||||
addAnswer:SetText("ADD ANSWER(S)")
|
||||
addAnswer:SetTall(size50)
|
||||
addAnswer:SetZPos(2)
|
||||
addAnswer.DoClick = function()
|
||||
if #self.answers == 6 then return LocalPlayer():NotifyLocalized("Max answers is 6!") end
|
||||
|
||||
self:CreateAnswer(self.quizAddEditPanel)
|
||||
end
|
||||
|
||||
if !id then
|
||||
for i = 1, 2 do
|
||||
addAnswer.DoClick()
|
||||
end
|
||||
|
||||
local firstAnswer = self.answers[1]:GetChildren()[1]
|
||||
firstAnswer.DoClick(firstAnswer)
|
||||
|
||||
self.answers[1]:SetText("A right answer")
|
||||
self.answers[2]:SetText("A wrong answer")
|
||||
else
|
||||
for answer, rightAnswer in pairs(table[2]) do
|
||||
self:CreateAnswer(self.quizAddEditPanel, answer, rightAnswer)
|
||||
end
|
||||
end
|
||||
|
||||
local bPermanent = self.quizAddEditPanel:Add("DCheckBoxLabel")
|
||||
bPermanent:Dock(BOTTOM)
|
||||
bPermanent:SetZPos(4)
|
||||
bPermanent:SetFont("MenuFontNoClamp")
|
||||
bPermanent:SetText("Permanent Question")
|
||||
bPermanent:SizeToContents()
|
||||
bPermanent:DockMargin(0, 0, 0, SScaleMin(10 / 3))
|
||||
bPermanent:SetValue(id and table[3] or false)
|
||||
|
||||
local saveQuiz = self.quizAddEditPanel:Add("DButton")
|
||||
saveQuiz:Dock(BOTTOM)
|
||||
saveQuiz:SetTall(size50)
|
||||
saveQuiz:SetZPos(3)
|
||||
saveQuiz:SetText(id and "EDIT" or "SAVE")
|
||||
saveQuiz:SetFont("MenuFontLargerNoClamp")
|
||||
saveQuiz.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self.question = question:GetText()
|
||||
self:SaveQuiz(id, bPermanent:GetChecked())
|
||||
self.quizAddEditPanel:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateAnswer(parent, sAnswer, bRightAnswer)
|
||||
local answerPanel = parent:Add("Panel")
|
||||
answerPanel:Dock(TOP)
|
||||
answerPanel:SetTall(SScaleMin(30 / 3))
|
||||
answerPanel:SetZPos(5)
|
||||
|
||||
local answer = answerPanel:Add("DTextEntry")
|
||||
answer:Dock(LEFT)
|
||||
answer:SetWide(SScaleMin(267 / 3))
|
||||
answer:SetText(sAnswer or "")
|
||||
self:CreateTextEntry(answer, sAnswer or "", 30, true)
|
||||
|
||||
answer.rightAnswer = bRightAnswer or false
|
||||
|
||||
local trueOrFalse = answer:Add("DButton")
|
||||
trueOrFalse:Dock(RIGHT)
|
||||
trueOrFalse:SetWide(SScaleMin(30 / 3))
|
||||
trueOrFalse:SetText("")
|
||||
trueOrFalse.Paint = function(self, w, h)
|
||||
if self:GetParent().rightAnswer then
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("materials/willardnetworks/charselect/check.png"))
|
||||
surface.DrawTexturedRect(SScaleMin(5 / 3), SScaleMin(5 / 3), w - margin10, h - margin10)
|
||||
else
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("materials/willardnetworks/tabmenu/navicons/exit.png"))
|
||||
surface.DrawTexturedRect(SScaleMin(5 / 3), SScaleMin(5 / 3), w - margin10, h - margin10)
|
||||
end
|
||||
end
|
||||
|
||||
trueOrFalse.DoClick = function(this)
|
||||
if !this:GetParent().rightAnswer then
|
||||
this:GetParent().rightAnswer = true
|
||||
end
|
||||
|
||||
for _, v in pairs(self.answers) do
|
||||
v.rightAnswer = false
|
||||
end
|
||||
|
||||
this:GetParent().rightAnswer = true
|
||||
end
|
||||
|
||||
table.insert(self.answers, answer)
|
||||
end
|
||||
|
||||
function PANEL:SaveQuiz(id, bPermanent)
|
||||
local answers = {}
|
||||
for _, v in pairs(self.answers) do
|
||||
answers[v:GetText()] = v.rightAnswer
|
||||
end
|
||||
|
||||
if id then
|
||||
PLUGIN:EditQuiz(id, self.question, answers, bPermanent)
|
||||
else
|
||||
PLUGIN:AddQuiz(self.question, answers, bPermanent)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateTextEntry(parent, value, maxChars, bShouldBePaintedShorter)
|
||||
parent:SetTextColor(Color(200, 200, 200, 255))
|
||||
parent:SetCursorColor(Color(200, 200, 200, 255))
|
||||
parent:SetFont("MenuFontNoClamp")
|
||||
parent:SetText(value or "")
|
||||
parent.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(Color(0, 0, 0, 100))
|
||||
surface.DrawRect(0, 0, bShouldBePaintedShorter and (w - SScaleMin(30 / 3) - margin10) or w, h)
|
||||
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawOutlinedRect(0, 0, bShouldBePaintedShorter and (w - SScaleMin(30 / 3) - margin10) or w, h)
|
||||
|
||||
self:DrawTextEntryText( self:GetTextColor(), self:GetHighlightColor(), self:GetCursorColor() )
|
||||
end
|
||||
|
||||
if maxChars then
|
||||
parent.MaxChars = maxChars
|
||||
parent.AllowInput = function()
|
||||
local value2 = parent:GetValue()
|
||||
if (string.utf8len(value2) > maxChars) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("QuizPanel", PANEL, "DFrame")
|
||||
@@ -0,0 +1,242 @@
|
||||
--[[
|
||||
| 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.quizlist = PLUGIN.quizlist or {}
|
||||
|
||||
function PLUGIN:DatabaseConnected()
|
||||
local query = mysql:Create("ix_storedquiz")
|
||||
query:Create("quiz_id", "INT(11) UNSIGNED NOT NULL AUTO_INCREMENT")
|
||||
query:Create("quiz_question", "TEXT")
|
||||
query:Create("quiz_answers", "TEXT")
|
||||
query:Create("quiz_permanent", "TEXT")
|
||||
query:PrimaryKey("quiz_id")
|
||||
query:Callback(function()
|
||||
local quizQuery = mysql:Select("ix_storedquiz")
|
||||
quizQuery:Callback(function(quizResult)
|
||||
if (!istable(quizResult) or #quizResult == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
for _, v in ipairs(quizResult) do
|
||||
self.quizlist[tonumber(v["quiz_id"])] = {v["quiz_question"], util.JSONToTable(v["quiz_answers"]), v["quiz_permanent"]}
|
||||
end
|
||||
end)
|
||||
|
||||
quizQuery:Execute()
|
||||
end)
|
||||
query:Execute()
|
||||
end
|
||||
|
||||
function PLUGIN:RandomQuizzes(client, newQuizList)
|
||||
-- Thanks Gr4Ss
|
||||
client.sentQuizIDs = {}
|
||||
|
||||
local keys = {}
|
||||
local quiz = {}
|
||||
for k, v in pairs(newQuizList) do
|
||||
if (v[3] == true) then
|
||||
quiz[#quiz + 1] = v
|
||||
client.sentQuizIDs[#quiz] = k
|
||||
else
|
||||
keys[#keys + 1] = k
|
||||
end
|
||||
end
|
||||
|
||||
while (#quiz < 6 and #keys > 0) do
|
||||
local winner = math.random(#keys)
|
||||
quiz[#quiz + 1] = newQuizList[keys[winner]]
|
||||
client.sentQuizIDs[#quiz] = keys[winner]
|
||||
table.remove(keys, winner)
|
||||
end
|
||||
|
||||
netstream.Start(client, "SyncQuiz", quiz)
|
||||
end
|
||||
|
||||
function PLUGIN:ReplyQuizzes(client, bAdmin)
|
||||
if (bAdmin) then
|
||||
if (client:IsAdmin()) then
|
||||
self:SyncFullQuizList(client)
|
||||
else
|
||||
ix.log.Add(client, "luaHack", "accéder à la quizlist complète sans administrateur")
|
||||
client:Kick("Vous n'êtes pas un administrateur.")
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local newQuizList = {}
|
||||
for oldKey, tQuestion in pairs(self.quizlist) do
|
||||
newQuizList[oldKey] = {tQuestion[1], {}, tQuestion[3]}
|
||||
|
||||
for answer, _ in pairs(tQuestion[2]) do
|
||||
newQuizList[oldKey][2][#newQuizList[oldKey][2] + 1] = answer
|
||||
end
|
||||
end
|
||||
|
||||
self:RandomQuizzes(client, newQuizList)
|
||||
end
|
||||
|
||||
function PLUGIN:SyncFullQuizList(client)
|
||||
netstream.Start(client, "SyncQuiz", self.quizlist)
|
||||
end
|
||||
|
||||
netstream.Hook("RequestQuizzes", function(client, bAdmin)
|
||||
PLUGIN:ReplyQuizzes(client, bAdmin)
|
||||
end)
|
||||
|
||||
function PLUGIN:AddQuiz(client, question, answers, bPermanent)
|
||||
if (!client:IsAdmin()) then
|
||||
ix.log.Add(client, "luaHack", "accéder à QuizAdd")
|
||||
client:Kick("Vous n'êtes pas un administrateur.")
|
||||
return false
|
||||
end
|
||||
|
||||
PLUGIN.quizlist[#PLUGIN.quizlist + 1] = {question, answers, bPermanent}
|
||||
|
||||
local queryAdd = mysql:Insert("ix_storedquiz")
|
||||
queryAdd:Insert("quiz_question", question)
|
||||
queryAdd:Insert("quiz_answers", util.TableToJSON(answers))
|
||||
queryAdd:Insert("quiz_permanent", bPermanent)
|
||||
queryAdd:Execute()
|
||||
|
||||
self:SyncFullQuizList(client)
|
||||
end
|
||||
|
||||
function PLUGIN:RemoveQuiz(client, id)
|
||||
if (!client:IsAdmin()) then
|
||||
ix.log.Add(client, "luaHack", "access QuizRemove")
|
||||
client:Kick("Vous n'êtes pas un administrateur.")
|
||||
return false
|
||||
end
|
||||
|
||||
PLUGIN.quizlist[id] = nil
|
||||
|
||||
local queryDelete = mysql:Delete("ix_storedquiz")
|
||||
queryDelete:Where("quiz_id", id)
|
||||
queryDelete:Execute()
|
||||
|
||||
self:SyncFullQuizList(client)
|
||||
end
|
||||
|
||||
function PLUGIN:EditQuiz(client, id, question, answers, bPermanent)
|
||||
if !client:IsAdmin() then
|
||||
ix.log.Add(client, "luaHack", "access QuizEdit")
|
||||
client:Kick("Vous n'êtes pas un administrateur.")
|
||||
return false
|
||||
end
|
||||
|
||||
PLUGIN.quizlist[id] = {question, answers, bPermanent}
|
||||
|
||||
local queryEdit = mysql:Update("ix_storedquiz")
|
||||
queryEdit:Where("quiz_id", id)
|
||||
queryEdit:Update("quiz_question", question)
|
||||
queryEdit:Update("quiz_answers", util.TableToJSON(answers))
|
||||
queryEdit:Update("quiz_permanent", bPermanent)
|
||||
queryEdit:Execute()
|
||||
|
||||
self:SyncFullQuizList(client)
|
||||
end
|
||||
|
||||
function PLUGIN:CheckIfAnswersAreRight(client, answers)
|
||||
if !client.sentQuizIDs then return false end
|
||||
|
||||
for sendID, actualAnswer in pairs(answers) do
|
||||
local realID = client.sentQuizIDs[sendID]
|
||||
if (!realID) then
|
||||
ix.log.Add(client, "luaHack", "modifier les questions posées au quiz")
|
||||
return false
|
||||
end
|
||||
|
||||
local question = self.quizlist[realID]
|
||||
local bAnswerFound = false
|
||||
if question then
|
||||
for answer, bRightAnswer in pairs(question[2]) do
|
||||
if (answer == actualAnswer) then
|
||||
if (bRightAnswer != true) then
|
||||
return false
|
||||
else
|
||||
bAnswerFound = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (!bAnswerFound) then return false end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function PLUGIN:AnswersMissing(client, answers)
|
||||
if (!client.sentQuizIDs) then
|
||||
return true
|
||||
end
|
||||
|
||||
if (table.Count(answers) != #client.sentQuizIDs) then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerCreateCharacter(client)
|
||||
if (!client:GetData("QuizCompleted", false)) then
|
||||
ix.log.Add(client, "luaHack", "contourner la vérification du quiz de création de personnage")
|
||||
return false, "Bien essayé !"
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CompleteQuiz(client, answers)
|
||||
if (self:AnswersMissing(client, answers)) then
|
||||
netstream.Start(client, "SendCharacterPanelNotify", "Il vous manque encore des réponses à certaines questions !")
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:CheckIfAnswersAreRight(client, answers)) then
|
||||
local quizAttempts = client:GetNetVar("quizAttempts", 3)
|
||||
|
||||
if (quizAttempts > 1) then
|
||||
local remainingAttempts = quizAttempts - 1
|
||||
local notification = string.format("Une ou plusieurs de vos réponses étaient incorrectes. Veuillez lire les règles et les directives et réessayer. Il vous reste %d tentative%s.", remainingAttempts, remainingAttempts > 1 and "s" or "")
|
||||
netstream.Start(client, "SendCharacterPanelNotify", notification)
|
||||
|
||||
client:SetNetVar("quizAttempts", remainingAttempts)
|
||||
else
|
||||
client:Kick("Malheureusement, vous n'avez pas répondu correctement. Veuillez lire les règles et directives sur https://discord.gg/dWJqGfyYJ8 et réessayer")
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
client:SetData("QuizCompleted", true)
|
||||
client.sentQuizIDs = nil
|
||||
netstream.Start(client, "SendCharacterPanelNotify", "Félicitation, vous avez répondu correctement et vous pouvez maintenant créer un personnage !")
|
||||
netstream.Start(client, "RemoveQuizUI")
|
||||
end
|
||||
|
||||
-- Hooks
|
||||
netstream.Hook("AddQuiz", function(client, question, answers, bPermanent)
|
||||
PLUGIN:AddQuiz(client, question, answers, bPermanent)
|
||||
end)
|
||||
|
||||
netstream.Hook("RemoveQuiz", function(client, id)
|
||||
PLUGIN:RemoveQuiz(client, id)
|
||||
end)
|
||||
|
||||
netstream.Hook("EditQuiz", function(client, id, question, answers, bPermanent)
|
||||
PLUGIN:EditQuiz(client, id, question, answers, bPermanent)
|
||||
end)
|
||||
|
||||
netstream.Hook("CompleteQuiz", function(client, answers)
|
||||
PLUGIN:CompleteQuiz(client, answers)
|
||||
end)
|
||||
@@ -0,0 +1,197 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
LANGUAGE = {
|
||||
adult = "adulto",
|
||||
ammo = "Munición",
|
||||
attachments = "Accesorios",
|
||||
breakdown = "Deshacer",
|
||||
cigarette = "Cigarros",
|
||||
clothing = "Ropa",
|
||||
components = "Componentes",
|
||||
electronics = "Electrónica",
|
||||
["gas mask"] = "Mascaras de Gas",
|
||||
magazine = "Cargadores",
|
||||
medical = "Medicina",
|
||||
refined = "Refinado",
|
||||
["weapons"] = "Armas",
|
||||
workbenches = "Mesas de trabajo",
|
||||
writing = "Escritura",
|
||||
["rp items"] = "Items de Roleplay",
|
||||
grenades = "Granadas",
|
||||
audiobooks = "Audiolibros",
|
||||
food = "Comida",
|
||||
luxury = "Lujo",
|
||||
["non-alcoholic"] = "No-Alcoholico",
|
||||
printing = "Imprenta",
|
||||
["tools & storage"] = "Herramientas y Almacenamiento",
|
||||
["adult (500 - 1000)"] = "adulto (500 - 1000)",
|
||||
amber = "ámbar",
|
||||
animations = "Animaciones",
|
||||
appearances = "Apariencias",
|
||||
armor = "Armadura",
|
||||
auburn = "caoba",
|
||||
bald = "calvo",
|
||||
beard = "barba",
|
||||
black = "negros",
|
||||
blonde = "rubios",
|
||||
blue = "azules",
|
||||
brown = "marrones",
|
||||
grayeyes = "Ojos grises",
|
||||
browneyes = "Ojos marrones",
|
||||
ambereyes = "Ojos ámbar",
|
||||
blueeyes = "Ojos azules",
|
||||
greeneyes = "Ojos verdes",
|
||||
hazeleyes = "Ojos avellana",
|
||||
yelloweyes = "Ojos amarillos",
|
||||
orangeyes = "Ojos naranjas",
|
||||
redeyes = "Ojos rojos",
|
||||
darkbrownhair = "Pelo marrón oscuro",
|
||||
blackhair = "Pelo negro",
|
||||
chestnuthair = "Pelo castaño",
|
||||
blondehair = "Pelo rubio",
|
||||
auburnhair = "Pelo caoba",
|
||||
gingerhair = "Pelo pelirrojo",
|
||||
grayhair = "Pelo gris",
|
||||
whitehair = "Pelo blanco",
|
||||
baldhair = "Calvo",
|
||||
|
||||
businessPermits = "Permisos Comerciales",
|
||||
charCreationClothingFactionEmpty = "No hay Selección de Ropa Disponible para esta facción",
|
||||
charCreationClothingInfo = "Se puede comprar ropa nueva en las tiendas",
|
||||
charCreationGlassesQuestion = "¿necesitas gafas?",
|
||||
charCreationGlassesWarning = "La pantalla no se verá borrosa sin gafas a menos que esté habilitado",
|
||||
charCreationModelPermanent = "Tu modelo es permanente así que elige sabiamente",
|
||||
charCreationReadQuestion = "¿Puedes leer?",
|
||||
charCreationReadWarning = "Los libros, etc. se desordenarán pero mantendrán una especie de 'legibilidad' si se selecciona 'No'",
|
||||
charRpInfo = "Información de Personaje y Roleplay",
|
||||
character = "Personaje",
|
||||
characterDesc = "descripción del personaje",
|
||||
characterDescInput = "Escribe aquí la descripción de tu personaje...",
|
||||
characterDescLengthMinMax = "Tu descripción debe tener un mínimo de %d caracteres (%d/%d)",
|
||||
chestnut = "castaño",
|
||||
chooseCharacter = "Elige tu Personaje",
|
||||
clothes = "ropas",
|
||||
["dark brown"] = "marrón oscuro",
|
||||
["elder (1500 - 2000)"] = "anciano (1500 - 2000)",
|
||||
elderly = "anciano",
|
||||
exit = "Salir",
|
||||
eyesDesc = "Ojos %s",
|
||||
fallOver = "Tirarse",
|
||||
geneticDescPermanent = "Los datos de la descripción genética son permanentes.",
|
||||
genetics = "Genética",
|
||||
ginger = "pelirrojo",
|
||||
gray = "gris",
|
||||
green = "verde",
|
||||
hairDesc = "Pelo %s",
|
||||
hazel = "avellana",
|
||||
health = "Salud",
|
||||
information = "Información",
|
||||
interactions = "Interacciones",
|
||||
introSpaceContinue = "Pulsa Espacio para Continuar",
|
||||
jacketSelection = "selección de chaqueta",
|
||||
["matured youngling (100 - 500)"] = "Joven adulto (100 - 500)",
|
||||
["middle-aged"] = "mediana edad",
|
||||
modelSelection = "selección de modelo",
|
||||
nameInput = "Introduce tu nombre aquí...",
|
||||
nameLengthMinMax = "Tu nombre debe tener un mínimo de %d caracteres (%d/%d)",
|
||||
newArrival = "Nueva Llegada",
|
||||
noBeard = "SIN BARBA",
|
||||
noPermits = "Sin permisos",
|
||||
orange = "naranja",
|
||||
pointsRemaining = "%d punto(s) restante(s)",
|
||||
quizChooseAnswer = "Elegir Respuesta",
|
||||
quizLoading = "Cargando las preguntas del cuestionario...",
|
||||
quizNoQuestion = "SIN PREGUNTA",
|
||||
quizTitle = "Cuestionario - Para crear un personaje tendrás que responder a algunas preguntas.",
|
||||
quizUnsure = "¿No estás seguro de las respuestas? Consulta nuestros foros para más información.",
|
||||
red = "rojo",
|
||||
["sage (1000 - 1500)"] = "sabio (1000 - 1500)",
|
||||
secondLang = "segundo idioma",
|
||||
setDescription = "Establece tu descripción",
|
||||
shoesSelection = "selección de calzado",
|
||||
skillsMaxLevel = "Las habilidades tiene un nivel máximo de %d",
|
||||
skillsSelection = "selección de habilidades",
|
||||
status = "estado",
|
||||
storage = "Almacenamiento",
|
||||
trouserSelection = "selección de pantalones",
|
||||
white = "blanco",
|
||||
wnPresents = "Willard Networks Presenta",
|
||||
yellow = "amarillo",
|
||||
["young adult"] = "joven adulto",
|
||||
["youngling (0 - 100)"] = "Joven (0 - 100)",
|
||||
wnHL2RPG = "Willard Networks HL2RPG",
|
||||
actArrest = "Actuar Arresto",
|
||||
actArrestWall = "Actuar Arresto contra la Pared",
|
||||
actCheer = "Actuar Animar",
|
||||
actInjured = "Actuar Herido",
|
||||
actLean = "Actuar Apoyarse",
|
||||
actPant = "Actuar Jadeo",
|
||||
actSit = "Actuar Sentarse",
|
||||
actSitChair = "Actuar Sentarse en Silla",
|
||||
actSitLean = "Actuar Sentarse Apoyado",
|
||||
actSitWall = "Actuar Sentado contra la Pared",
|
||||
actStand = "Actuar De Pie",
|
||||
actType = "Actuar Escribir",
|
||||
actWave = "Actuar Saludar",
|
||||
actWindow = "Actuar Ventana",
|
||||
backgroundCitizenLocal = "Ciudadano Local",
|
||||
backgroundCitizenLocalDesc = "Llevas viviendo aquí bastante tiempo, quizás incluso antes de la ocupación. De alguna forma tuviste suerte y nunca te reubicaron. A día de hoy conoces la ciudad de arriba a abajo.",
|
||||
backgroundCitizenOutcast = "Paria",
|
||||
backgroundCitizenOutcastDesc = "Siempre en movimiento, siempre escondiéndote. Eludiendo al ojo de la Alianza. Vives de tus propios medios en los barrios marginales, para bien o para mal.",
|
||||
backgroundCitizenRelocated = "Ciudadano Reubicado",
|
||||
backgroundCitizenRelocatedDesc = "Acabas de llegar a esta ciudad nueva y desconocida. Sin familia, sin contactos, un don nadie más que baja del tren para empezar una nueva vida.",
|
||||
backgroundCitizenRelocatedMisc = "Recomendado para nuevos jugadores",
|
||||
backgroundCitizenSupporter = "Ciudadano Colaborador",
|
||||
backgroundCitizenSupporterDesc = "Por alguna razón u otra, has aceptado la autoridad de la Unión, sigue sus reglas y trata de vivir de acuerdo con sus expectativas. Algunos ciudadanos no verán con buenos ojos tu colaboración.",
|
||||
backgroundNotAvailable = "No hay Selección de Trasfondo Disponible para esta facción",
|
||||
backgroundVortBiotic = "Biótico",
|
||||
backgroundVortBioticDesc = "Esclavizado, liberado y esclavizado de nuevo. Con un collar en el cuello y el yugo de la Alianza sobre ti, debes resistir la tortura. Tú, y miles de otros.",
|
||||
backgroundVortBioticMisc = "Elige esto a menos que tengas permiso para utilizar los otros trasfondos.",
|
||||
backgroundVortFree = "Libre",
|
||||
backgroundVortFreeDesc = "Has sido uno de los pocos vortigaunts afortunados que nunca han sido capturados por la Alianza. La última cadena que tuviste al cuello fue la del Nihilanth. La Alianza no sabe que existes.",
|
||||
backgroundVortFreeMisc = "No utilices esto a menos que tengas permiso. Este trasfondo comienza sin CID.",
|
||||
backgroundVortLiberated = "Liberado",
|
||||
backgroundVortLiberatedDesc = "Una vez esclavizado pero libre de nuevo. Has vivido bajo el yugo de la Alianza pero ya no más. Ten cuidado, la Alianza ha dado contigo antes y no mostrará piedad si te encuentra de nuevo...",
|
||||
backgroundVortLiberatedMisc = "Dificultad difícil - No utilices esto a menos que tengas permiso. Este trasfondo comienza con un CID.",
|
||||
backgroundWorkersMedic = "Médico",
|
||||
backgroundWorkersMedicDesc = "Eres un médico de la Unión de Médicos Civiles. Tu trabajo es curar a la población, o si tienes suerte, operar tanto a vortigaunts como a Protección Civil. Cumple con tu deber.",
|
||||
backgroundWorkersWorker = "Trabajador",
|
||||
backgroundWorkersWorkerDesc = "Eres un trabajador de la Unión de Trabajadores Civiles bajo el régimen de la Alianza. Pasas la mayor parte de tu tiempo limpiando infestaciones o reparando infraestructuras.",
|
||||
charSwappingProhibited = "El cambio de personaje está prohibido en este momento.",
|
||||
quizMaxAnswers = "¡Las respuestas máximas son 6!",
|
||||
admin = "Admin",
|
||||
charCreationAttributeLevels = "Niveles de Atributos: +%s",
|
||||
charCreationAttributePerm = "Los atributos son permanentes y solo se pueden mejorar temporalmente mediante ítems",
|
||||
charCreationAttributeSelection = "Selección de atributos",
|
||||
charCreationChooseYourFaction = "Elige tu Facción",
|
||||
charCreationNoAttribute = "No hay Selección de Atributos Disponible para esta facción",
|
||||
charCreationSkinColorWrinkles = "color de piel/arrugas",
|
||||
quizAddAnswer = "Añadir respuesta",
|
||||
quizAddQuestion = "Añadir pregunta",
|
||||
quizCoolQuestion = "Una pregunta chula",
|
||||
quizCurrentQuestions = "Preguntas Actuales",
|
||||
quizManager = "Gestor de los Quiz",
|
||||
quizPermanentQuestion = "Pregunta Permanente",
|
||||
quizQuestion = "Pregunta",
|
||||
quizQuestionEditor = "Editor de Preguntas",
|
||||
quizRightAnswer = "Una respuesta correcta",
|
||||
quizWrongAnswer = "Una respuesta incorrecta",
|
||||
storageContainer = "Contenedor de Almacenamiento",
|
||||
unloadAndReturn = "Dejar al Personaje y volver al Menú Principal",
|
||||
charCreationBackgroundSelection = "Selección de trasfondo",
|
||||
charCreationFacialFeatures = "rasgos faciales",
|
||||
charCreationNameGender = "nombre/género",
|
||||
charCreationPointsRemaining = "Quedan %s puntos",
|
||||
chipsInStorage = " fichas en almacenamiento",
|
||||
["couleur des yeux"] = "color de ojo",
|
||||
["hair color"] = "color de pelo",
|
||||
language = "Idioma"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
net.Receive("RequestMainMenuInfo", function()
|
||||
local list = net.ReadTable()
|
||||
local logoData = net.ReadTable()
|
||||
local buttonColors = net.ReadTable()
|
||||
|
||||
if ix.gui.wnMainMenu and IsValid(ix.gui.wnMainMenu) then
|
||||
if ix.gui.wnMainMenu.CreateMainPanel then
|
||||
ix.gui.wnMainMenu:CreateMainPanel(logoData, buttonColors)
|
||||
|
||||
if ix.gui.wnMainMenu.UpdateChildPanels and ix.gui.wnMainMenu.GetParent then
|
||||
local parent = ix.gui.wnMainMenu:GetParent()
|
||||
if parent and IsValid(parent) then
|
||||
ix.gui.wnMainMenu:UpdateChildPanels(parent)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #list <= 0 then
|
||||
list = {"city_bg"}
|
||||
end
|
||||
|
||||
ix.gui.background_url = "willardnetworks/backgrounds/"..table.Random(list)..".jpg"
|
||||
|
||||
if !ix.gui.mainMenuManager or ix.gui.mainMenuManager and !IsValid(ix.gui.mainMenuManager) then
|
||||
return
|
||||
end
|
||||
|
||||
if !ix.gui.mainMenuManager.PopulateBackgroundList then return end
|
||||
if !list or list and !istable(list) then return end
|
||||
|
||||
ix.gui.mainMenuManager:PopulateBackgroundList(list)
|
||||
|
||||
if !ix.gui.mainMenuManager.PopulateColors then return end
|
||||
ix.gui.mainMenuManager:PopulateColors(buttonColors)
|
||||
end)
|
||||
@@ -0,0 +1,231 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
function PANEL:Init()
|
||||
ix.gui.mainMenuManager = self
|
||||
|
||||
self:SetSize(SScaleMin(600 / 3), SScaleMin(500 / 3))
|
||||
self:Center()
|
||||
self:SetTitle("Main Menu Manager")
|
||||
DFrameFixer(self)
|
||||
|
||||
self:CreateMain()
|
||||
end
|
||||
|
||||
function PANEL:CreateMain()
|
||||
if !self.mainPanel or self.mainPanel and !IsValid(self.mainPanel) then
|
||||
self.mainPanel = self:Add("Panel")
|
||||
self.mainPanel:Dock(FILL)
|
||||
end
|
||||
|
||||
for _, v in pairs(self.mainPanel:GetChildren()) do
|
||||
if IsValid(v) then
|
||||
v:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
self.backgrounds = self.mainPanel:Add("DButton")
|
||||
self:CreateButton(self.backgrounds, "Backgrounds")
|
||||
self.backgrounds.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self.buttonOptions:Remove()
|
||||
self.logoOptions:Remove()
|
||||
self.backgrounds:Remove()
|
||||
|
||||
self:CreateBackgroundsPanel()
|
||||
end
|
||||
|
||||
local infoText1 = "Relative to materials/willardnetworks/, must be png, only write the name of the file "
|
||||
local infoText2 = "without .png extension. e.g. 'wn_logo_base'."
|
||||
local infoText = infoText1..infoText2
|
||||
|
||||
self.logoOptions = self.mainPanel:Add("DButton")
|
||||
self:CreateButton(self.logoOptions, "Logo Options")
|
||||
self.logoOptions.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
Derma_Query("Set Logo Options", "Width/Height/Path",
|
||||
"Use Standard WN Logo", function()
|
||||
net.Start("SetMainMenuLogo")
|
||||
net.SendToServer()
|
||||
end,
|
||||
|
||||
"Set Custom Logo", function ()
|
||||
Derma_StringRequest("Set Custom Logo Path", infoText, "", function(path)
|
||||
Derma_StringRequest("Set Custom Logo Width", "In pixels.", "", function(width)
|
||||
Derma_StringRequest("Set Custom Logo Height", "In pixels.", "", function(height)
|
||||
local logoTable = { path, width, height }
|
||||
net.Start("SetMainMenuLogo")
|
||||
net.WriteTable(logoTable)
|
||||
net.SendToServer()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
"Cancel"
|
||||
)
|
||||
end
|
||||
|
||||
local options = {
|
||||
"Font Color",
|
||||
"Font Hover Color",
|
||||
"Font Locked Button Color"
|
||||
}
|
||||
|
||||
self.buttonOptions = self.mainPanel:Add("DButton")
|
||||
self:CreateButton(self.buttonOptions, "Button Options")
|
||||
self.buttonOptionList = {}
|
||||
self.buttonOptions.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self.buttonOptions:Remove()
|
||||
self.logoOptions:Remove()
|
||||
self.backgrounds:Remove()
|
||||
self:CreateBackButton()
|
||||
|
||||
for _, v in pairs(options) do
|
||||
local buttonOption = self.mainPanel:Add("DButton")
|
||||
self:CreateButton(buttonOption, v)
|
||||
|
||||
buttonOption.colorPicker = buttonOption:Add("ixSettingsRowColor")
|
||||
buttonOption.colorPicker:Dock(RIGHT)
|
||||
buttonOption.colorPicker:DockMargin(0, 0, SScaleMin(10 / 3), 0)
|
||||
buttonOption.colorPicker:SetText("")
|
||||
|
||||
buttonOption.colorPicker.OnValueChanged = function(panel, color)
|
||||
self:UpdateButtonColorsToServer()
|
||||
end
|
||||
|
||||
net.Start("RequestMainMenuInfo")
|
||||
net.SendToServer()
|
||||
|
||||
buttonOption.DoClick = function()
|
||||
buttonOption.colorPicker:OpenPicker()
|
||||
end
|
||||
|
||||
self.buttonOptionList[v] = buttonOption
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:UpdateButtonColorsToServer()
|
||||
local colorTable = {
|
||||
["Font Color"] = self.buttonOptionList["Font Color"].colorPicker:GetValue(),
|
||||
["Font Hover Color"] = self.buttonOptionList["Font Hover Color"].colorPicker:GetValue(),
|
||||
["Font Locked Button Color"] = self.buttonOptionList["Font Locked Button Color"].colorPicker:GetValue()
|
||||
}
|
||||
|
||||
net.Start("SetMainMenuButtonColors")
|
||||
net.WriteTable(colorTable)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
function PANEL:PopulateColors(colors)
|
||||
for type, color in pairs(colors) do
|
||||
if !self.buttonOptionList[type] then continue end
|
||||
if !self.buttonOptionList[type].colorPicker then continue end
|
||||
|
||||
self.buttonOptionList[type].colorPicker:SetValue(color)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateBackgroundsPanel()
|
||||
self:CreateBackButton()
|
||||
|
||||
local addBackground = self.mainPanel:Add("DButton")
|
||||
self:CreateButton(addBackground, "Add Background")
|
||||
|
||||
local infoText1 = "Relative to materials/willardnetworks/backgrounds/, must be jpg, only write the name of the file without "
|
||||
local infoText2 = ".jpg extension. e.g. 'city_bg'."
|
||||
local infoText = infoText1..infoText2
|
||||
|
||||
addBackground.DoClick = function()
|
||||
Derma_StringRequest("Add background", infoText, "", function(text)
|
||||
net.Start("AddMainMenuBackground")
|
||||
net.WriteString(text)
|
||||
net.SendToServer()
|
||||
end)
|
||||
end
|
||||
|
||||
self:CreateNote("Path relative to materials/willardnetworks/backgrounds/")
|
||||
|
||||
self.backgroundList = self.mainPanel:Add("DListView")
|
||||
self.backgroundList:Dock(FILL)
|
||||
self.backgroundList:DockMargin(4, 4, 4, 4)
|
||||
self.backgroundList:AddColumn("Path (right click on rows for options)")
|
||||
self.backgroundList:SetHeaderHeight(SScaleMin(16 / 3))
|
||||
self.backgroundList:SetDataHeight(SScaleMin(17 / 3))
|
||||
|
||||
net.Start("RequestMainMenuInfo")
|
||||
net.SendToServer()
|
||||
|
||||
self.backgroundList.OnRowRightClick = function(list, lineId, line)
|
||||
local dmenu = DermaMenu()
|
||||
dmenu:MakePopup()
|
||||
dmenu:SetPos(input.GetCursorPos())
|
||||
|
||||
dmenu:AddOption("Remove", function()
|
||||
net.Start("RemoveMainMenuBackground")
|
||||
net.WriteString(line:GetValue(1))
|
||||
net.SendToServer()
|
||||
end)
|
||||
|
||||
for _, v in pairs(dmenu:GetChildren()[1]:GetChildren()) do
|
||||
v:SetFont("MenuFontNoClamp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:PopulateBackgroundList(table)
|
||||
if !self.backgroundList then return end
|
||||
if self.backgroundList and !IsValid(self.backgroundList) then return end
|
||||
|
||||
self.backgroundList:Clear()
|
||||
|
||||
for _, name in pairs(table) do
|
||||
self.backgroundList:AddLine(name)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateNote(text)
|
||||
local note = self.mainPanel:Add("DLabel")
|
||||
|
||||
note:SetFont("TitlesFontNoClamp")
|
||||
note:Dock(TOP)
|
||||
note:DockMargin(SScaleMin(10 / 3), SScaleMin(10 / 3), 0, SScaleMin(10 / 3))
|
||||
note:SetText(text)
|
||||
note:SetContentAlignment(4)
|
||||
note:SizeToContents()
|
||||
|
||||
return note
|
||||
end
|
||||
|
||||
function PANEL:CreateBackButton()
|
||||
self.back = self.mainPanel:Add("DButton")
|
||||
self:CreateButton(self.back, "Back")
|
||||
self.back.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self:CreateMain()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateButton(name, text)
|
||||
name:SetSize(SScaleMin(480 / 3), SScaleMin(46 / 3))
|
||||
name:SetContentAlignment(4)
|
||||
name:SetTextInset(SScaleMin(20 / 3), 0)
|
||||
name:Dock(TOP)
|
||||
name:SetFont("TitlesFontNoClamp")
|
||||
name:DockMargin(0, 0, 0, SScaleMin(9 / 3))
|
||||
name:SetText(text)
|
||||
end
|
||||
|
||||
vgui.Register("MainMenuManager", PANEL, "DFrame")
|
||||
@@ -0,0 +1,88 @@
|
||||
--[[
|
||||
| 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("RequestMainMenuInfo")
|
||||
util.AddNetworkString("AddMainMenuBackground")
|
||||
util.AddNetworkString("RemoveMainMenuBackground")
|
||||
util.AddNetworkString("SetMainMenuLogo")
|
||||
util.AddNetworkString("SetMainMenuButtonColors")
|
||||
|
||||
function PLUGIN:UpdateMainMenu(client)
|
||||
net.Start("RequestMainMenuInfo")
|
||||
net.WriteTable(PLUGIN.menuBackgrounds)
|
||||
net.WriteTable(PLUGIN.logoData)
|
||||
net.WriteTable(PLUGIN.buttonColors)
|
||||
net.Send(client)
|
||||
end
|
||||
|
||||
net.Receive("RequestMainMenuInfo", function(_, client)
|
||||
PLUGIN:UpdateMainMenu(client)
|
||||
end)
|
||||
|
||||
net.Receive("AddMainMenuBackground", function(_, client)
|
||||
if (!client:IsAdmin()) then return end
|
||||
|
||||
local backgroundName = net.ReadString()
|
||||
|
||||
PLUGIN.menuBackgrounds[#PLUGIN.menuBackgrounds + 1] = backgroundName
|
||||
|
||||
PLUGIN:SaveData()
|
||||
PLUGIN:UpdateMainMenu(client)
|
||||
end)
|
||||
|
||||
net.Receive("RemoveMainMenuBackground", function(_, client)
|
||||
if (!client:IsAdmin()) then return end
|
||||
|
||||
local toRemove = net.ReadString()
|
||||
|
||||
for key, name in pairs(PLUGIN.menuBackgrounds) do
|
||||
if name == toRemove then
|
||||
table.remove(PLUGIN.menuBackgrounds, key)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
PLUGIN:SaveData()
|
||||
PLUGIN:UpdateMainMenu(client)
|
||||
end)
|
||||
|
||||
net.Receive("SetMainMenuLogo", function(_, client)
|
||||
if (!client:IsAdmin()) then return end
|
||||
|
||||
local newLogo = net.ReadTable()
|
||||
if #newLogo == 0 then
|
||||
PLUGIN.logoData = {bDefault = true}
|
||||
return
|
||||
end
|
||||
|
||||
local path = newLogo[1]
|
||||
local width = tonumber(newLogo[2])
|
||||
local height = tonumber(newLogo[3])
|
||||
if !isnumber(width) then return end
|
||||
if !isnumber(height) then return end
|
||||
if !isstring(path) then return end
|
||||
|
||||
PLUGIN.logoData = {path = path, width = width, height = height}
|
||||
PLUGIN:SaveData()
|
||||
end)
|
||||
|
||||
net.Receive("SetMainMenuButtonColors", function(_, client)
|
||||
if (!client:IsAdmin()) then return end
|
||||
|
||||
local newColors = net.ReadTable()
|
||||
PLUGIN.buttonColors = newColors
|
||||
|
||||
PrintTable(PLUGIN.buttonColors)
|
||||
|
||||
PLUGIN:SaveData()
|
||||
end)
|
||||
534
gamemodes/helix/plugins/willardinterface/sh_fonts.lua
Normal file
534
gamemodes/helix/plugins/willardinterface/sh_fonts.lua
Normal file
@@ -0,0 +1,534 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
resource.AddFile( "resource/fonts/opensans_extrabold.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_bold.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_bolditalic.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_extrabolditalic.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_italic.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_light.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_lightitalic.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_regular.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_semibold.ttf" )
|
||||
resource.AddFile( "resource/fonts/opensans_semibolditalic.ttf" )
|
||||
resource.AddFile( "resource/fonts/sourcesanspro-bold.ttf" )
|
||||
|
||||
if (CLIENT) then
|
||||
function PLUGIN:LoadFonts(font, genericFont)
|
||||
|
||||
surface.CreateFont( "CharCreationBoldTitle", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(12), 26, 36),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "CharCreationBoldTitleNoClamp", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = SScaleMin(36 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "CombineMonitor", {
|
||||
font = "Courier New",
|
||||
extended = false,
|
||||
size = SScaleMin(20 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "CombineMonitorLarge", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = true,
|
||||
size = SScaleMin(30 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNMenuTitle", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(23.333333333333), 0, 70),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNMenuTitleNoClamp", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = SScaleMin(70 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBleedingTitle", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(24.333333333333), 0, 73),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBleedingTitleNoClamp", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = SScaleMin(73 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBleedingMinutesBold", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(8), 0, 24),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBleedingMinutesBoldNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(24 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBleedingText", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(8.6666666666667), 0, 26),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBleedingTextNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(26 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBleedingTextBold", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(26 / 3),
|
||||
weight = 700,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNSmallerMenuTitle", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(14), 0, 42),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNSmallerMenuTitleNoClamp", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = SScaleMin(14),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SkillsTitle", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = SScaleMin(60 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "DebugFixedRadio", {
|
||||
font = "Courier New",
|
||||
extended = false,
|
||||
size = SScaleMin(14 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SkillsDesc", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(36 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNSmallerMenuTitleNoBold", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(14), 0, 42),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNSmallerMenuTitleNoBoldNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(14),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNMenuSubtitle", {
|
||||
font = "Yellowtail",
|
||||
size = math.Clamp(SScaleMin(11.333333333333), 0, 34),
|
||||
weight = 500,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNMenuSubtitleNoClamp", {
|
||||
font = "Yellowtail",
|
||||
size = SScaleMin(34 / 3),
|
||||
weight = 500,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNMenuFont", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6.6666666666667), 18, 20),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNMenuFontNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(20 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBackFont", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(5.3333333333333), 16, 16),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBackFontNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(5.3333333333333),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBackFontBold", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(5.3333333333333), 16, 16),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WNBackFontBoldNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(5.3333333333333),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFont", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6), 14, 18),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(18 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontFixed", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = 18,
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontOutlined", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6), 14, 18),
|
||||
weight = 550,
|
||||
additive = true,
|
||||
shadow = true,
|
||||
outline = true,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontOutlinedNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(18 / 3),
|
||||
weight = 550,
|
||||
additive = true,
|
||||
shadow = true,
|
||||
outline = true,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontLarger", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6.3333333333333), 15, 19),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontLargerNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(19 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontLargerBold", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6.3333333333333), 15, 19),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontLargerBoldNoFix", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(19 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontBold", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6), 14, 18),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MenuFontBoldNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(18 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SubtitleFont", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(4.6666666666667), 0, 14),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "TitlesFont", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(8), 20, 24),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "TitlesFontNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(24 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "TitlesFontFixed", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = 24,
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "LargerTitlesFont", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(9.3333333333333), 0, 28),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "LargerTitlesFontNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(28 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "EvenLargerTitlesFontNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(30 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "LargerTitlesFontFixed", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = 28,
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WN3D2DLargeText", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = 36,
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "WN3D2DMediumText", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = 28,
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "TitlesFontNoBold", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(7.3333333333333), 20, 22),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "TitlesFontNoBoldNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(22 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SmallerTitleFont", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6.6666666666667), 18, 20),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SmallerTitleFontNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(20 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SmallerTitleFontNoBold", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(6.6666666666667), 16, 20),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SmallerTitleFontNoBoldNoClamp", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(20 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "SmallerTitleFontNoBoldNoClampLessWeight", {
|
||||
font = "Open Sans",
|
||||
extended = false,
|
||||
size = SScaleMin(20 / 3),
|
||||
weight = 400,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "HUDFontLarge", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(18.666666666667), 0, 56),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "HUDFontLargeNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(56 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "HUDFontExtraLarge", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = math.Clamp(SScaleMin(24), 0, 72),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "HUDFontExtraLargeNoClamp", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(72 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MainMenuNewTitleFont", {
|
||||
font = "Source Sans Pro",
|
||||
extended = false,
|
||||
size = SScaleMin(70 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MainMenuNewTitleFont", {
|
||||
font = "Open Sans Extrabold",
|
||||
extended = false,
|
||||
size = SScaleMin(90 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MainMenuNewButtonFont", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(20 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
end
|
||||
end
|
||||
242
gamemodes/helix/plugins/willardinterface/sh_hud.lua
Normal file
242
gamemodes/helix/plugins/willardinterface/sh_hud.lua
Normal file
@@ -0,0 +1,242 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
ix.lang.AddTable("english", {
|
||||
optHUDMinimalShow = "Utiliser des barres d'informations minimales",
|
||||
optdHUDMinimalShow = "Réduira la fréquence d'affichage de vos barres d'informations HUD en les limitant à ne s'afficher que lorsque cela est nécessaire.",
|
||||
optHUDScalePercent = "Échelle de l'interface utilisateur",
|
||||
optdHUDScalePercent = "Faites évoluer votre interface utilisateur pour qu'elle soit plus grande ou plus petite, en fonction de vos préférences.",
|
||||
optHUDPosition = "Position de la barre d'informations",
|
||||
optdHUDPosition = "Choisissez où afficher les barres d'informations HUD sur votre écran.",
|
||||
optAmmoPosition = "Position de la barre de munitions",
|
||||
optdAmmoPosition = "Choisissez où afficher la barre de munitions sur votre écran."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("french", {
|
||||
optHUDMinimalShow = "Utiliser des barres d'informations minimales",
|
||||
optdHUDMinimalShow = "Réduira la fréquence d'affichage de vos barres d'informations HUD en les limitant à ne s'afficher que lorsque cela est nécessaire.",
|
||||
optHUDScalePercent = "Échelle de l'interface utilisateur",
|
||||
optdHUDScalePercent = "Faites évoluer votre interface utilisateur pour qu'elle soit plus grande ou plus petite, en fonction de vos préférences.",
|
||||
optHUDPosition = "Position de la barre d'informations",
|
||||
optdHUDPosition = "Choisissez où afficher les barres d'informations HUD sur votre écran.",
|
||||
optAmmoPosition = "Position de la barre de munitions",
|
||||
optdAmmoPosition = "Choisissez où afficher la barre de munitions sur votre écran."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("spanish", {
|
||||
optdAmmoPosition = "Elige donde mostrar la barra de munición en tu pantalla.",
|
||||
optHUDPosition = "Posición de la Barra de Información",
|
||||
optdHUDScalePercent = "Re-escala tu interfaz de usuario para hacerla más grande o más pequeña, según tu preferencia.",
|
||||
optAmmoPosition = "Posición de la Barra de Munición",
|
||||
optHUDScalePercent = "Escala de la Interfaz de Usuario",
|
||||
optdHUDPosition = "Elige donde mostrar las barras de información de la HUD en tu pantalla.",
|
||||
optHUDMinimalShow = "Usar Barras de Información Minimalistas",
|
||||
optdHUDMinimalShow = "Reducirá las veces que tus barras de información son mostradas en pantalla, limitándolas de forma que solo aparecerán cuando sean necesarias."
|
||||
})
|
||||
|
||||
if (CLIENT) then
|
||||
local staminaIcon = ix.util.GetMaterial("willardnetworks/hud/stamina.png")
|
||||
local vortIcon = ix.util.GetMaterial("willardnetworks/tabmenu/inventory/inv_vort.png")
|
||||
|
||||
local yellow = Color(255, 204, 0, 255)
|
||||
local fakeHealthColor = Color(253, 161, 0, 255)
|
||||
local background = Color(0, 0, 0, 128)
|
||||
|
||||
local paddingX, paddingY = SScaleMin(30 / 3), SScaleMin(30 / 3)
|
||||
local iconW, iconH = SScaleMin(14 / 3), SScaleMin(14 / 3)
|
||||
local iconRightPadding = SScaleMin(10 / 3)
|
||||
local iconBottomPadding = SScaleMin(10 / 3)
|
||||
local barWidth = SScaleMin(115 / 3)
|
||||
local barHeight = iconH / 2
|
||||
local yaw = 0
|
||||
|
||||
local function CreateRow(icon, value, secondaryEnd, secondaryOverlap)
|
||||
local scale = ix.option.Get("HUDScalePercent")
|
||||
local x = paddingX + ((iconW / 100) * scale) + ((iconRightPadding / 100) * scale)
|
||||
local y = paddingY + ((yaw / 100) * scale) + (iconH / 2) - ((iconH / 2) - (barHeight / 2))
|
||||
local w = barWidth * math.Clamp(value, 0, 1)
|
||||
local h = barHeight
|
||||
local configpos = ix.option.Get("HUDPosition")
|
||||
local hudposX, hudposY = 0, 0
|
||||
|
||||
if configpos == "Top Right" then
|
||||
hudposX = ScrW() - x - ((barWidth / 100) * scale) - paddingX
|
||||
elseif configpos == "Bottom Right" then
|
||||
hudposX = ScrW() - x - ((barWidth / 100) * scale) - paddingX
|
||||
hudposY = ScrH() - y - barHeight - paddingY - ((yaw / 100) * scale)
|
||||
elseif configpos == "Bottom Left" then
|
||||
hudposY = ScrH() - y - barHeight - paddingY - ((yaw / 100) * scale)
|
||||
end
|
||||
|
||||
-- Draw icon
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(icon)
|
||||
surface.DrawTexturedRect(paddingX + hudposX, paddingY + ((yaw / 100) * scale) + hudposY, (iconW / 100) * scale, (iconH / 100) * scale)
|
||||
|
||||
-- Bar background
|
||||
surface.SetDrawColor(background)
|
||||
surface.DrawRect(x + hudposX, y + hudposY, (barWidth / 100 * scale), (h / 100) * scale)
|
||||
|
||||
-- Draw behind primary bar so it 'sticks' out at the end
|
||||
if (secondaryEnd and secondaryEnd > value) then
|
||||
surface.SetDrawColor(fakeHealthColor)
|
||||
surface.DrawRect(x + hudposX, y + hudposY, (barWidth * math.Clamp(secondaryEnd, 0, 1) / 100) * scale, (h / 100) * scale)
|
||||
end
|
||||
|
||||
-- Actual info
|
||||
surface.SetDrawColor(yellow)
|
||||
surface.DrawRect(x + hudposX, y + hudposY, (w / 100) * scale, (h / 100) * scale)
|
||||
|
||||
-- Draw over primary bar so it overlaps at the beginning
|
||||
if (secondaryOverlap) then
|
||||
surface.SetDrawColor(fakeHealthColor)
|
||||
surface.DrawRect(x + hudposX, y + hudposY, (barWidth * math.Clamp(secondaryOverlap, 0, 1) / 100) * scale, (h / 100) * scale)
|
||||
end
|
||||
|
||||
yaw = yaw + iconH + iconBottomPadding
|
||||
end
|
||||
|
||||
local function CreateAlertRow(value, bFlash)
|
||||
local scale = ix.option.Get("HUDScalePercent")
|
||||
local bleedingRectH = SScaleMin(20 / 3)
|
||||
local x = paddingX + ((iconW / 100) * scale) + ((iconRightPadding / 100) * scale)
|
||||
local y = paddingY + ((yaw / 100) * scale) + (iconH / 2) - ((iconH / 2) - (barHeight / 2))
|
||||
local configpos = ix.option.Get("HUDPosition")
|
||||
local hudposX, hudposY = 0, 0
|
||||
|
||||
if configpos == "Top Right" then
|
||||
hudposX = ScrW() - x - ((barWidth / 100) * scale) - paddingX
|
||||
elseif configpos == "Bottom Right" then
|
||||
hudposX = ScrW() - x - ((barWidth / 100) * scale) - paddingX
|
||||
hudposY = ScrH() - y - bleedingRectH - paddingY - ((yaw / 100) * scale)
|
||||
elseif configpos == "Bottom Left" then
|
||||
hudposY = ScrH() - y - bleedingRectH - paddingY - ((yaw / 100) * scale)
|
||||
end
|
||||
|
||||
local newWidth = ((barWidth + iconRightPadding + iconW) / 100) * scale
|
||||
local newHeight = (bleedingRectH / 100) * scale
|
||||
if (bFlash) then
|
||||
local sin = math.sin(CurTime() * 10)
|
||||
draw.RoundedBox(4, paddingX + hudposX, y + hudposY, newWidth, newHeight, Color(255, math.Remap(sin, -1, 1, 78, 150), math.Remap(sin, -1, 1, 69, 150), 255))
|
||||
else
|
||||
draw.RoundedBox(4, paddingX + hudposX, y + hudposY, newWidth, newHeight, Color(255, 78, 69, 255))
|
||||
end
|
||||
|
||||
surface.SetFont("HUDBleedingFontBold")
|
||||
surface.SetTextColor( 255, 255, 255 )
|
||||
|
||||
local txWidth = surface.GetTextSize(value)
|
||||
surface.SetTextPos(paddingX + hudposX + (newWidth - txWidth) / 2, y + hudposY + (newHeight * 0.15))
|
||||
surface.DrawText(value)
|
||||
|
||||
yaw = yaw + newHeight + iconBottomPadding
|
||||
end
|
||||
|
||||
do
|
||||
ix.option.Add("HUDMinimalShow", ix.type.bool, false, {
|
||||
category = "Apparence"
|
||||
})
|
||||
|
||||
ix.option.Add("HUDScalePercent", ix.type.number, 100, {
|
||||
category = "Apparence",
|
||||
min = 0, max = 100, decimals = 0, OnChanged = function()
|
||||
surface.CreateFont( "HUDBleedingFontBold", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = (SScaleMin(15 / 3) / 100) * ix.option.Get("HUDScalePercent"),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
end
|
||||
})
|
||||
|
||||
ix.option.Add("HUDPosition", ix.type.array, "Top Left", {
|
||||
category = "Apparence",
|
||||
populate = function()
|
||||
local entries = {}
|
||||
|
||||
for _, v in SortedPairs({"Top Left", "Top Right", "Bottom Left", "Bottom Right"}) do
|
||||
local name = v
|
||||
local name2 = v:utf8sub(1, 1):utf8upper() .. v:utf8sub(2)
|
||||
|
||||
if (name) then
|
||||
name = name
|
||||
else
|
||||
name = name2
|
||||
end
|
||||
|
||||
entries[v] = name
|
||||
end
|
||||
|
||||
return entries
|
||||
end
|
||||
})
|
||||
|
||||
ix.option.Add("AmmoPosition", ix.type.array, "Bottom Right", {
|
||||
category = "Apparence",
|
||||
populate = function()
|
||||
local entries = {}
|
||||
|
||||
for _, v in SortedPairs({"Top Left", "Top Right", "Bottom Left", "Bottom Right"}) do
|
||||
local name = v
|
||||
local name2 = v:utf8sub(1, 1):utf8upper() .. v:utf8sub(2)
|
||||
|
||||
if (name) then
|
||||
name = name
|
||||
else
|
||||
name = name2
|
||||
end
|
||||
|
||||
entries[v] = name
|
||||
end
|
||||
|
||||
return entries
|
||||
end
|
||||
})
|
||||
|
||||
surface.CreateFont( "HUDBleedingFontBold", {
|
||||
font = "Open Sans Bold",
|
||||
extended = false,
|
||||
size = (SScaleMin(15 / 3) / 100) * ix.option.Get("HUDScalePercent"),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
} )
|
||||
end
|
||||
|
||||
function PLUGIN:HUDPaint()
|
||||
local client = LocalPlayer()
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return end
|
||||
|
||||
yaw = 0
|
||||
hook.Run("DrawImportantBars", client, character, ix.option.Get("alwaysShowBars", true), ix.option.Get("HUDMinimalShow"), CreateRow)
|
||||
|
||||
-- Stamina
|
||||
if (client:GetLocalVar("stm", 0) < 100 and ix.option.Get("StaminaBarEnabled", true)) then
|
||||
CreateRow(staminaIcon, client:GetLocalVar("stm", 0) / 100)
|
||||
end
|
||||
-- Vorts
|
||||
if ix.plugin.Get("vortigaunts") then
|
||||
if character:IsVortigaunt() then
|
||||
CreateRow(vortIcon, character:GetVortalEnergy() / ix.config.Get("maxVortalEnergy", 100))
|
||||
end
|
||||
end
|
||||
|
||||
hook.Run("DrawBars", client, character, ix.option.Get("alwaysShowBars", true), ix.option.Get("HUDMinimalShow"), CreateRow)
|
||||
hook.Run("DrawAlertBars", client, character, CreateAlertRow)
|
||||
|
||||
hook.Run("DrawHUDOverlays", client, character)
|
||||
|
||||
ix.bar.newTotalHeight = yaw + paddingY
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,214 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
LANGUAGE = {
|
||||
information = "Information",
|
||||
newArrival = "New Arrival",
|
||||
exit = "Exit",
|
||||
genetics = "Genetics",
|
||||
eyesDesc = "%s Eyes",
|
||||
hairDesc = "%s Hair",
|
||||
businessPermits = "Business Permits",
|
||||
noPermits = "No permits",
|
||||
grayeyes = "Grey eyes",
|
||||
browneyes = "Brown eyes",
|
||||
ambereyes = "Amber eyes",
|
||||
blueeyes = "Blue eyes",
|
||||
greeneyes = "Green eyes",
|
||||
yelloweyes = "Yellow eyes",
|
||||
orangeyes = "Orange eyes",
|
||||
redeyes = "Red eyes",
|
||||
hazeleyes = "Hazel eyes",
|
||||
darkbrownhair = "Dark brown hair",
|
||||
blondehair = "Blonde hair",
|
||||
blackhair = "Black hair",
|
||||
auburnhair = "Auburn hair",
|
||||
gingerhair = "Ginger hair",
|
||||
chestnuthair = "Chestnut hair",
|
||||
grayhair = "Gray hair",
|
||||
baldhair = "Bald hair",
|
||||
whitehair = "White hair",
|
||||
admin = "Admin",
|
||||
["eye color"] = "eye color",
|
||||
["hair color"] = "hair color",
|
||||
age = "Age",
|
||||
height = "Height",
|
||||
language = "Language",
|
||||
content = "Content",
|
||||
backspace = "Backspace",
|
||||
theLabelReads = "The label reads: \"%s\"",
|
||||
|
||||
notEnoughCPsOnline = "Not enough CPs online to commit crimes.",
|
||||
thereAreEnoughCPs = "There are enough CPs online to commit crime.",
|
||||
|
||||
nameInput = "Enter your name here...",
|
||||
nameLengthMinMax = "Your name needs to be minimum %d characters (%d/%d)",
|
||||
geneticDescPermanent = "The genetic description values stays permanent.",
|
||||
secondLang = "second language",
|
||||
|
||||
characterDesc = "character description",
|
||||
characterDescInput = "Write your character's description here...",
|
||||
characterDescLengthMinMax = "Your description needs to be a minimum of %d characters (%d/%d)",
|
||||
skillsSelection = "skills selection",
|
||||
pointsRemaining = "%d point(s) remaining",
|
||||
skillsMaxLevel = "Skills have a maximum level of %d",
|
||||
|
||||
noBeard = "NO BEARD",
|
||||
beard = "beard",
|
||||
clothes = "clothes",
|
||||
character = "Character",
|
||||
chooseCharacter = "Choose your Character",
|
||||
modelSelection = "model selection",
|
||||
unloadAndReturn = "Unload Character & Return to Main Menu",
|
||||
|
||||
interactions = "Interactions",
|
||||
charRpInfo = "Character and Roleplay Info",
|
||||
setDescription = "Set your Description",
|
||||
animations = "Animations",
|
||||
fallOver = "Fall Over",
|
||||
|
||||
charCreationClothingInfo = "New clothing can be purchased from stores",
|
||||
charCreationClothingFactionEmpty = "No Clothing Selection Available for this faction",
|
||||
jacketSelection = "jacket selection",
|
||||
trouserSelection = "trouser selection",
|
||||
shoesSelection = "shoes selection",
|
||||
appearances = "Appearances",
|
||||
charSwappingProhibited = "Character swapping is prohibited at this time.",
|
||||
|
||||
charCreationModelPermanent = "Your model is permanent so choose wisely",
|
||||
charCreationGlassesQuestion = "do you require glasses?",
|
||||
charCreationGlassesWarning = "Your screen will not be blurred without glasses unless enabled",
|
||||
charCreationReadQuestion = "Can you read?",
|
||||
charCreationReadWarning = "Books etc. will scramble but maintain a 'sort of readability' if 'No'",
|
||||
charCreationChooseYourFaction = "Choose your Faction",
|
||||
charCreationAttributeSelection = "Attribute selection",
|
||||
charCreationAttributeLevels = "Attribute Levels: +%s",
|
||||
charCreationNoAttribute = "No Attribute Selection Available for this faction",
|
||||
charCreationPointsRemaining = "%s point(s) remaining",
|
||||
charCreationAttributePerm = "Attributes stay permanent and can only be temporarily buffed with items",
|
||||
charCreationBackgroundSelection = "Background selection",
|
||||
charCreationNameGender = "name/gender",
|
||||
charCreationSkinColorWrinkles = "skin color/wrinkles",
|
||||
charCreationFacialFeatures = "facial features",
|
||||
charCreationMajorBoostToGuns = "Major boost to guns \nMinor boost to speed & crafting",
|
||||
charCreationMajorBoostToCooking = "Major boost to cooking \nMinor boost to smuggling & guns",
|
||||
charCreationMajorBoostToSmuggling = "Major boost to smuggling & speed \nMinor boost to medicine",
|
||||
charCreationMajorBoostToMedicine = "Major boost to medicine & crafting \nMinor boost to cooking",
|
||||
|
||||
status = "status",
|
||||
health = "Health",
|
||||
armor = "Armor",
|
||||
storage = "Storage",
|
||||
storageContainer = "Storage Container",
|
||||
chipsInStorage = " chips in storage",
|
||||
|
||||
-- Intro
|
||||
wnPresents = "Willard Networks Presents",
|
||||
wnHL2RPG = "Willard Networks HL2RPG",
|
||||
introSpaceContinue = "Press Space to Continue",
|
||||
|
||||
-- Quiz
|
||||
quizManager = "Quiz Manager",
|
||||
quizTitle = "Quiz - In order to create a character, you will need to answer some questions.",
|
||||
quizQuestion = "Question",
|
||||
quizQuestionEditor = "Question Editor",
|
||||
quizCurrentQuestions = "Current Questions",
|
||||
quizLoading = "Loading Quiz Questions...",
|
||||
quizAddQuestion = "Add question",
|
||||
quizNoQuestion = "No question",
|
||||
quizChooseAnswer = "Choose Answer",
|
||||
quizUnsure = "Unsure about the answers? Check our forums for more information.",
|
||||
quizMaxAnswers = "Max answers is 6!",
|
||||
quizRightAnswer = "A right answer",
|
||||
quizWrongAnswer = "A wrong answer",
|
||||
quizPermanentQuestion = "Permanent Question",
|
||||
quizCoolQuestion = "A cool question",
|
||||
quizAddAnswer = "Add answer",
|
||||
|
||||
-- Char creation keys, these do nothing but make the keys appear in the translation utility
|
||||
["young adult"] = "young adult",
|
||||
["adult"] = "adult",
|
||||
["middle-aged"] = "middle-aged",
|
||||
["elderly"] = "elderly",
|
||||
|
||||
["youngling (0 - 100)"] = "youngling (0 - 100)",
|
||||
["matured youngling (100 - 500)"] = "matured youngling (100 - 500)",
|
||||
["adult (500 - 1000)"] = "adult (500 - 1000)",
|
||||
["sage (1000 - 1500)"] = "sage (1000 - 1500)",
|
||||
["elder (1500 - 2000)"] = "elder (1500 - 2000)",
|
||||
|
||||
["red"] = "red",
|
||||
["yellow"] = "yellow",
|
||||
["orange"] = "orange",
|
||||
["blue"] = "blue",
|
||||
["green"] = "green",
|
||||
["brown"] = "brown",
|
||||
["hazel"] = "hazel",
|
||||
["amber"] = "amber",
|
||||
["gray"] = "gray",
|
||||
|
||||
["dark brown"] = "dark brown",
|
||||
["blonde"] = "blonde",
|
||||
["black"] = "black",
|
||||
["auburn"] = "auburn",
|
||||
["chestnut"] = "chestnut",
|
||||
["ginger"] = "ginger",
|
||||
["white"] = "white",
|
||||
["bald"] = "bald",
|
||||
|
||||
-- Char creation backgrounds
|
||||
backgroundCitizenRelocated = "Relocated Citizen",
|
||||
backgroundCitizenRelocatedDesc = "You have just arrived in this new, unfamiliar city. No family, no contacts, just another nobody getting off the train to start a new life.",
|
||||
backgroundCitizenRelocatedMisc = "Good for new players",
|
||||
backgroundCitizenLocal = "Local Citizen",
|
||||
backgroundCitizenLocalDesc = "You have lived here quite a while, perhaps even since before the occupation. Somehow you got lucky and were never relocated. By now you know the City inside-out.",
|
||||
backgroundCitizenSupporter = "Supporter Citizen",
|
||||
backgroundCitizenSupporterDesc = "For one reason or another, you have accepted the Union's authority, follow their rules and try to live up to their expectations. Some citizens may not take kindly to your collaboration.",
|
||||
backgroundCitizenOutcast = "Outcast",
|
||||
backgroundCitizenOutcastDesc = "Always on the move, always in hiding. Avoiding the eye of the Combine. You live off your own means in the slums, for the better or for the worse.",
|
||||
|
||||
backgroundVortBiotic = "Biotic",
|
||||
backgroundVortBioticDesc = "Enslaved, freed, and enslaved once again. With a collar on your neck, and the boot of the Combine upon you, you must endure the torture. You, and thousands of others.",
|
||||
backgroundVortBioticMisc = "Choose this unless you have permission to use the other backgrounds.",
|
||||
backgroundVortLiberated = "Liberated",
|
||||
backgroundVortLiberatedDesc = "Once enslaved, free again. You have lived under the boot of the Combine, but no longer. Be wary, for the Combine have tasted your blood before, and will not show leniency should they find you again...",
|
||||
backgroundVortLiberatedMisc = "Hard difficulty - Do not use this unless you have permission. This background starts with a CID.",
|
||||
backgroundVortFree = "Free",
|
||||
backgroundVortFreeDesc = "You have been one of the lucky few vortigaunts to have never been captured by the Combine. The last chain around your neck was that of the Nihilanth. The Combine does not know you exist.",
|
||||
backgroundVortFreeMisc = "Do not use this unless you have permission. This background starts with no CID.",
|
||||
|
||||
backgroundWorkersWorker = "Worker",
|
||||
backgroundWorkersWorkerDesc = "You are a worker for the Civil Workers Union under the Combine occupation. You spend your time cleaning infestation or repairing infrastructure.",
|
||||
backgroundWorkersMedic = "Medic",
|
||||
backgroundWorkersMedicDesc = "You are a medic for Civil Medical Union. Your job is to heal the populace, or if you get lucky, operate on both Vortiguants and Civil Protection. Do your duty.",
|
||||
|
||||
backgroundNotAvailable = "No Background Selection Available for this faction",
|
||||
|
||||
|
||||
-- Acts
|
||||
actArrest = "Act Arrest",
|
||||
actArrestWall = "Act Arrest Wall",
|
||||
actInjured = "Act Injured",
|
||||
actCheer = "Act Cheer",
|
||||
actLean = "Act Lean",
|
||||
actPant = "Act Pant",
|
||||
actSit = "Act Sit",
|
||||
actSitWall = "Act Sit Wall",
|
||||
actStand = "Act Stand",
|
||||
actWave = "Act Wave",
|
||||
actWindow = "Act Window",
|
||||
actType = "Act Type",
|
||||
actSitChair = "Act Sit Chair",
|
||||
actSitLean = "Act Sit Lean",
|
||||
|
||||
-- Help menu
|
||||
helpErrorExpectedKey = "expected string for help menu key\n",
|
||||
helpErrorExpectedFunction = "expected function for help menu entry '%s'\n",
|
||||
}
|
||||
524
gamemodes/helix/plugins/willardinterface/sh_plugin.lua
Normal file
524
gamemodes/helix/plugins/willardinterface/sh_plugin.lua
Normal file
@@ -0,0 +1,524 @@
|
||||
--[[
|
||||
| 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 = "Willard UI"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "The UI for Willard Industries."
|
||||
PLUGIN.menuBackgrounds = PLUGIN.menuBackgrounds or {}
|
||||
PLUGIN.logoData = PLUGIN.logoData or {}
|
||||
PLUGIN.buttonColors = PLUGIN.buttonColors or {}
|
||||
|
||||
ix.util.Include("sh_fonts.lua")
|
||||
ix.util.Include("sh_hud.lua")
|
||||
ix.util.Include("cl_overrides.lua")
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
ix.util.IncludeDir("helix/plugins/willardinterface/editablequiz", true)
|
||||
ix.util.IncludeDir("helix/plugins/willardinterface/mainmenu-manager", true)
|
||||
ix.util.IncludeDir("helix/plugins/willardinterface/editablequiz/derma", true)
|
||||
ix.util.IncludeDir("helix/plugins/willardinterface/mainmenu-manager/derma", true)
|
||||
|
||||
CAMI.RegisterPrivilege({
|
||||
Name = "Helix - Character Creation Bypass",
|
||||
MinAccess = "admin"
|
||||
})
|
||||
|
||||
ix.config.Add("CharCreationDisabled", false, "Si la création de caractères est activée ou non.", nil, {
|
||||
category = "Personnages"
|
||||
})
|
||||
|
||||
ix.config.Add("IntroTextLong", "", "Le long texte affiché dans l'intro.", nil, {
|
||||
category = "Apparence",
|
||||
type = ix.type.string
|
||||
})
|
||||
|
||||
ix.lang.AddTable("english", {
|
||||
optDisableAutoScrollChat = "Désactiver le chat à défilement automatique",
|
||||
optdDisableAutoScrollChat = "Si oui ou non la chatbox ne doit PAS défiler automatiquement."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("spanish", {
|
||||
optDisableAutoScrollChat = "Desactiva el Auto Scroll del Chat"
|
||||
})
|
||||
|
||||
ix.option.Add("disableAutoScrollChat", ix.type.bool, false, {
|
||||
category = "Chat"
|
||||
})
|
||||
|
||||
ix.config.Add("ShowCPsOnScoreboard", true, "Que les unités PC apparaisse ou non sur le tableau de bord.", nil, {
|
||||
category = "Personnages"
|
||||
})
|
||||
|
||||
ix.config.Add("CheckCrimeAmountNeeded", 4,
|
||||
"Combien d'unités PC doivent être en ligne avant que la commande CheckCrime n'autorise le crime.", nil, {
|
||||
data = {min = 1, max = 10},
|
||||
category = "Personnages"
|
||||
})
|
||||
|
||||
ix.config.Add("CheckPettyAmountNeeded", 2,
|
||||
"How many CP's are required to be online before the CheckPetty command allows petty crime.", nil, {
|
||||
data = {min = 1, max = 5},
|
||||
category = "Characters"
|
||||
})
|
||||
|
||||
ix.config.Add("CheckOverwatchAmountNeeded", 4,
|
||||
"How many CCG or OTA are required to be online before the CheckOverwatch command allows crime.", nil, {
|
||||
data = {min = 1, max = 8},
|
||||
category = "Characters"
|
||||
})
|
||||
|
||||
ix.config.Add("CheckPettyAmountNeeded", 2,
|
||||
"How many CP's are required to be online before the CheckPetty command allows petty crime.", nil, {
|
||||
data = {min = 1, max = 5},
|
||||
category = "Characters"
|
||||
})
|
||||
|
||||
ix.config.Add("CheckOverwatchAmountNeeded", 4,
|
||||
"How many CCG or OTA are required to be online before the CheckOverwatch command allows crime.", nil, {
|
||||
data = {min = 1, max = 8},
|
||||
category = "Characters"
|
||||
})
|
||||
|
||||
ix.command.Add("CheckCrime", {
|
||||
description = "Voyez s'il y a suffisamment de PC en ligne pour commettre un crime.",
|
||||
OnRun = function(self, client)
|
||||
local count = 0
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
if !IsValid(v) then continue end
|
||||
--luacheck: ignore 1
|
||||
if v:Team() != FACTION_CP then continue end
|
||||
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
if count >= ix.config.Get("CheckCrimeAmountNeeded", 4) then
|
||||
client:Notify("Il y a suffisamment d'unité PC en ligne pour commettre un crime.")
|
||||
else
|
||||
client:Notify("Pas assez d'unité PC en ligne pour commettre des crimes.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("CheckPetty", {
|
||||
description = "See if there are enough CP's online to commit a petty crime.",
|
||||
OnRun = function(self, client)
|
||||
local count = 0
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
if !IsValid(v) then continue end
|
||||
--luacheck: ignore 1
|
||||
if v:Team() != FACTION_CP then continue end
|
||||
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
if count >= ix.config.Get("CheckPettyAmountNeeded", 2) then
|
||||
client:Notify("There are enough CPs online to commit petty crime.")
|
||||
else
|
||||
client:Notify("Not enough CPs online to commit petty crimes.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("CheckOverwatch", {
|
||||
description = "See if there are enough CCG or OTA online to commit a major crime on Nexus or Administrative functions.",
|
||||
OnRun = function(self, client)
|
||||
local count = 0
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
if !IsValid(v) then continue end
|
||||
--luacheck: ignore 1
|
||||
if v:Team() != FACTION_OTA then continue end
|
||||
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
if count >= ix.config.Get("CheckOverwatchAmountNeeded", 4) then
|
||||
client:Notify("There are enough OTA online to commit an assault on Overwatch.")
|
||||
else
|
||||
client:Notify("Not enough OTA online to commit an assault on Overwatch.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("CheckPetty", {
|
||||
description = "See if there are enough CP's online to commit a petty crime.",
|
||||
OnRun = function(self, client)
|
||||
local count = 0
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
if !IsValid(v) then continue end
|
||||
--luacheck: ignore 1
|
||||
if v:Team() != FACTION_CP then continue end
|
||||
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
if count >= ix.config.Get("CheckPettyAmountNeeded", 2) then
|
||||
client:Notify("There are enough CPs online to commit petty crime.")
|
||||
else
|
||||
client:Notify("Not enough CPs online to commit petty crimes.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("CheckOverwatch", {
|
||||
description = "See if there are enough CCG or OTA online to commit a major crime on Nexus or Administrative functions.",
|
||||
OnRun = function(self, client)
|
||||
local count = 0
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
if !IsValid(v) then continue end
|
||||
--luacheck: ignore 1
|
||||
if v:Team() != FACTION_OTA then continue end
|
||||
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
if count >= ix.config.Get("CheckOverwatchAmountNeeded", 4) then
|
||||
client:Notify("There are enough OTA online to commit an assault on Overwatch.")
|
||||
else
|
||||
client:Notify("Not enough OTA online to commit an assault on Overwatch.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
if (SERVER) then
|
||||
function PLUGIN:CanPlayerCreateCharacter(client)
|
||||
if (ix.config.Get("CharCreationDisabled") and !CAMI.PlayerHasAccess(client, "Helix - Création de personnage Bypass")) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
else
|
||||
local genDescColor = Color(255, 255, 255)
|
||||
function PLUGIN:PopulateCharacterInfo(client, character, tooltip)
|
||||
if (character) then
|
||||
local faction = ix.faction.Get(client:Team())
|
||||
if (faction.noGenDesc) then return end
|
||||
|
||||
local geneticDesc = {}
|
||||
local bMask = client:GetNetVar("ixMaskEquipped")
|
||||
if (!faction.noAge and !bMask and character:GetAge() != "N/A") then
|
||||
geneticDesc[#geneticDesc + 1] = character:GetAge()
|
||||
end
|
||||
if (!faction.noEyeColor and !bMask and character:GetEyeColor() != "N/A") then
|
||||
geneticDesc[#geneticDesc + 1] = "Yeux " .. character:GetEyeColor()
|
||||
end
|
||||
if (!faction.noHeight and character:GetHeight() != "N/A") then
|
||||
table.insert(geneticDesc, math.min(2, #geneticDesc + 1), character:GetHeight()..(#geneticDesc > 0 and "" or ""))
|
||||
end
|
||||
|
||||
if (#geneticDesc > 0) then
|
||||
local genDesc = tooltip:AddRow("geneticDesc")
|
||||
genDesc:SetBackgroundColor(genDescColor)
|
||||
genDesc:SetText(string.utf8upper(table.concat(geneticDesc, " | ")))
|
||||
genDesc:SizeToContents()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ix.char.RegisterVar("background", {
|
||||
field = "background",
|
||||
fieldType = ix.type.string,
|
||||
default = "",
|
||||
isLocal = true,
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
ix.char.RegisterVar("age", {
|
||||
field = "age",
|
||||
fieldType = ix.type.string,
|
||||
default = "N/A",
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
ix.char.RegisterVar("height", {
|
||||
field = "height",
|
||||
fieldType = ix.type.string,
|
||||
default = "N/A",
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
ix.char.RegisterVar("eyeColor", {
|
||||
field = "eyeColor",
|
||||
fieldType = ix.type.string,
|
||||
default = "N/A",
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
ix.char.RegisterVar("hairColor", {
|
||||
field = "hairColor",
|
||||
fieldType = ix.type.string,
|
||||
default = "N/A",
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
function PLUGIN:AdjustCreationPayload(client, payload, newPayload)
|
||||
if (newPayload.data.background) then
|
||||
newPayload.background = newPayload.data.background
|
||||
newPayload.data.background = nil
|
||||
end
|
||||
|
||||
if (newPayload.data.age) then
|
||||
newPayload.age = newPayload.data.age
|
||||
newPayload.data.age = nil
|
||||
end
|
||||
|
||||
if (newPayload.data.height) then
|
||||
newPayload.height = newPayload.data.height
|
||||
newPayload.data.height = nil
|
||||
end
|
||||
|
||||
if (newPayload.data["couleur des yeux"]) then
|
||||
newPayload.eyeColor = newPayload.data["couleur des yeux"]
|
||||
newPayload.data["couleur des yeux"] = nil
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
hook.Add("CreateMenuButtons", "ixConfig", function(tabs)
|
||||
if (!CAMI.PlayerHasAccess(LocalPlayer(), "Helix - Manage Config", nil)) then
|
||||
return
|
||||
end
|
||||
|
||||
tabs["Admin"] = {
|
||||
|
||||
Width = 16,
|
||||
|
||||
Height = 17,
|
||||
|
||||
Right = true,
|
||||
|
||||
Icon = "willardnetworks/tabmenu/navicons/admin.png",
|
||||
|
||||
Create = function(info, container)
|
||||
local settings = container:Add("ixSettings")
|
||||
settings:SetSearchEnabled(true)
|
||||
|
||||
if settings.settingsTitle then
|
||||
settings.settingsTitleIcon:SetImage("willardnetworks/tabmenu/navicons/admin.png")
|
||||
settings.settingsTitleIcon:SetSize(SScaleMin(16 / 3), SScaleMin(17 / 3))
|
||||
|
||||
settings.settingsTitle:SetFont("TitlesFontNoClamp")
|
||||
settings.settingsTitle:SetText("Admin")
|
||||
settings.settingsTitle:SetPos(SScaleMin(26 / 3))
|
||||
settings.settingsTitle:SizeToContents()
|
||||
settings.settingsTitle:SetPos(SScaleMin(26 / 3), settings.settingsTitleIcon:GetTall()
|
||||
* 0.5 - settings.settingsTitle:GetTall() * 0.5)
|
||||
end
|
||||
|
||||
-- gather categories
|
||||
local categories = {}
|
||||
local categoryIndices = {}
|
||||
|
||||
for k, v in pairs(ix.config.stored) do
|
||||
local index = v.data and v.data.category or "misc"
|
||||
|
||||
categories[index] = categories[index] or {}
|
||||
categories[index][k] = v
|
||||
end
|
||||
|
||||
-- sort by category phrase
|
||||
for k, _ in pairs(categories) do
|
||||
categoryIndices[#categoryIndices + 1] = k
|
||||
end
|
||||
|
||||
table.sort(categoryIndices, function(a, b)
|
||||
return L(a) < L(b)
|
||||
end)
|
||||
|
||||
-- add panels
|
||||
for _, category in ipairs(categoryIndices) do
|
||||
local categoryPhrase = L(category)
|
||||
settings:AddCategory(categoryPhrase)
|
||||
|
||||
-- we can use sortedpairs since configs don't have phrases to account for
|
||||
for k, v in SortedPairs(categories[category]) do
|
||||
if (isfunction(v.hidden) and v.hidden()) then
|
||||
continue
|
||||
end
|
||||
|
||||
local data = v.data.data
|
||||
local type = v.type
|
||||
local value = ix.util.SanitizeType(type, ix.config.Get(k))
|
||||
|
||||
-- @todo check ix.gui.properties
|
||||
local row = settings:AddRow(type, categoryPhrase)
|
||||
row:SetText(ix.util.ExpandCamelCase(k))
|
||||
row:Populate(v.data.key, v.data)
|
||||
|
||||
-- type-specific properties
|
||||
if (type == ix.type.number) then
|
||||
row:SetMin(data and data.min or 0)
|
||||
row:SetMax(data and data.max or 1)
|
||||
row:SetDecimals(data and data.decimals or 0)
|
||||
end
|
||||
|
||||
row:SetValue(value, true)
|
||||
row:SetShowReset(value != v.default, k, v.default)
|
||||
|
||||
row.OnValueChanged = function(panel)
|
||||
local newValue = ix.util.SanitizeType(type, panel:GetValue())
|
||||
|
||||
panel:SetShowReset(newValue != v.default, k, v.default)
|
||||
|
||||
net.Start("ixConfigSet")
|
||||
net.WriteString(k)
|
||||
net.WriteType(newValue)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
row.OnResetClicked = function(panel)
|
||||
panel:SetValue(v.default, true)
|
||||
panel:SetShowReset(false)
|
||||
|
||||
net.Start("ixConfigSet")
|
||||
net.WriteString(k)
|
||||
net.WriteType(v.default)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
row:GetLabel():SetHelixTooltip(function(tooltip)
|
||||
local title = tooltip:AddRow("name")
|
||||
title:SetImportant()
|
||||
title:SetText(k)
|
||||
title:SizeToContents()
|
||||
title:SetMaxWidth(math.max(title:GetMaxWidth(), ScrW() * 0.5))
|
||||
|
||||
local description = tooltip:AddRow("description")
|
||||
description:SetText(v.description)
|
||||
description:SizeToContents()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
settings:SizeToContents()
|
||||
container.panel = settings
|
||||
|
||||
if settings.titlePanel then
|
||||
local pluginManager = settings.titlePanel:Add("DButton")
|
||||
pluginManager:Dock(RIGHT)
|
||||
pluginManager:SetWide(SScaleMin(100 / 3))
|
||||
pluginManager:SetFont("TitlesFontNoClamp")
|
||||
pluginManager:SetText("PLUGINS")
|
||||
pluginManager:DockMargin(0, 0, 0, settings.titlePanel:GetTall() - SScaleMin(26 / 3))
|
||||
pluginManager.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(ColorAlpha(color_white, 100))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
pluginManager.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
for _, v in pairs(container.panel:GetChildren()) do
|
||||
v:SetVisible(false)
|
||||
end
|
||||
|
||||
ix.gui.pluginManager = container.panel:Add("ixPluginManager")
|
||||
|
||||
if ix.gui.pluginManager.settingsTitle then
|
||||
ix.gui.pluginManager.settingsTitle:SetText("Plugins")
|
||||
|
||||
local configManager = ix.gui.pluginManager.titlePanel:Add("DButton")
|
||||
configManager:Dock(RIGHT)
|
||||
configManager:SetWide(SScaleMin(100 / 3))
|
||||
configManager:SetFont("TitlesFontNoClamp")
|
||||
configManager:SetText("CONFIG")
|
||||
configManager:DockMargin(0, 0, 0, settings.titlePanel:GetTall() - SScaleMin(26 / 3))
|
||||
configManager.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(ColorAlpha(color_white, 100))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
configManager.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
for _, v in pairs(container.panel:GetChildren()) do
|
||||
v:SetVisible(true)
|
||||
end
|
||||
|
||||
ix.gui.pluginManager:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local quizManager = settings.titlePanel:Add("DButton")
|
||||
quizManager:Dock(RIGHT)
|
||||
quizManager:SetWide(SScaleMin(150 / 3))
|
||||
quizManager:SetFont("TitlesFontNoClamp")
|
||||
quizManager:SetText("QUIZ MANAGER")
|
||||
quizManager:DockMargin(0, 0, SScaleMin(10 / 3), settings.titlePanel:GetTall() - SScaleMin(26 / 3))
|
||||
quizManager.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(ColorAlpha(color_white, 100))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
quizManager.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
vgui.Create("QuizPanel")
|
||||
end
|
||||
|
||||
local mainMenuManager = settings.titlePanel:Add("DButton")
|
||||
mainMenuManager:Dock(RIGHT)
|
||||
mainMenuManager:SetWide(SScaleMin(220 / 3))
|
||||
mainMenuManager:SetFont("TitlesFontNoClamp")
|
||||
mainMenuManager:SetText("MAIN MENU MANAGER")
|
||||
mainMenuManager:DockMargin(0, 0, SScaleMin(10 / 3), settings.titlePanel:GetTall() - SScaleMin(26 / 3))
|
||||
mainMenuManager.Paint = function(self, w, h)
|
||||
surface.SetDrawColor(ColorAlpha(color_white, 100))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
mainMenuManager.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
vgui.Create("MainMenuManager")
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
OnSelected = function(info, container)
|
||||
container.panel.searchEntry:RequestFocus()
|
||||
end,
|
||||
|
||||
RowNumber = 6
|
||||
}
|
||||
end)
|
||||
|
||||
hook.Add("Think", "F1Menu", function()
|
||||
if input.IsKeyDown( KEY_F1 ) then
|
||||
if ix.gui.menu and ix.gui.menu:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
if ix.gui.characterMenu and ix.gui.characterMenu:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
if ix.gui.protectionTeams and ix.gui.protectionTeams:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
if LocalPlayer():GetCharacter() then
|
||||
if ix.gui.F1Menu and ix.gui.F1Menu:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
ix.gui.F1Menu = vgui.Create("ixF1Menu")
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function PLUGIN:LoadData()
|
||||
local loaded = ix.data.Get("menuData", {})
|
||||
self.menuBackgrounds = loaded[1] or {}
|
||||
self.logoData = loaded[2] or {}
|
||||
self.buttonColors = loaded[3] or {}
|
||||
end
|
||||
|
||||
function PLUGIN:SaveData()
|
||||
ix.data.Set("menuData", {self.menuBackgrounds, self.logoData, self.buttonColors})
|
||||
end
|
||||
76
gamemodes/helix/plugins/willardinterface/sv_plugin.lua
Normal file
76
gamemodes/helix/plugins/willardinterface/sv_plugin.lua
Normal file
@@ -0,0 +1,76 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
util.AddNetworkString("ixInventoryShiftMove")
|
||||
util.AddNetworkString("ixReturnToMenu")
|
||||
|
||||
net.Receive("ixInventoryShiftMove", function(length, client)
|
||||
local itemTable = net.ReadFloat()
|
||||
local storageTable = net.ReadFloat()
|
||||
|
||||
if (!itemTable or !storageTable) then return end
|
||||
|
||||
itemTable = ix.item.instances[itemTable]
|
||||
storageTable = ix.item.inventories[storageTable]
|
||||
|
||||
if (!itemTable or !storageTable) then return end
|
||||
|
||||
if (itemTable.invID == storageTable.id) then
|
||||
local targetInventoryID = client:GetCharacter():GetInventory():GetID()
|
||||
|
||||
itemTable:Transfer(targetInventoryID)
|
||||
else
|
||||
itemTable:Transfer(storageTable.id)
|
||||
end
|
||||
end)
|
||||
|
||||
net.Receive("ixReturnToMenu", function(length, client)
|
||||
local currentCharacter = client:GetCharacter()
|
||||
local cantBypass = !CAMI.PlayerHasAccess(client, "Helix - Bypass CharSwap Disable")
|
||||
local nextSwap = client:GetData("nextCharacterSwap", -1)
|
||||
local timeCheck = nextSwap >= os.time()
|
||||
|
||||
if (nextSwap == 0) then
|
||||
timeCheck = true
|
||||
end
|
||||
|
||||
if (currentCharacter and cantBypass and (ix.config.Get("charSwapDisabled") == true or timeCheck)) then
|
||||
client:Notify("L'échange de personnage est interdit pour le moment.")
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
ix.log.Add(client, "characterUnloaded", client:GetName())
|
||||
|
||||
local character = client:GetCharacter()
|
||||
if (character) then
|
||||
character:Save()
|
||||
character:Kick()
|
||||
end
|
||||
end)
|
||||
|
||||
ix.log.AddType("characterUnloaded", function(client, ...)
|
||||
local arguments = {...}
|
||||
|
||||
return Format("%s a déchargé son personnage \"%s\".", client:SteamName(), arguments[1])
|
||||
end)
|
||||
|
||||
function PLUGIN:OnItemSpawned(itemEntity)
|
||||
local item = itemEntity:GetItemTable()
|
||||
|
||||
if (item.color) then
|
||||
itemEntity:SetColor(item.color)
|
||||
end
|
||||
|
||||
if (item.material) then
|
||||
itemEntity:SetMaterial(item.material)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user