// -------------------------------------------

        /*
         * Will get a package string with the event definition
         */
        private string PackData()
        {
            string output = "";

            for (int i = 0; i < m_events.Count; i++)
            {
                AppEventData sEvent = m_events[i];
                output += sEvent.NameEvent;
                output += TOKEN_PARAMETER_SEPARATOR;
                output += sEvent.Configuration;
                if (sEvent.ListParameters.Length > 0)
                {
                    output += TOKEN_PARAMETER_SEPARATOR;
                    for (int j = 0; j < sEvent.ListParameters.Length; j++)
                    {
                        output += sEvent.ListParameters[j];
                        if (j + 1 < sEvent.ListParameters.Length)
                        {
                            output += TOKEN_PARAMETER_SEPARATOR;
                        }
                    }
                }
                if (i + 1 < m_events.Count)
                {
                    output += TOKEN_LINE_SEPARATOR;
                }
            }
            return(output);
        }
Ejemplo n.º 2
0
        // -------------------------------------------

        /*
         * Clone a delayed event
         */
        public void DelayBasicEvent(AppEventData _timeEvent)
        {
            if ((NetworkEvent != null) && CheckToApplyEvent(_timeEvent.NameEvent))
            {
                m_listEvents.Add(new AppEventData(_timeEvent.NameEvent, AppEventData.CONFIGURATION_INTERNAL_EVENT, _timeEvent.IsLocalEvent, _timeEvent.NetworkID, _timeEvent.Time, _timeEvent.ListParameters));
            }
        }
        // -------------------------------------------

        /*
         * Will check if the event is in the list of allowed events for the client
         */
        public AppEventData CheckValidEvent(string _nameEvent, params object[] _list)
        {
            for (int i = 0; i < m_events.Count; i++)
            {
                AppEventData sEvent = m_events[i];
                if (sEvent.NameEvent == _nameEvent)
                {
                    for (int j = 0; j < _list.Length; j++)
                    {
                        switch ((string)sEvent.ListParameters[j])
                        {
                        case PARAMETER_INT:
                            if (!Utilities.IsStringInteger((string)_list[j]))
                            {
                                return(null);
                            }
                            break;

                        case PARAMETER_FLOAT:
                            if (!Utilities.IsStringFloat((string)_list[j]))
                            {
                                return(null);
                            }
                            break;

                        case PARAMETER_DOUBLE:
                            if (!Utilities.IsStringDouble((string)_list[j]))
                            {
                                return(null);
                            }
                            break;

                        case PARAMETER_VECTOR3:
                            if (!Utilities.IsStringVector3((string)_list[j]))
                            {
                                return(null);
                            }
                            break;

                        case PARAMETER_STRING:
                            break;
                        }
                    }
                    return(sEvent);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
        // -------------------------------------------

        /*
         * ClearNetworkEvents
         */
        public void ClearNetworkEvents(string _nameEvent = "", bool _applyFutureEvent = false)
        {
            if (_nameEvent.Length == 0)
            {
                for (int i = 0; i < m_listPriorityEvents.Count; i++)
                {
                    m_listPriorityEvents[i].Time = -1000;
                }
                for (int i = 0; i < m_listEvents.Count; i++)
                {
                    m_listEvents[i].Time = -1000;
                }
            }
            else
            {
                if (_applyFutureEvent)
                {
                    m_nameIgnoreEvent  = _nameEvent;
                    m_checkIgnoreEvent = true;
                }

                for (int i = 0; i < m_listPriorityEvents.Count; i++)
                {
                    AppEventData eventData = m_listPriorityEvents[i];
                    if (eventData.NameEvent == _nameEvent)
                    {
                        eventData.Time     = -1000;
                        m_nameIgnoreEvent  = "";
                        m_checkIgnoreEvent = false;
                    }
                }
                for (int i = 0; i < m_listEvents.Count; i++)
                {
                    AppEventData eventData = m_listEvents[i];
                    if (eventData.NameEvent == _nameEvent)
                    {
                        eventData.Time     = -1000;
                        m_nameIgnoreEvent  = "";
                        m_checkIgnoreEvent = false;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        // -------------------------------------------

        /*
         * Will process the queue of delayed events
         */
        void Update()
        {
            // PRIORITY DELAYED EVENTS
            for (int i = 0; i < m_listPriorityEvents.Count; i++)
            {
                AppEventData eventData    = m_listPriorityEvents[i];
                float        previousTime = eventData.Time;
                eventData.Time -= Time.deltaTime;
                if (eventData.Time <= 0)
                {
                    m_listPriorityEvents.RemoveAt(i);
                    if (previousTime >= 0)
                    {
                        NetworkEvent(eventData.NameEvent, eventData.IsLocalEvent, eventData.NetworkID, -1, eventData.ListParameters);
                    }
                    eventData.Destroy();
                    return;
                }
            }

            // DELAYED EVENTS
            for (int i = 0; i < m_listEvents.Count; i++)
            {
                AppEventData eventData    = m_listEvents[i];
                float        previousTime = eventData.Time;
                eventData.Time -= Time.deltaTime;
                if (eventData.Time <= 0)
                {
                    m_listEvents.RemoveAt(i);
                    if (previousTime >= 0)
                    {
                        NetworkEvent(eventData.NameEvent, eventData.IsLocalEvent, eventData.NetworkID, -1, eventData.ListParameters);
                    }
                    eventData.Destroy();
                    return;
                }
            }
        }
Ejemplo n.º 6
0
        // -------------------------------------------

        /*
         * Constructor
         */
        public override void Initialize(params object[] _list)
        {
            m_playerConnectionData = (PlayerConnectionData)_list[0];
            m_appEventData         = (AppEventData)_list[1];

            m_root      = this.gameObject;
            m_container = m_root.transform.Find("Content");

            if (m_container.Find("Button_OK") != null)
            {
                m_okButton = m_container.Find("Button_OK").GetComponent <Button>();
                m_okButton.gameObject.GetComponent <Button>().onClick.AddListener(OkPressed);
            }
            if (m_container.Find("Button_Cancel") != null)
            {
                m_cancelButton = m_container.Find("Button_Cancel").GetComponent <Button>();
                m_cancelButton.gameObject.GetComponent <Button>().onClick.AddListener(CancelPressed);
            }

            if (m_container.Find("TextEvent") != null)
            {
                m_textDescription      = m_container.Find("TextEvent").GetComponent <Text>();
                m_textDescription.text = m_appEventData.NameEvent;
            }
            if (m_container.Find("Title") != null)
            {
                m_title      = m_container.Find("Title").GetComponent <Text>();
                m_title.text = "EVENT";
            }
            if (m_container.Find("InputField") != null)
            {
                m_inputParameters      = m_container.Find("InputField").GetComponent <InputField>();
                m_inputParameters.text = m_appEventData.ToStringParameters();
            }

            UIEventController.Instance.UIEvent += new UIEventHandler(OnUIEvent);
        }