Dawn/assets/games/liminal/prefabs/ButtonPrefab.xml
2023-10-05 17:19:48 -05:00

118 lines
2.8 KiB
XML

<prefab name="Button" type="">
<asset type="truetype" name="font_main" />
<!-- <asset type="texture" name="button_background_50_inactive" />
<asset type="texture" name="button_background_50" />
<asset type="texture" name="button_background_75_inactive" />
<asset type="texture" name="button_background_75" />
<asset type="texture" name="button_background_inactive" /> -->
<asset type="texture" name="button_background" />
<asset type="texture" name="button_hover_element" />
<asset type="texture" name="button_wings_down" />
<asset type="texture" name="button_wings_inactive" />
<asset type="texture" name="button_wings_open" />
<UIEmpty alignment="64, 128, 400, 64" ref="uiItem" />
<UISimpleMenuItem ref="menuItem" />
<!-- Background -->
<item>
<UIImage
ref="backgroundLeft"
texture="button_background"
color="white"
alignment="0, 0, 47, 0"
alignX="left"
alignY="stretch"
alignUnitRight="ratio"
uvs="0, 0, 0.1, 1"
/>
</item>
<item>
<UIImage
ref="backgroundMiddle"
texture="button_background"
color="white"
alignment="47, 0, 47, 0"
alignX="stretch"
alignY="stretch"
alignUnitLeft="ratio"
alignUnitRight="ratio"
uvs="0.1, 0, 0.9, 1"
/>
</item>
<item>
<UIImage
ref="backgroundRight"
texture="button_background"
color="white"
alignment="47, 0, 0, 0"
alignX="right"
alignY="stretch"
alignUnitLeft="ratio"
uvs="0.9, 0, 1.0, 1"
/>
</item>
<!-- Hover Element -->
<item>
<UIImage
ref="hoverDeocration"
texture="button_hover_element"
color="transparent"
alignment="0, -320, 400, 175"
alignX="UI_COMPONENT_ALIGN_MIDDLE"
alignY="UI_COMPONENT_ALIGN_END"
/>
</item>
<!-- Left Wing -->
<item>
<UIImage
texture="button_wings_open"
ref="wingsLeft"
alignment="-80, -54, 134.15, 151.3"
alignX="UI_COMPONENT_ALIGN_START"
alignY="UI_COMPONENT_ALIGN_START"
uvs="0, 0, 0.5, 1"
/>
</item>
<!-- Right Wing -->
<item>
<UIImage
texture="button_wings_open"
ref="wingsRight"
alignment="134.15, -54, -80, 151.3"
alignX="UI_COMPONENT_ALIGN_END"
alignY="UI_COMPONENT_ALIGN_START"
uvs="0.5, 0, 1, 1"
/>
</item>
<!-- Label -->
<item>
<UISimpleLabel
ref="label"
font="font_main"
size="32"
alignment="0, 12, 0, 12"
alignX="center"
alignY="stretch"
>
Hello Button.
</UISimpleLabel>
</item>
<code type="init">
useEvent([&amp;]{
hoverDeocration->color = COLOR_WHITE;
}, menuItem->eventHoveredOn);
useEvent([&amp;]{
hoverDeocration->color = COLOR_TRANSPARENT;
}, menuItem->eventHoveredOff);
</code>
</prefab>