Lớp công cụ
GamepadService
*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.
Tài Liệu Tham Khảo API
Thuộc Tính
GamepadCursorEnabled
Mẫu mã
GamepadService - Thuộc tính Bật Con Trỏ Gamepad
local gamepadService = game.GamepadService
gamepadService:GetPropertyChangedSignal("GamepadCursorEnabled"):Connect(function()
local enabled = gamepadService.GamepadCursorEnabled
if enabled then
-- Mã tùy chỉnh khi con trỏ ảo được bật
else
-- Mã tùy chỉnh khi con trỏ ảo bị tắt
end
end)Phương Pháp
DisableGamepadCursor
GamepadService:DisableGamepadCursor():()
Lợi Nhuận
()
Mẫu mã
GamepadService - Vô hiệu hóa con trỏ Gamepad
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
Tham Số
Lợi Nhuận
()
Mẫu mã
GamepadService - Kích hoạt Con trỏ Gamepad
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)