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

102
lua/vgui/dbinder.lua Normal file
View File

@@ -0,0 +1,102 @@
--[[
| 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, "m_iSelectedNumber", "SelectedNumber" )
Derma_Install_Convar_Functions( PANEL )
function PANEL:Init()
self:SetSelectedNumber( 0 )
self:SetSize( 60, 30 )
end
function PANEL:UpdateText()
local str = input.GetKeyName( self:GetSelectedNumber() )
if ( !str ) then str = "NONE" end
str = language.GetPhrase( str )
self:SetText( str )
end
function PANEL:DoClick()
self:SetText( "PRESS A KEY" )
input.StartKeyTrapping()
self.Trapping = true
end
function PANEL:DoRightClick()
self:SetText( "NONE" )
self:SetValue( 0 )
end
function PANEL:SetSelectedNumber( iNum )
self.m_iSelectedNumber = iNum
self:ConVarChanged( iNum )
self:UpdateText()
self:OnChange( iNum )
end
function PANEL:Think()
if ( input.IsKeyTrapping() && self.Trapping ) then
local code = input.CheckKeyTrapping()
if ( code ) then
if ( code == KEY_ESCAPE ) then
self:SetValue( self:GetSelectedNumber() )
else
self:SetValue( code )
end
self.Trapping = false
end
end
self:ConVarNumberThink()
end
function PANEL:SetValue( iNumValue )
self:SetSelectedNumber( iNumValue )
end
function PANEL:GetValue()
return self:GetSelectedNumber()
end
function PANEL:OnChange( iNum )
end
derma.DefineControl( "DBinder", "", PANEL, "DButton" )