@@ -28,20 +28,6 @@ local isTenFootInterface = tenFootInterface:IsEnabled()
2828local radialButtons = {}
2929local lastInputChangedCon = nil
3030
31- local function getButtonForCoreGuiType (coreGuiType )
32- if coreGuiType == Enum .CoreGuiType .All then
33- return radialButtons
34- else
35- for button , table in pairs (radialButtons ) do
36- if table [" CoreGuiType" ] == coreGuiType then
37- return button
38- end
39- end
40- end
41-
42- return nil
43- end
44-
4531local function getImagesForSlot (slot )
4632 if slot == 1 then return " rbxasset://textures/ui/Settings/Radial/Top.png" , " rbxasset://textures/ui/Settings/Radial/TopSelected.png" ,
4733 " rbxasset://textures/ui/Settings/Radial/Menu.png" ,
@@ -111,6 +97,26 @@ local function setButtonEnabled(button, enabled)
11197 radialButtons [button ][" Disabled" ] = not enabled
11298end
11399
100+ local function setButtonVisible (button , visible )
101+ button .Visible = visible
102+ if not visible then
103+ setButtonEnabled (button , false )
104+ end
105+ end
106+
107+ local function enableVR ()
108+ local visibleButtons = {
109+ Settings = true , LeaveGame = true ,
110+ PlayerList = false , Notifications = false ,
111+ Backpack = false , Chat = false
112+ }
113+ for button , _ in pairs (radialButtons ) do
114+ if visibleButtons [button .Name ] ~= nil then
115+ setButtonVisible (button , visibleButtons [button .Name ])
116+ end
117+ end
118+ end
119+
114120local emptySelectedImageObject = utility :Create ' ImageLabel'
115121{
116122 BackgroundTransparency = 1 ,
@@ -173,7 +179,7 @@ local function createRadialButton(name, text, slot, disabled, coreGuiType, activ
173179 TextColor3 = Color3 .new (1 ,1 ,1 ),
174180 Name = " RadialLabel" ,
175181 Visible = false ,
176- ZIndex = 2 ,
182+ ZIndex = 3 ,
177183 Parent = radialButton
178184 };
179185 if not smallScreen then
@@ -297,7 +303,7 @@ local function createGamepadMenuGui()
297303 ---- -------- Chat ---------------
298304 local chatFunc = function ()
299305 toggleCoreGuiRadial ()
300- local ChatModule = require (GuiRoot .Modules .Chat )
306+ local ChatModule = require (GuiRoot .Modules .ChatSelector )
301307 ChatModule :ToggleVisibility ()
302308 end
303309 local chatRadial = createRadialButton (" Chat" , " Chat" , 6 , not StarterGui :GetCoreGuiEnabled (Enum .CoreGuiType .Chat ), Enum .CoreGuiType .Chat , chatFunc )
@@ -380,6 +386,10 @@ local function createGamepadMenuGui()
380386 end
381387 end
382388 end )
389+
390+ if InputService .VREnabled then
391+ enableVR ()
392+ end
383393end
384394
385395local function isCoreGuiDisabled ()
@@ -523,14 +533,16 @@ local function setupGamepadControls()
523533 end
524534 end
525535
526- function setOverrideMouseIconBehavior ()
527- pcall ( function ()
536+ function setOverrideMouseIconBehavior (override )
537+ if override then
528538 if InputService :GetLastInputType () == Enum .UserInputType .Gamepad1 then
529539 InputService .OverrideMouseIconBehavior = Enum .OverrideMouseIconBehavior .ForceHide
530540 else
531541 InputService .OverrideMouseIconBehavior = Enum .OverrideMouseIconBehavior .ForceShow
532542 end
533- end )
543+ else
544+ InputService .OverrideMouseIconBehavior = Enum .OverrideMouseIconBehavior .None
545+ end
534546 end
535547
536548 function toggleCoreGuiRadial (goingToSettings )
@@ -539,8 +551,8 @@ local function setupGamepadControls()
539551 setVisibility ()
540552
541553 if isVisible then
542- setOverrideMouseIconBehavior ()
543- pcall ( function () lastInputChangedCon = InputService .LastInputTypeChanged :connect (setOverrideMouseIconBehavior ) end )
554+ setOverrideMouseIconBehavior (true )
555+ lastInputChangedCon = InputService .LastInputTypeChanged :connect (function () setOverrideMouseIconBehavior ( true ) end )
544556
545557 gamepadSettingsFrame .Visible = isVisible
546558
@@ -560,8 +572,7 @@ local function setupGamepadControls()
560572 lastInputChangedCon :disconnect ()
561573 lastInputChangedCon = nil
562574 end
563- pcall (function () InputService .OverrideMouseIconBehavior = Enum .OverrideMouseIconBehavior .None end )
564-
575+
565576 local settingsChildren = gamepadSettingsFrame :GetChildren ()
566577 for i = 1 , # settingsChildren do
567578 if settingsChildren [i ]:IsA (" GuiButton" ) then
@@ -571,6 +582,9 @@ local function setupGamepadControls()
571582 gamepadSettingsFrame :TweenSizeAndPosition (UDim2 .new (0 ,102 ,0 ,102 ), UDim2 .new (0.5 ,- 51 ,0.5 ,- 51 ),
572583 Enum .EasingDirection .Out , Enum .EasingStyle .Sine , 0.1 , true ,
573584 function ()
585+ if not InputService .VREnabled then
586+ setOverrideMouseIconBehavior (false )
587+ end
574588 if not goingToSettings and not isVisible then GuiService :SetMenuIsOpen (false ) end
575589 gamepadSettingsFrame .Visible = isVisible
576590 end )
@@ -601,9 +615,11 @@ local function setupGamepadControls()
601615
602616 doGamepadMenuButton = function (name , state , input )
603617 if state ~= Enum .UserInputState .Begin then return end
604-
605- if not toggleCoreGuiRadial () then
606- unbindAllRadialActions ()
618+
619+ if game .IsLoaded then
620+ if not toggleCoreGuiRadial () then
621+ unbindAllRadialActions ()
622+ end
607623 end
608624 end
609625
@@ -617,35 +633,47 @@ local function setupGamepadControls()
617633 end )
618634 end
619635
636+ -- some buttons always show/hide depending on platform
637+ local function canChangeButtonVisibleState (buttonType )
638+ if isTenFootInterface then
639+ if buttonType == Enum .CoreGuiType .Chat or buttonType == Enum .CoreGuiType .PlayerList then
640+ return false
641+ end
642+ end
643+
644+ return true
645+ end
646+
620647 local function setRadialButtonEnabled (coreGuiType , enabled )
621- local returnValue = getButtonForCoreGuiType (coreGuiType )
622- if not returnValue then return end
623-
624- local buttonsToDisable = {}
625- if type (returnValue ) == " table" then
626- for button , buttonTable in pairs (returnValue ) do
627- if buttonTable [" CoreGuiType" ] then
628- if isTenFootInterface and buttonTable [" CoreGuiType" ] == Enum .CoreGuiType .Chat then
629- else
630- buttonsToDisable [# buttonsToDisable + 1 ] = button
648+ for button , buttonTable in pairs (radialButtons ) do
649+ local buttonType = buttonTable [" CoreGuiType" ]
650+ if buttonType then
651+ if coreGuiType == buttonType or coreGuiType == Enum .CoreGuiType .All then
652+ if canChangeButtonVisibleState (buttonType ) then
653+ setButtonEnabled (button , enabled )
631654 end
632655 end
633656 end
634- else
635- if isTenFootInterface and returnValue .Name == " Chat" then
636- else
637- buttonsToDisable [1 ] = returnValue
638- end
639657 end
640-
641- for i = 1 , # buttonsToDisable do
642- local button = buttonsToDisable [i ]
643- setButtonEnabled (button , enabled )
658+ end
659+
660+ local loadedConnection
661+ local function enableRadialMenu ()
662+ ContextActionService :BindCoreAction (toggleMenuActionName , doGamepadMenuButton , false , Enum .KeyCode .ButtonStart )
663+ loadedConnection :disconnect ()
664+ end
665+
666+ loadedConnection = game .Players .PlayerAdded :connect (function (plr )
667+ if game .Players .LocalPlayer and plr == game .Players .LocalPlayer then
668+ enableRadialMenu ()
644669 end
670+ end )
671+
672+ if game .Players .LocalPlayer then
673+ enableRadialMenu ()
645674 end
675+
646676 StarterGui .CoreGuiChangedSignal :connect (setRadialButtonEnabled )
647-
648- ContextActionService :BindCoreAction (toggleMenuActionName , doGamepadMenuButton , false , Enum .KeyCode .ButtonStart )
649677end
650678
651679-- hook up gamepad stuff
0 commit comments