Engine-Klasse
PluginGui
*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.
Zusammenfassung
Methoden
BindToClose(function: function):() |
Events
PluginDragDropped(dragData: Dictionary):RBXScriptSignal |
PluginDragEntered(dragData: Dictionary):RBXScriptSignal |
PluginDragLeft(dragData: Dictionary):RBXScriptSignal |
PluginDragMoved(dragData: Dictionary):RBXScriptSignal |
Geerbte Mitglieder
4 von LayerCollector geerbt
12 von GuiBase2d geerbt
57 von Instance geerbt
6 von Object geerbt
Geerbt von
API-Referenz
Eigenschaften
Methoden
BindToClose
GetRelativeMousePosition
Rückgaben
Code-Beispiele
PluginGui:GetRelativeMousePosition
local RunService = game:GetService("RunService")
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
true,
false, -- Aktivierter Zustand, überschreiben
200,
300, -- Größe
150,
150 -- Minimale Größe
)
local testWidget = plugin:CreateDockWidgetPluginGuiAsync("TestWidget", widgetInfo)
function update()
local v2 = testWidget:GetRelativeMousePosition()
testWidget.Title = ("(%d, %d)"):format(v2.x, v2.y)
end
RunService.Stepped:Connect(update)
update()Events
PluginDragDropped
Parameter
Code-Beispiele
Plugin Ziehen und Ablegen
assert(plugin, "Dieses Skript muss als Studio-Plugin ausgeführt werden")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Zugquelle", widgetInfo)
dragSourceWidget.Title = "Zugquelle"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hallo, Plugin-Zug"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Bearbeiten Sie den obigen Text, und starten Sie dann den Zug hier"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "IrgendeineZugquelle",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- Dieses Widget wird Drops empfangen
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Drop-Ziel", widgetInfo)
dragTargetWidget.Title = "Drop-Ziel"
-- Dieses TextLabel zeigt an, was abgelegt wurde
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Hier ablegen..."
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
Parameter
Code-Beispiele
Plugin Ziehen und Ablegen
assert(plugin, "Dieses Skript muss als Studio-Plugin ausgeführt werden")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Zugquelle", widgetInfo)
dragSourceWidget.Title = "Zugquelle"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hallo, Plugin-Zug"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Bearbeiten Sie den obigen Text, und starten Sie dann den Zug hier"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "IrgendeineZugquelle",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- Dieses Widget wird Drops empfangen
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Drop-Ziel", widgetInfo)
dragTargetWidget.Title = "Drop-Ziel"
-- Dieses TextLabel zeigt an, was abgelegt wurde
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Hier ablegen..."
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
Parameter
Code-Beispiele
Plugin Ziehen und Ablegen
assert(plugin, "Dieses Skript muss als Studio-Plugin ausgeführt werden")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Zugquelle", widgetInfo)
dragSourceWidget.Title = "Zugquelle"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hallo, Plugin-Zug"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Bearbeiten Sie den obigen Text, und starten Sie dann den Zug hier"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "IrgendeineZugquelle",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- Dieses Widget wird Drops empfangen
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Drop-Ziel", widgetInfo)
dragTargetWidget.Title = "Drop-Ziel"
-- Dieses TextLabel zeigt an, was abgelegt wurde
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Hier ablegen..."
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
Code-Beispiele
Erkennung des PluginGui-Fokusstatus
local info = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 200, 50, 1, 1)
local widget = plugin:CreateDockWidgetPluginGuiAsync("TestWidget", info)
local function onFocusReleased()
widget.Title = "Ich bin nicht im Fokus :("
end
local function onFocused()
widget.Title = "Ich bin im Fokus :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)WindowFocusReleased
Code-Beispiele
Erkennung des PluginGui-Fokusstatus
local info = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 200, 50, 1, 1)
local widget = plugin:CreateDockWidgetPluginGuiAsync("TestWidget", info)
local function onFocusReleased()
widget.Title = "Ich bin nicht im Fokus :("
end
local function onFocused()
widget.Title = "Ich bin im Fokus :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)