Engine Class
GamepadService
*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่
เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
GamepadCursorEnabled
ตัวอย่างโค้ด
GamepadService - คุณสมบัติการเปิดใช้งานเคอร์เซอร์เกมแพด
local gamepadService = game.GamepadService
gamepadService:GetPropertyChangedSignal("GamepadCursorEnabled"):Connect(function()
local enabled = gamepadService.GamepadCursorEnabled
if enabled then
-- โค้ดที่กำหนดเองเมื่อเคอร์เซอร์เสมือนเปิดใช้งาน
else
-- โค้ดที่กำหนดเองเมื่อเคอร์เซอร์เสมือนปิดใช้งาน
end
end)วิธีการ
DisableGamepadCursor
GamepadService:DisableGamepadCursor():()
ส่งค่ากลับ
()
ตัวอย่างโค้ด
GamepadService - ปิดการทำงานของตัวชี้เกมแพด
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
พารามิเตอร์
ส่งค่ากลับ
()
ตัวอย่างโค้ด
GamepadService - เปิดใช้งานตัวชี้เกมแพด
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)