Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UIManager = {
- CurrentlyOpen = nil,
- }
- --Config
- local tweenSpeed = 0.4
- function UIManager:Toggle(frame)
- if UIManager.CurrentlyOpen and UIManager.CurrentlyOpen == frame then
- --Close
- local s = frame.AbsoluteSize
- frame:TweenPosition(UDim2.new(0.5,-s.X/2,0,-s.Y-100),"Out","Quint",tweenSpeed,true)
- UIManager.CurrentlyOpen = nil
- return
- end
- if UIManager.CurrentlyOpen then
- --Close
- local s = UIManager.CurrentlyOpen.AbsoluteSize
- UIManager.CurrentlyOpen:TweenPosition(UDim2.new(0.5,-s.X/2,0,-s.Y-100),"Out","Quint",tweenSpeed,true)
- UIManager.CurrentlyOpen = nil
- end
- if frame then
- local s = frame.AbsoluteSize
- frame:TweenPosition(UDim2.new(0.5,-s.X/2,0.5,-s.Y/2),"Out","Quint",tweenSpeed,true)
- UIManager.CurrentlyOpen = frame
- end
- end
- return UIManager
- --[[
- To use:
- UIManager:Toggle(someUI) --Hides any UI currently showing, then tweens this in. If someUI is already
- open it will hide it
- UIManager:Toggle() --Hides any UI currently open
- --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement