Gamepad Service
*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่
เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
Gamepad Cursor Enabled
ตัวอย่างโค้ด
GamepadService - คุณสมบัติการเปิดใช้งานเคอร์เซอร์เกมแพด
local gamepadService = game:GetService("GamepadService")
gamepadService:GetPropertyChangedSignal("GamepadCursorEnabled"):Connect(function()
local enabled = gamepadService.GamepadCursorEnabled
if enabled then
-- โค้ดที่กำหนดเองเมื่อเคอร์เซอร์เสมือนเปิดใช้งาน
else
-- โค้ดที่กำหนดเองเมื่อเคอร์เซอร์เสมือนปิดใช้งาน
end
end)วิธีการ
Disable Gamepad Cursor
Gamepad Service: Disable Gamepad Cursor():()
ส่งค่ากลับ
()
ตัวอย่างโค้ด
GamepadService - ปิดการใช้งานเคอร์เซอร์เกมแพด
local gamepadService = game:GetService("GamepadService")
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.ButtonB then
gamepadService:DisableGamepadCursor()
end
end)Enable Gamepad Cursor
พารามิเตอร์
| ค่าเริ่มต้น: nil |
ส่งค่ากลับ
()
ตัวอย่างโค้ด
GamepadService - เปิดใช้งานเคอร์เซอร์เกมแพด
local gamepadService = game:GetService("GamepadService")
local userInputService = game:GetService("UserInputService")
local startObject = script.Parent
userInputService.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.ButtonA then
gamepadService:EnableGamepadCursor(startObject)
end
end)