學習
引擎類別
GamepadService
無法建立
服務
未複製

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡


概要
繼承成員

API 參考
屬性
GamepadCursorEnabled
Roblox 指令碼安全性
平行讀取
功能: Input
GamepadService.GamepadCursorEnabled:boolean
範例程式碼
遊戲手把服務 - 遊戲手把游標啟用屬性
local gamepadService = game.GamepadService
gamepadService:GetPropertyChangedSignal("GamepadCursorEnabled"):Connect(function()
local enabled = gamepadService.GamepadCursorEnabled
if enabled then
-- 當虛擬游標啟用時的自定義代碼
else
-- 當虛擬游標禁用時的自定義代碼
end
end)

方法
DisableGamepadCursor
功能: Input
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
功能: Input
GamepadService:EnableGamepadCursor(guiObject:Instance):()
參數
guiObject:Instance
返回
()
範例程式碼
手把服務 - 啟用手把游標
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)

©2026 Roblox Corporation、Roblox、Roblox 標誌及 Powering Imagination 是我們在美國及其他國家地區的部分註冊與未註冊商標。