Certain Frame properties allow the uses of references, be it either other Frames or external assets and localized content.
- The element itself, useful for resetting anchors and targets in animations.
<Animation name="Clicked"> <Event event="OnCLick" action="Reset,Play" frame="$this"/> <Controller name="Property_0" type="Property" end="Pause" property="Visible" frame="$this"> <Key type="Property" time="0" value="false"/> </Controller> </Animation>
- Refers to a children of the current frame.
- The parent of the object this is listed in. This reference can be chained to refer to the higher levels in the frame hierarchy.
- The root element which is the parent frame of all layout files. Its usage is not required. Seems to be used for dynamic instancing.
- Refers to the closest parent frame with a specified type, e.g. "CommandPanel". @name can be used instead of @type to compare the name and not the type to the specified identifier.
- Used to reach directly a Frame with a Handle that matches the name regardless of its location in the frame hierarchy.
- Nesting References
- It is also possible to nest references starting from the current frame, in order to reach other frames.
Frames that use assets like images, models and sounds, can use declarations in Assets.txt to access asset files. This permits the genericized use of localized assets and have multiple variations per race without having to declare different items for each of them.
Their notation is as follows:
- Will use the asset file with said path within Assets.txt.
- Will use an asset fail with said path suffixed by the current race id, and will default to the exact path in case there is not a race specific variation.
Here is an example of an Assets.txt file which is imported to Base.SC2Data/GameData/ in the import editor.
UI/BorderTexture=Assets\Textures\MyBorder.dds UI/BorderTexture_Prot=Assets\Textures\MyProtossBorder.dds UI/BorderTexture_Zerg=Assets\Textures\MyZergBorder.dds
<Texture val="@UI/BorderTexture"/> <!-- Will always use Assets\Textures\MyBorder.dds --> <!-- ... --> <Texture val="@@UI/BorderTexture"/> <!-- Will use Assets\Textures\MyProtossBorder.dds if protoss, Assets\Textures\MyZergBorder.dds if zerg, but will use Assets\Textures\MyBorder.dds if terran since there is no terran specific version of the asset declared -->
If you want to use the same value over and over, but when changing you want to have it easy you can use constants.
name = The name of the constant, when setting a value you can refer to this by using the name and prefixing a "#" to it. val = The value of the constant, when this constant is uses the value defined here.
<Constant name="InventoryButtonGap" val="-2"/> <Anchor side="Right" relative="$parent/Button02" pos="Min" offset="#InventoryButtonGap"/>
Property binding is used to bind a value to another value of the same type. Although there are cases where it works outside it's own type such as text.