﻿<?xml version="1.0" encoding="utf-8" ?>
<c2eventsheet>
    <!--All the 'name' attributes are ignored by Construct 2 - they are there for readability only.-->
    <name>E_UI_Common</name>
    <events>
        <event-group description="This module contains common functions that are used by other modules." sid="7398373435429005" title="UI_COMMON">
            <sub-events>
                <event-block sid="3142675308886268">
                    <conditions>
                        <condition id="-2" name="On start of layout" sid="5753902864864503" type="System" />
                    </conditions>
                    <actions>
                        <action id="0" name="Call function" sid="2592788761716772" type="Function">
                            <param id="0" name="Name">&quot;applyFont&quot;</param>
                            <param id="1" name="Parameter {n}"></param>
                        </action>
                    </actions>
                </event-block>
                <comment>Elements (like ui_button) that are underneath an opened dialog are still clickable even though there is a black overlay above them, and any click/touch callback that&apos;s on them will be called.The isActive Function tries to overcome this problem.</comment>
                <comment>This function should be used in conjuction with any onTouch/click condition; it takes one parameter which is the layer of the element we want to test if it should be &quot;active&quot; or clickable.</comment>
                <event-block sid="7040448185526824">
                    <conditions>
                        <condition id="0" name="On function" sid="8960015656608" type="Function">
                            <param id="0" name="Name">&quot;isActive&quot;</param>
                        </condition>
                    </conditions>
                    <actions />
                    <sub-events>
                        <comment>The element is &quot;active&quot; if the currentDialog=&quot;none&quot;, ie there is no dialog opened. OR if the element is on the same layer of the dialog</comment>
                        <event-block sid="8820788831357744">
                            <conditions>
                                <condition id="-7" name="Compare instance variable" sid="8457218477691093" type="ui_dialog">
                                    <param id="0" name="Instance variable">element_name</param>
                                    <param id="1" name="Comparison">0</param>
                                    <param id="2" name="Value">currentDialog</param>
                                </condition>
                            </conditions>
                            <actions />
                            <sub-events>
                                <event-block sid="1489599996058806">
                                    <conditions>
                                        <condition id="-8" name="Compare two values" sid="3741891640992421" type="System">
                                            <param id="0" name="First value">ui_dialog.LayerName</param>
                                            <param id="1" name="Comparison">0</param>
                                            <param id="2" name="Second value">Function.Param(0)</param>
                                        </condition>
                                    </conditions>
                                    <actions>
                                        <action id="1" name="Set return value" sid="208237900973734" type="Function">
                                            <param id="0" name="Value">1</param>
                                        </action>
                                    </actions>
                                </event-block>
                            </sub-events>
                        </event-block>
                        <event-block any="1" sid="9325013513550687">
                            <conditions>
                                <condition id="-14" name="Compare variable" sid="281145897197723" type="System">
                                    <param id="0" name="Variable">currentDialog</param>
                                    <param id="1" name="Comparison">0</param>
                                    <param id="2" name="Value">&quot;none&quot;</param>
                                </condition>
                            </conditions>
                            <actions>
                                <action id="1" name="Set return value" sid="4164650708027873" type="Function">
                                    <param id="0" name="Value">1</param>
                                </action>
                            </actions>
                        </event-block>
                    </sub-events>
                </event-block>
                <comment>Description: Interpret then execute the &quot;callback&quot; instance variable (when available) of a component (like a ui_button or ui_checkbox), which contains an expression of the form of &quot;functionName,param1,param2,..etc&quot; where the first token is the name of the function to execute  and the rest of the tokens are the parameters to pass to the function.</comment>
                <comment>Param0: The &quot;callback&quot; instance variable of a ui_button.</comment>
                <event-block sid="9832235529282088">
                    <conditions>
                        <condition id="0" name="On function" sid="1533570427004831" type="Function">
                            <param id="0" name="Name">&quot;runCallback&quot;</param>
                        </condition>
                    </conditions>
                    <actions />
                    <sub-events>
                        <variable comment='We store how many tokens (separated by &quot;,&quot;)  are in the expressions.eg &quot; myFunc,hello&quot; has 2 tokens' constant="0" name="token_Count" sid="6192610432117355" static="0" type="number">0</variable>
                        <event-block sid="132777719516868">
                            <conditions />
                            <actions>
                                <action id="-9" name="Set value" sid="6050832782901967" type="System">
                                    <param id="0" name="Variable">token_Count</param>
                                    <param id="1" name="Value">tokencount(Function.Param(0),&quot;,&quot;)</param>
                                </action>
                            </actions>
                        </event-block>
                        <event-block sid="8996872861744188">
                            <conditions>
                                <condition id="-8" name="Compare two values" sid="6849988612825967" type="System">
                                    <param id="0" name="First value">token_Count</param>
                                    <param id="1" name="Comparison">0</param>
                                    <param id="2" name="Second value">1</param>
                                </condition>
                            </conditions>
                            <actions>
                                <action id="0" name="Call function" sid="3134628972584548" type="Function">
                                    <param id="0" name="Name">Function.Param(0)</param>
                                    <param id="1" name="Parameter {n}"></param>
                                </action>
                            </actions>
                        </event-block>
                        <event-block sid="9253035836188209">
                            <conditions>
                                <condition id="-22" name="Else" sid="1975186568391706" type="System" />
                                <condition id="-8" name="Compare two values" sid="576521112636532" type="System">
                                    <param id="0" name="First value">token_Count</param>
                                    <param id="1" name="Comparison">0</param>
                                    <param id="2" name="Second value">2</param>
                                </condition>
                            </conditions>
                            <actions>
                                <action id="0" name="Call function" sid="6449368125326403" type="Function">
                                    <param id="0" name="Name">tokenat(Function.Param(0), 0, &quot;,&quot; )</param>
                                    <param id="1" name="Parameter {n}">tokenat(Function.Param(0), 1, &quot;,&quot; )</param>
                                </action>
                            </actions>
                        </event-block>
                        <event-block sid="6584747483837718">
                            <conditions>
                                <condition id="-22" name="Else" sid="6421798469923054" type="System" />
                                <condition id="-8" name="Compare two values" sid="8612015733824139" type="System">
                                    <param id="0" name="First value">token_Count</param>
                                    <param id="1" name="Comparison">0</param>
                                    <param id="2" name="Second value">3</param>
                                </condition>
                            </conditions>
                            <actions>
                                <action id="0" name="Call function" sid="1020903408937759" type="Function">
                                    <param id="0" name="Name">tokenat(Function.Param(0), 0, &quot;,&quot; )</param>
                                    <param id="1" name="Parameter {n}">tokenat(Function.Param(0), 1, &quot;,&quot; ){###}tokenat(Function.Param(0), 2, &quot;,&quot; )</param>
                                </action>
                            </actions>
                        </event-block>
                    </sub-events>
                </event-block>
                <comment>Description: Apply a custom font to all ui_labels. cf the Files/Fonts folder.</comment>
                <event-block sid="2034932056819183">
                    <conditions>
                        <condition id="0" name="On function" sid="4670424415767476" type="Function">
                            <param id="0" name="Name">&quot;applyFont&quot;</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="5" name="Set web font" sid="554557034357527" type="ui_label">
                            <param id="0" name="Family name">&quot;varela_roundregular&quot;</param>
                            <param id="1" name="CSS URL">&quot;stylesheet.css&quot;</param>
                        </action>
                    </actions>
                </event-block>
            </sub-events>
        </event-group>
    </events>
</c2eventsheet>
