Files
tools/接口/属性添加.ms
T
2025-07-31 16:05:55 +08:00

64 lines
1.4 KiB
Plaintext

custAttributes.add $Sphere001 the_weaponData --给名为Sphere001的物体添加自定义属性,可包括按钮和各种UI(名称后加*号表示所有相同开头的物体加属性)
--custAttributes.add $Sphere001.modifiers the_weaponData --给名为Sphere001的物体属性承载器添加自定义属性
the_weaponData = attributes weaponData
(
parameters main rollout:params
(
hitPoints type: #float ui:hits default:10
cost type: #float ui:cost default:100
sound type: #string
)
parameters main2 rollout:params2
(
-- hitPointss type: #float ui:hits default:10
-- costs type: #float ui:cost default:100
)
rollout params "叶文斌属性1"
(
spinner hits "Hit Points" type: #float
spinner cost "Cost" type: #float
dropdownlist sound_dd "Sound" items:# ("boom","sparkle","zap","fizzle")
button havepressed "哈哈哈" width:100 height:50
on havepressed pressed do
(
print "cost.name="
print cost.name
print "cost="
print cost.value
print "sound="
print sound
)
)
rollout params2 "叶文斌属性飞过"
(
group "选项" (
radiobuttons uiRBtnLoadingType "第一" labels:#("Name", "Handle") default:1
checkbox uiCBoxAutoHide "第二" across:2
checkbox uiCBoxNonBipedMode "第三"
)
)
)
/*属性访问方法:
直接访问:
$box01.hitPoints
$box01.cost
$box01.sound
方法二:通过属性块访问
$box01.weaponData.hitPoints
$box01.weaponData.cost
$box01.weaponData.sound
*/