Skip to content

Commit

Permalink
Add loading screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom committed May 24, 2020
1 parent 0953f01 commit 13995f3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
15 changes: 13 additions & 2 deletions lua/entities/glorifiedbanking_cardreader/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ ENT.Screens[2].drawFunction = function(self) --Transaction confirm screen

if imgui.IsHovering(scrw * .075, 550, scrw * .85, 120) then
hovering = true
draw.RoundedBox(12, scrw * .075, 550, scrw * .85, 120, theme.Data.Colors.readerConfirmBgHoverCol)
draw.RoundedBox(10, scrw * .075, 550, scrw * .85, 120, theme.Data.Colors.readerConfirmBgHoverCol)

if imgui.IsPressed() then
net.Start("GlorifiedBanking.CardReader.ConfirmTransaction")
net.WriteEntity(self)
net.SendToServer()
end
else
draw.RoundedBox(12, scrw * .075, 550, scrw * .85, 120, theme.Data.Colors.readerConfirmBgCol)
draw.RoundedBox(10, scrw * .075, 550, scrw * .85, 120, theme.Data.Colors.readerConfirmBgCol)
end

local iconsize = 55
Expand All @@ -99,6 +99,17 @@ ENT.Screens[2].drawFunction = function(self) --Transaction confirm screen
return hovering
end

ENT.Screens[3].drawFunction = function(self) --Loading screen
surface.SetDrawColor(theme.Data.Colors.readerBgCol)
surface.DrawRect(0, 0, scrw, scrh)

surface.SetDrawColor(theme.Data.Colors.readerLoadingSpinnerCol)
surface.SetMaterial(theme.Data.Materials.loading)
surface.DrawTexturedRectRotated(scrw * .5, scrh * .5 - 50, 200, 200, -CurTime() * 100)

draw.SimpleText(i18n.GetPhrase("gbReaderLoading"), "GlorifiedBanking.ReaderEntity.Loading", scrw * .5, scrh * .5 + 100, theme.Data.Colors.readerLoadingTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end

function ENT:DrawTranslucent()
self:DrawModel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ i18n.RegisterPhrases( "en", {
gbCantPaySelf = "You can't pay yourself!",
gbNeedCard = "You need to have your card in hand to make this payment!",
gbConfirm = "CONFIRM",
gbReaderLoading = "PLEASE WAIT",
gbEnterAmount = "ENTER AMOUNT",
gbAdminMenuPlayers = "PLAYERS",
gbAdminMenuLogs = "LOGS",
Expand Down
3 changes: 0 additions & 3 deletions lua/glorifiedbanking/modules/core/sv_glorifiedbanking_net.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ net.Receive("GlorifiedBanking.CardReader.ConfirmTransaction", function( len, ply
readerEntity:EmitSound("GlorifiedBanking.Beep_Reader_Normal")

readerEntity:Transfer(ply)

readerEntity:SetTransactionAmount( 0 )
readerEntity:SetScreenID( 1 )
end)

net.Receive( "GlorifiedBanking.AdminPanel.SetPlayerBalance", function( len, ply )
Expand Down
Binary file added materials/glorified_banking/loading_spinner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 13995f3

Please sign in to comment.