Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add panel visibility hooks #36

Merged
merged 4 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/mapvote/client/modules/map_vote.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function MapVote.StartVote( maps, endTime )
MapVote.Panel = frame

hook.Run( "MapVote_VoteStarted" )
hook.Run( "MapVote_PanelOpened" )
end

hook.Add( "Tick", "MapVote_RequestState", function()
Expand Down
1 change: 1 addition & 0 deletions lua/mapvote/client/modules/reopen_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ hook.Add( "PlayerButtonDown", "MapVote_ReopenMapvote", function( _, button )
if button ~= KEY_F3 then return end
if not IsValid( MapVote.Panel ) then return end
MapVote.Panel:SetVisible( true )
hook.Run( "MapVote_PanelOpened" )
end )

hook.Add( "HUDPaint", "MapVote_DrawOpenNotification", function()
Expand Down
2 changes: 2 additions & 0 deletions lua/mapvote/client/vgui/frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ function PANEL:Init()
drawCircle( w / 2, h / 2 + 2, r, circleSegments )
end
self.btnClose.DoClick = function()
hook.Run( "MapVote_PanelClosed" )
StyledStrike marked this conversation as resolved.
Show resolved Hide resolved

if self.hideOnClose then
self:SetVisible( false )
return
Expand Down