UIScale
*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.
Przedmiot UIScale zawiera po prostu liczbę, która jest używana do pomnożenia GuiBase2d.AbsoluteSize elementu UI rodzica. Ta liczba jest przechowywana w UIScale.Scale .
Przykłady kodu
This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.
-- 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
Podsumowanie
Właściwości
Określa mnożnik, który ma zastosowanie do rozmiaru elementu UI rodzica.
Właściwości
Scale
Właściwość Skala określa mnożnik używany na elementach UI rodzica GuiBase2d.AbsoluteSize.Gdy ustawiono na 0.5, wielkość absolutna 0, 200, 0, 50 staje się 0, 100, 0, 25.Podobnie, gdy ustawiono na 2, taki absolutny rozmiar stałby się 0, 400, 0, 100.
Przykłady kodu
This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.
-- 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