Skip to content

Commit

Permalink
derna changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GlorifiedPig committed Aug 17, 2017
1 parent fb77dd6 commit 9a13f18
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 12 deletions.
146 changes: 135 additions & 11 deletions lua/glorifiedbanking/module/panel/cl_banking_panel.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

surface.CreateFont( "VerdanaCustom", {
font = "Verdana",
size = 13,
size = 16,
weight = 500,
} )

Expand Down Expand Up @@ -45,6 +45,21 @@ local function OpenWithdrawPanel()
self.finishedAnimation = false
end
WithdrawFrame.Think = function( self, w, h )
if !Frame:IsVisible() then
self:Close()

return
end

if input.IsKeyDown( KEY_ESCAPE ) then
if !self.finishedCloseAnimation then
self:Close()
RunConsoleCommand( "cancelselect" )
end

return
end

if self.finishedAnimation then return end
if WithdrawFrame.y == ScrH() then
WithdrawFrame:MoveTo( ScrW() / 2 - boxW / 2, ScrH() / 2 - boxH / 2, 0.5 )
Expand Down Expand Up @@ -183,13 +198,20 @@ local function OpenWithdrawPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

draw.OutlinedBox( 0, 0, w, h, 2, Color( 0, 0, 0 ) )
Expand Down Expand Up @@ -233,13 +255,20 @@ local function OpenWithdrawPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

draw.OutlinedBox( 0, 0, w, h, 2, Color( 0, 0, 0 ) )
Expand All @@ -261,6 +290,21 @@ local function OpenDepositPanel()
self.finishedAnimation = false
end
DepositFrame.Think = function( self, w, h )
if !Frame:IsVisible() then
self:Close()

return
end

if input.IsKeyDown( KEY_ESCAPE ) then
if !self.finishedCloseAnimation then
self:Close()
RunConsoleCommand( "cancelselect" )
end

return
end

if self.finishedAnimation then return end
if DepositFrame.y == ScrH() then
DepositFrame:MoveTo( ScrW() / 2 - boxW / 2, ScrH() / 2 - boxH / 2, 0.5 )
Expand Down Expand Up @@ -395,13 +439,20 @@ local function OpenDepositPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

draw.OutlinedBox( 0, 0, w, h, 2, Color( 0, 0, 0 ) )
Expand Down Expand Up @@ -445,13 +496,20 @@ local function OpenDepositPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

draw.OutlinedBox( 0, 0, w, h, 2, Color( 0, 0, 0 ) )
Expand All @@ -473,6 +531,21 @@ local function OpenTransferPanel()
self.finishedAnimation = false
end
TransferFrame.Think = function( self, w, h )
if !Frame:IsVisible() then
self:Close()

return
end

if input.IsKeyDown( KEY_ESCAPE ) then
if !self.finishedCloseAnimation then
self:Close()
RunConsoleCommand( "cancelselect" )
end

return
end

if self.finishedAnimation then return end
if TransferFrame.y == ScrH() then
TransferFrame:MoveTo( ScrW() / 2 - boxW / 2, ScrH() / 2 - boxH / 2, 0.5 )
Expand Down Expand Up @@ -641,13 +714,20 @@ local function OpenTransferPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

draw.OutlinedBox( 0, 0, w, h, 2, Color( 0, 0, 0 ) )
Expand Down Expand Up @@ -691,13 +771,20 @@ local function OpenTransferPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

draw.OutlinedBox( 0, 0, w, h, 2, Color( 0, 0, 0 ) )
Expand All @@ -724,7 +811,23 @@ local function OpenBankingPanel()
self.startTime = SysTime()
end
Frame.Think = function( self, w, h )
if !atmEntity:IsValid() or ply:GetPos():Distance( atmEntity:GetPos() ) > 100 then if !self.finishedCloseAnimation then Frame:Close() end return end
if !atmEntity:IsValid() or ply:GetPos():Distance( atmEntity:GetPos() ) > 100 or !ply:Alive() then
if !self.finishedCloseAnimation then
Frame:Close()
end

return
end

if input.IsKeyDown( KEY_ESCAPE ) then
if !self.finishedCloseAnimation then
Frame:Close()
RunConsoleCommand( "cancelselect" )
end

return
end

if self.finishedAnimation then return end

if Frame.y == ScrH() then
Expand Down Expand Up @@ -801,12 +904,19 @@ local function OpenBankingPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

Expand Down Expand Up @@ -849,12 +959,19 @@ local function OpenBankingPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

Expand Down Expand Up @@ -898,12 +1015,19 @@ local function OpenBankingPanel()

draw.RoundedBox( 0, 0, 0, w, h, c )
end
else
elseif self:IsHovered() && !self:IsDown() then
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, 255 )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, 255 )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, 255 )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
else
self.LerpedButtonValueR = Lerp( FrameTime() * 7, self.LerpedButtonValueR, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.r )
self.LerpedButtonValueG = Lerp( FrameTime() * 7, self.LerpedButtonValueG, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.g )
self.LerpedButtonValueB = Lerp( FrameTime() * 7, self.LerpedButtonValueB, glorifiedbanking.config.DERMA_ONCLICK_COLOUR.b )
draw.RoundedBox( 0, 0, 0, w, h, Color( self.LerpedButtonValueR, self.LerpedButtonValueG, self.LerpedButtonValueB, c.a ) )

self.RecentHover = true
end

Expand Down
4 changes: 3 additions & 1 deletion lua/glorifiedbanking/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ glorifiedbanking.config.ATM_3D2D_ROTATION_SPEED = 0 -- The rotation speed of the

glorifiedbanking.config.DERMA_BACKGROUND_COLOR = Color( 0, 0, 0, 150 ) -- The default colour of the background on the Derma menu.
glorifiedbanking.config.DERMA_BACKGROUND_COLOR_SUBSECTION = Color( 35, 35, 35, 255 ) -- The default colour on the Withdrawal, Deposit and Transfer section.
glorifiedbanking.config.DERMA_BUTTON_COLOUR = Color( 155, 155, 155, 25 ) -- The default button colours of the ATM menu. We suggest you keep the alpha value as low as possible.
glorifiedbanking.config.DERMA_BUTTON_COLOUR = Color( 155, 155, 155, 35 ) -- The default button colours of the ATM menu. We suggest you keep the alpha value as low as possible.

glorifiedbanking.config.DERMA_ONCLICK_COLOUR = Color( 55, 55, 255 ) -- The colour that is lerped to when the button is clicked.

glorifiedbanking.config.ADMIN_INHERIT_MINIMUM = "superadmin" -- The minimum rank requirement (inherits from "x") to be able to use administrative commands.

Expand Down

0 comments on commit 9a13f18

Please sign in to comment.