Esempio n. 1
0
        public void DispatchEvent(string eventValue, DUI.EventType eventType)
        {
            switch (eventType)
            {
            case DUI.EventType.GameEvent: if (dispatchGameEvents)
                {
                    StartCoroutine(WaitAndSendEvent(eventValue));
                }
                break;

            case DUI.EventType.ButtonClick: if (dispatchButtonClicks)
                {
                    StartCoroutine(WaitAndSendEvent(eventValue));
                }
                break;
            }
        }
        /// <summary>
        /// Returns a list of all the UITriggers that are linked to the given triggerValue and of the given triggerType.
        /// </summary>
        /// <param name="triggerValue">This can be either a game event or a button name or the special DUI.DISPATCH_ALL value.</param>
        /// <param name="triggerType">Depending on the triggerType, this method will search in a different registry.</param>
        public static List <UITrigger> GetUITriggers(string triggerValue, DUI.EventType triggerType)
        {
            switch (triggerType)
            {
            case DUI.EventType.GameEvent:
                if (GameEventsTriggerDatabase == null || GameEventsTriggerDatabase.Count == 0)
                {
                    return(new List <UITrigger>());
                }
                if (GameEventsTriggerDatabase.ContainsKey(triggerValue))
                {
                    return(new List <UITrigger>(GameEventsTriggerDatabase[triggerValue]));
                }
                if (GameEventsTriggerDatabase.ContainsKey(DUI.DISPATCH_ALL))
                {
                    return(new List <UITrigger>(GameEventsTriggerDatabase[DUI.DISPATCH_ALL]));
                }
                break;

            case DUI.EventType.ButtonClick:
                if (ButtonClicksTriggerDatabase == null || ButtonClicksTriggerDatabase.Count == 0)
                {
                    return(new List <UITrigger>());
                }
                if (ButtonClicksTriggerDatabase.ContainsKey(triggerValue))
                {
                    return(new List <UITrigger>(ButtonClicksTriggerDatabase[triggerValue]));
                }
                if (ButtonClicksTriggerDatabase.ContainsKey(DUI.DISPATCH_ALL))
                {
                    return(new List <UITrigger>(ButtonClicksTriggerDatabase[DUI.DISPATCH_ALL]));
                }
                break;

            case DUI.EventType.ButtonDoubleClick:
                if (ButtonDoubleClicksTriggerDatabase == null || ButtonDoubleClicksTriggerDatabase.Count == 0)
                {
                    return(new List <UITrigger>());
                }
                if (ButtonDoubleClicksTriggerDatabase.ContainsKey(triggerValue))
                {
                    return(new List <UITrigger>(ButtonDoubleClicksTriggerDatabase[triggerValue]));
                }
                if (ButtonDoubleClicksTriggerDatabase.ContainsKey(DUI.DISPATCH_ALL))
                {
                    return(new List <UITrigger>(ButtonDoubleClicksTriggerDatabase[DUI.DISPATCH_ALL]));
                }
                break;

            case DUI.EventType.ButtonLongClick:
                if (ButtonLongClicksTriggerDatabase == null || ButtonLongClicksTriggerDatabase.Count == 0)
                {
                    return(new List <UITrigger>());
                }
                if (ButtonLongClicksTriggerDatabase.ContainsKey(triggerValue))
                {
                    return(new List <UITrigger>(ButtonLongClicksTriggerDatabase[triggerValue]));
                }
                if (ButtonLongClicksTriggerDatabase.ContainsKey(DUI.DISPATCH_ALL))
                {
                    return(new List <UITrigger>(ButtonLongClicksTriggerDatabase[DUI.DISPATCH_ALL]));
                }
                break;
            }
            return(new List <UITrigger>());
        }