StyleBase

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

無法建立

對於 StyleSheetStyleRule 的基礎類。保存一個列表子 StyleRules 以及被儲存為 特性 的代幣定義。

概要

方法

屬性

方法

GetStyleRules

Instances

返回一個相關的 StyleRules 陣列。


返回

Instances

StyleRules 的數組。

InsertStyleRule

()

插入新的 StyleRule 到規則陣列中,使其 Priority 大於所有以前的 StyleRules 。如果 priority 被指定,將新規則的 Priority 設置為指定值。

參數

rule: StyleRule

要插入的 StyleRule

預設值:""
priority: number

設置規則的 Priority 號碼。

預設值:""

返回

()

SetStyleRules

()

InsertStyleRule() 相似,但可讓您一次宣言並設置多個 StyleRules


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = Instance.new("StyleSheet")
coreSheet.Name = "CoreSheet"
coreSheet.Parent = ReplicatedStorage
local styleRuleA = Instance.new("StyleRule")
styleRuleA.Selector = "Frame"
styleRuleA:SetProperty("BackgroundColor3", Color3.new(1, 0, 0))
local styleRuleB = Instance.new("StyleRule")
styleRuleB.Selector = "Frame"
styleRuleB:SetProperty("BackgroundColor3", Color3.new(0, 1, 0))
coreSheet:SetStyleRules({ styleRuleA, styleRuleB })

參數

rules: Instances

要設置的 StyleRules 列表。

預設值:""

返回

()

活動

StyleRulesChanged

當一個或多個 StyleRules 在連接的 StyleSheetStyleRule 上明確更改時,發生火災,例如當 InsertStyleRule() 被呼叫時。