요약
메서드
BindToClose(function: function):() |
이벤트
PluginDragDropped(dragData: Dictionary):RBXScriptSignal |
PluginDragEntered(dragData: Dictionary):RBXScriptSignal |
PluginDragLeft(dragData: Dictionary):RBXScriptSignal |
PluginDragMoved(dragData: Dictionary):RBXScriptSignal |
상속된 멤버
API 참조
속성
메서드
GetRelativeMousePosition
반환
코드 샘플
PluginGui:GetRelativeMousePosition
local RunService = game:GetService("RunService")
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
true,
false, -- 사용 가능한 상태, 재정의
200,
300, -- 크기
150,
150 -- 최소 크기
)
local testWidget = plugin:CreateDockWidgetPluginGuiAsync("테스트 위젯", widgetInfo)
function update()
local v2 = testWidget:GetRelativeMousePosition()
testWidget.Title = ("(%d, %d)"):format(v2.x, v2.y)
end
RunService.Stepped:Connect(update)
update()이벤트
PluginDragDropped
매개 변수
코드 샘플
플러그인 드래그 앤 드롭
assert(plugin, "이 스크립트는 스튜디오 플러그인으로 실행되어야 합니다")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("드래그 소스", widgetInfo)
dragSourceWidget.Title = "드래그 소스"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "안녕하세요, 플러그인 드래그"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "위의 텍스트를 수정한 후 여기서 드래그를 시작하세요"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "SomeDragSource",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- 이 위젯은 드롭을 수신합니다
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("드롭 대상", widgetInfo)
dragTargetWidget.Title = "드롭 대상"
-- 이 TextLabel은 드롭된 내용을 표시합니다
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "여기에 드롭..."
textLabel.Parent = dragTargetWidget
local function onDragDrop(dragData)
if dragData.MimeType == "text/plain" then
textLabel.Text = dragData.Data
else
textLabel.Text = dragData.MimeType
end
end
dragTargetWidget.PluginDragDropped:Connect(onDragDrop)
dragTargetWidget.PluginDragEntered:Connect(function(_dragData)
print("PluginDragEntered")
end)
dragTargetWidget.PluginDragLeft:Connect(function(_dragData)
print("PluginDragLeft")
end)
dragTargetWidget.PluginDragMoved:Connect(function(_dragData)
print("PluginDragMoved")
end)PluginDragEntered
매개 변수
코드 샘플
플러그인 드래그 앤 드롭
assert(plugin, "이 스크립트는 스튜디오 플러그인으로 실행되어야 합니다")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("드래그 소스", widgetInfo)
dragSourceWidget.Title = "드래그 소스"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "안녕하세요, 플러그인 드래그"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "위의 텍스트를 수정한 후 여기서 드래그를 시작하세요"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "SomeDragSource",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- 이 위젯은 드롭을 수신합니다
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("드롭 대상", widgetInfo)
dragTargetWidget.Title = "드롭 대상"
-- 이 TextLabel은 드롭된 내용을 표시합니다
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "여기에 드롭..."
textLabel.Parent = dragTargetWidget
local function onDragDrop(dragData)
if dragData.MimeType == "text/plain" then
textLabel.Text = dragData.Data
else
textLabel.Text = dragData.MimeType
end
end
dragTargetWidget.PluginDragDropped:Connect(onDragDrop)
dragTargetWidget.PluginDragEntered:Connect(function(_dragData)
print("PluginDragEntered")
end)
dragTargetWidget.PluginDragLeft:Connect(function(_dragData)
print("PluginDragLeft")
end)
dragTargetWidget.PluginDragMoved:Connect(function(_dragData)
print("PluginDragMoved")
end)PluginDragLeft
매개 변수
코드 샘플
플러그인 드래그 앤 드롭
assert(plugin, "이 스크립트는 스튜디오 플러그인으로 실행되어야 합니다")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("드래그 소스", widgetInfo)
dragSourceWidget.Title = "드래그 소스"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "안녕하세요, 플러그인 드래그"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "위의 텍스트를 수정한 후 여기서 드래그를 시작하세요"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "SomeDragSource",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- 이 위젯은 드롭을 수신합니다
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("드롭 대상", widgetInfo)
dragTargetWidget.Title = "드롭 대상"
-- 이 TextLabel은 드롭된 내용을 표시합니다
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "여기에 드롭..."
textLabel.Parent = dragTargetWidget
local function onDragDrop(dragData)
if dragData.MimeType == "text/plain" then
textLabel.Text = dragData.Data
else
textLabel.Text = dragData.MimeType
end
end
dragTargetWidget.PluginDragDropped:Connect(onDragDrop)
dragTargetWidget.PluginDragEntered:Connect(function(_dragData)
print("PluginDragEntered")
end)
dragTargetWidget.PluginDragLeft:Connect(function(_dragData)
print("PluginDragLeft")
end)
dragTargetWidget.PluginDragMoved:Connect(function(_dragData)
print("PluginDragMoved")
end)PluginDragMoved
WindowFocused
코드 샘플
플러그인 GUI 포커스 상태 감지
local info = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 200, 50, 1, 1)
local widget = plugin:CreateDockWidgetPluginGuiAsync("테스트 위젯", info)
local function onFocusReleased()
widget.Title = "나는 포커스에 있지 않아 :("
end
local function onFocused()
widget.Title = "나는 포커스에 있어 :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)WindowFocusReleased
코드 샘플
플러그인 GUI 포커스 상태 감지
local info = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 200, 50, 1, 1)
local widget = plugin:CreateDockWidgetPluginGuiAsync("테스트 위젯", info)
local function onFocusReleased()
widget.Title = "나는 포커스에 있지 않아 :("
end
local function onFocused()
widget.Title = "나는 포커스에 있어 :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)