插件鼠标对象提供 Plugins 对鼠标的访问。它与 Mouse 对象类似,可以使用插件 Plugin:GetMouse() 方法获得。
注意插件鼠标只能在插件被激活使用 Plugin:Activate() 。
除了 Mouse 对象的函数外,插件鼠标包括 PluginMouse.DragEnter 函数,该函数跟踪选择中的项目,当鼠标拖动时。
了解有关使用鼠标对象的更多信息,请参阅Mouse页面。
代码示例
The code below demonstrates how the PluginMouse object can be obtained and used in a plugin. To use this code, paste it into a Script save that script to the local Plugins Folder using right click, save to file. The plugins folder can be found in the Plugins tab in the Roblox Studio toolbar.
plugin:Activate(false) -- gain non exclusive access to the mouse
local mouse = plugin:GetMouse()
local function button1Down()
print("Left mouse click")
end
mouse.Button1Down:Connect(button1Down)
概要
属性
继承自Mouse的属性鼠标在 3D 空间中的位置的 CFrame 。
Class.Mouse 图标的图像的内容 标志。
Datatype.CFrame 位于Workspace.CurrentCamera 并向鼠标的 3D 位置。
在 3D 空间中的对象指向 mouse 。
在确定 Mouse.Hit 和 Mouse.Target 时,确定要忽略对象 (和其子对象)。
指示 Enum.NormalId 表面的 BasePart 。
一个 Ray 朝着鼠标世界位置,起源于 Workspace.CurrentCamera 世界位置。
描述游戏窗口的宽度以像素计。
描述游戏窗口的高度以像素计。
描述鼠标位置在屏幕上的 X 部分。
描述鼠标屏幕位置的 Y 组件(垂直)。
活动
拖动鼠标时选择实例时发射。
按左键时触发。
在左键点按释放时发射。
当右键点按时触发。
发生在右键点按释放时。
每次心跳时,鼠标不会被传到另一个鼠标事件。
移动鼠标时发射。
触发时,鼠标轮向后滚动。
触发时,鼠标轮向前滚动。
属性
方法
活动
DragEnter
拖动鼠标时选择实例时发射。