概要
方法
DisableGamepadCursor():() |
EnableGamepadCursor(guiObject: Instance):() |
API 參考
屬性
GamepadCursorEnabled
範例程式碼
遊戲手把服務 - 遊戲手把游標啟用屬性
local gamepadService = game.GamepadService
gamepadService:GetPropertyChangedSignal("GamepadCursorEnabled"):Connect(function()
local enabled = gamepadService.GamepadCursorEnabled
if enabled then
-- 當虛擬游標啟用時的自定義代碼
else
-- 當虛擬游標禁用時的自定義代碼
end
end)方法
DisableGamepadCursor
GamepadService:DisableGamepadCursor():()
返回
()
範例程式碼
手把服務 - 禁用手把游標
local gamepadService = game.GamepadService
local userInputService = game.UserInputService
userInputService.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.ButtonB then
gamepadService:DisableGamepadCursor()
end
end)EnableGamepadCursor
參數
返回
()
範例程式碼
手把服務 - 啟用手把游標
local gamepadService = game.GamepadService
local userInputService = game.UserInputService
local startObject = script.Parent
userInputService.InputBegan:Connect(function(inputObject,
gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.ButtonA then
gamepadService:EnableGamepadCursor(startObject)
end
end)