StyleBase

显示已弃用

*此内容使用人工智能(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() 被调用时。