Engine Class
DragDetector
*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่
สรุป
คุณสมบัติ
ActivatedCursorIcon:ContentId |
วิธีการ
AddConstraintFunction(priority: number,function: function):RBXScriptConnection |
RestartDrag():() |
SetDragStyleFunction(function: function):() |
SetPermissionPolicyFunction(function: function):() |
เหตุการณ์
DragContinue(playerWhoDragged: Player,cursorRay: Ray,viewFrame: CFrame,vrInputFrame: OptionalCoordinateFrame,isModeSwitchKeyDown: boolean):RBXScriptSignal |
DragEnd(playerWhoDragged: Player):RBXScriptSignal |
สมาชิกที่ได้รับทอด
สมาชิก 8 คนที่รับทอดมาจาก ClickDetector
สมาชิก 58 คนที่รับทอดมาจาก Instance
สมาชิก 6 คนที่รับทอดมาจาก Object
เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
ActivatedCursorIcon
DragDetector.ActivatedCursorIcon:ContentId
วิธีการ
AddConstraintFunction
ส่งค่ากลับ
RestartDrag
DragDetector:RestartDrag():()
ส่งค่ากลับ
()
SetDragStyleFunction
SetPermissionPolicyFunction
พารามิเตอร์
ส่งค่ากลับ
()
ตัวอย่างโค้ด
ฟังก์ชันตั้งค่านโยบายการอนุญาต
local part = Instance.new("Part")
part.Parent = workspace
local dragDetector = Instance.new("DragDetector")
dragDetector.Parent = part
dragDetector.PermissionPolicy = Enum.DragDetectorPermissionPolicy.Scriptable
dragDetector:SetPermissionPolicyFunction(function(player, part)
if player and player:GetAttribute("IsInTurn") then
return true
elseif part and not part:GetAttribute("IsDraggable") then
return false
else
return true
end
end)เหตุการณ์
DragContinue
DragEnd
DragStart