-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDualAction.lua
74 lines (60 loc) · 1.95 KB
/
DualAction.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Roact = require(script.Parent.Parent.Roact)
local GetAffectedObjects = require(script.Parent.GetAffectedObjects)
return function(props)
return Roact.createElement("Frame", {
Size = UDim2.new(1, 0, 0, 32),
BackgroundTransparency = 1,
}, {
Off = Roact.createElement("TextButton", {
Size = UDim2.new(0.5, -5, 0, 32),
LayoutOrder = 1,
FontFace = Font.new(
"rbxasset://fonts/families/SourceSansPro.json",
Enum.FontWeight.Bold,
Enum.FontStyle.Normal
),
Text = props.text,
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = 28,
BackgroundColor3 = Color3.fromRGB(255, 102, 102),
BorderSizePixel = 0,
[Roact.Event.MouseButton1Click] = function()
props.onDisable(GetAffectedObjects(props.predicate))
ChangeHistoryService:SetWaypoint("Asset Optimizer Action: " .. props.text)
end,
}, {
UICorner = Roact.createElement("UICorner"),
UIFlexItem = Roact.createElement("UIFlexItem", {
FlexMode = Enum.UIFlexMode.Fill,
}),
}),
On = Roact.createElement("TextButton", {
Size = UDim2.new(0.5, -5, 0, 32),
FontFace = Font.new(
"rbxasset://fonts/families/SourceSansPro.json",
Enum.FontWeight.Bold,
Enum.FontStyle.Normal
),
Text = props.text,
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = 28,
BackgroundColor3 = Color3.fromRGB(38, 217, 100),
BorderSizePixel = 0,
[Roact.Event.MouseButton1Click] = function()
props.onEnable(GetAffectedObjects(props.predicate))
ChangeHistoryService:SetWaypoint("Asset Optimizer Action: " .. props.text)
end,
}, {
UICorner = Roact.createElement("UICorner"),
UIFlexItem = Roact.createElement("UIFlexItem", {
FlexMode = Enum.UIFlexMode.Fill,
}),
}),
UIListLayout = Roact.createElement("UIListLayout", {
Padding = UDim.new(0, 5),
FillDirection = Enum.FillDirection.Horizontal,
SortOrder = Enum.SortOrder.LayoutOrder,
}),
})
end