UIScale

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

一个 UIScale 对象只包含一个数量,用于乘以父级 UI 元素的 GuiBase2d.AbsoluteSize。此数量存储在 UIScale.Scale 中。

代码示例

UI Scale Demo

-- Lay out the images in a list
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- Create some images of varying sizes using UIScale objects
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- an image of a Lock
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- Scale the image by adding a UIScale with the size
-- Note: this is a shorthand since we don't need a reference to the UIScale
Instance.new("UIScale", image).Scale = size
end

属性

Scale

读取并联

Class.GuiBase2d.AbsoluteSize 。当设置为 0.5 时,父 UI 元素的 {0, 200} 使用的乘数变为 0.5。同样,当设置为 2 时,该乘数将变为 0.400、0.100、0.500。

代码示例

UI Scale Demo

-- Lay out the images in a list
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- Create some images of varying sizes using UIScale objects
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- an image of a Lock
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- Scale the image by adding a UIScale with the size
-- Note: this is a shorthand since we don't need a reference to the UIScale
Instance.new("UIScale", image).Scale = size
end

方法

活动