Informacje o wersji
Edukacja
Klasa silnika
StyleRule

*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.


Podsumowanie
Metody
GetProperty(name: string):Variant
SetDefaultPropertyTransition(transitionParams: Variant):()
SetProperties(styleProperties: Dictionary):()
SetProperty(name: string,value: Variant):()
SetPropertyTransition(property: string,transitionParams: Variant):()
Członkowie odziedziczeni

Materiały referencyjne dotyczące interfejsów API
Właściwości
Priority
Odczyt równoległy
Możliwości: UI
StyleRule.Priority:number

Selector
Odczyt równoległy
Możliwości: UI
StyleRule.Selector:string
Przykłady kodu
Wybór klasy interfejsu
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- Selektor klasy
rule.Selector = "TextButton"
-- Ustaw właściwości reguły
rule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("335FFF"),
["TextColor3"] = Color3.fromHex("E1E1E1"),
["Size"] = UDim2.new(0.15, 0, 0, 40),
["BorderSizePixel"] = 0,
})
local button = Instance.new("TextButton")
button.Text = "Menu główne"
button.Parent = screenGui
Selektor Tagów UI
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- Selektor tagów
rule.Selector = ".ButtonPrimary"
-- Ustaw właściwości reguły
rule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["TextColor3"] = Color3.fromHex("E1E1E1"),
["Size"] = UDim2.new(0.15, 0, 0, 40),
["BorderSizePixel"] = 0,
})
local button = Instance.new("TextButton")
button.Text = "Menu Główne"
button.Parent = screenGui
-- Zastosuj tag do przycisku
CollectionService:AddTag(button, "ButtonPrimary")
Selector Modyfikatora UI
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- Selekcja komponentu UI
rule.Selector = "Frame.RoundedCorner20::UICorner"
-- Ustawienie właściwości reguły
rule:SetProperty("CornerRadius", UDim.new(0, 20))
-- Utworzenie ramki
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0.4, 0, 0.2, 0)
frame.Parent = screenGui
-- Zastosowanie tagu do ramki
CollectionService:AddTag(frame, "RoundedCorner20")
Kwerenda Stylu UI
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local smallRule = Instance.new("StyleRule")
smallRule.Parent = coreSheet
local mediumRule = Instance.new("StyleRule")
mediumRule.Parent = coreSheet
-- Deklaruj selektory kwerend stylu
smallRule.Selector = "@Small"
mediumRule.Selector = "@Medium"
-- Ustaw właściwości reguły
smallRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["Text"] = "Mały Kontener",
["TextColor3"] = Color3.fromHex("E1E1E1"),
["TextSize"] = 12,
})
mediumRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("F0F0F0"),
["Text"] = "Średni Kontener",
["TextColor3"] = Color3.fromHex("0022FC"),
["TextSize"] = 24,
})
local button = Instance.new("TextButton")
button.Text = "Menu Główne"
button.Parent = screenGui
button.Size = UDim2.fromScale(0.5, 0.2)
-- Utwórz kwerendy stylu z nazwami odpowiadającymi selektorom reguł stylu
local mediumSQ = Instance.new("StyleQuery")
mediumSQ.Parent = button
mediumSQ.Name = "Medium"
mediumSQ:SetConditions({
["MinSize"] = Vector2.new(200, 0),
})
local smallSQ = Instance.new("StyleQuery")
smallSQ.Parent = button
smallSQ.Name = "Small"
smallSQ:SetConditions({
["MaxSize"] = Vector2.new(200, math.huge),
["MinSize"] = Vector2.new(0, 0),
})

SelectorError
Tylko do odczytu
Bez replikacji
Odczyt równoległy
Możliwości: UI
StyleRule.SelectorError:string

Metody
GetDefaultPropertyTransition
Możliwości: UI
StyleRule:GetDefaultPropertyTransition():Variant
Zwroty
Variant

GetProperties
Możliwości: UI
StyleRule:GetProperties():Dictionary

GetProperty
Możliwości: UI
StyleRule:GetProperty(name:string):Variant
Parametry
name:string
Zwroty
Variant

GetPropertyTransitions
Możliwości: UI
StyleRule:GetPropertyTransitions():Dictionary
Przykłady kodu
GetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Pobierz odniesienie do zasady stylu
local frameRule = coreSheet.Frame
-- Ustaw kilka przejść
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(1, Enum.EasingStyle.Linear))
frameRule:SetPropertyTransition("BackgroundTransparency", "$DefaultTransition")
local transitions = frameRule:GetPropertyTransitions()
print(transitions)

SetDefaultPropertyTransition
Możliwości: UI
StyleRule:SetDefaultPropertyTransition(transitionParams:Variant):()
Parametry
transitionParams:Variant
Zwroty
()

SetProperties
Możliwości: UI
StyleRule:SetProperties(styleProperties:Dictionary):()
Parametry
styleProperties:Dictionary
Zwroty
()

SetProperty
Możliwości: UI
StyleRule:SetProperty(
name:string, value:Variant
):()
Parametry
name:string
value:Variant
Zwroty
()

SetPropertyTransition
Możliwości: UI
StyleRule:SetPropertyTransition(
property:string, transitionParams:Variant
):()
Parametry
property:string
transitionParams:Variant
Zwroty
()
Przykłady kodu
SetPropertyTransition()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Uzyskaj odniesienie do reguły stylu
local frameRule = coreSheet.Frame
-- Ustaw 1-sekundową liniową przejrzystość na BackgroundColor3
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(
1, -- Czas
Enum.EasingStyle.Linear -- Styl wygładzania
))
-- Usuń przejrzystość
frameRule:SetPropertyTransition("BackgroundColor3", nil)
SetPropertyTransition() Używanie tokenów
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokensSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Ustaw tokeny (atrybuty) na arkuszu tokenów
tokensSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
-- Uzyskaj odniesienie do reguły stylu
local frameRule = coreSheet.Frame
frameRule:SetPropertyTransition("BackgroundColor3", "$LinearTransition")

SetPropertyTransitions
Możliwości: UI
StyleRule:SetPropertyTransitions(properties:Dictionary):()
Parametry
properties:Dictionary
Zwroty
()
Przykłady kodu
SetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Uzyskaj odnośnik do zasady stylu
local frameRule = coreSheet.Frame
-- Ustawia przejścia dla dwóch właściwości jednocześnie
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = TweenInfo.new(1, Enum.EasingStyle.Linear),
["BackgroundTransparency"] = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
})
-- Usuń wszystkie przejścia
frameRule:SetPropertyTransitions({})
SetPropertyTransitions() Używanie Tokenów
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokenSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Ustaw tokeny (atrybuty) na arkuszu tokenów
tokenSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
tokenSheet:SetAttribute("QuadTransition", TweenInfo.new(0.25, Enum.EasingStyle.Quad))
-- Uzyskaj odniesienie do reguły stylu
local frameRule = coreSheet.Frame
-- Ustaw przejścia dla wielu właściwości jednocześnie
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = "$LinearTransition",
["BackgroundTransparency"] = "$QuadTransition",
})

©2026 Roblox Corporation. Nazwa Roblox, logo Roblox oraz hasło „Powering Imagination” należą do naszych zarejestrowanych i niezarejestrowanych znaków towarowych na terenie Stanów Zjednoczonych oraz w innych krajach.