Пример #1
0
        /// <summary>
        /// Periodically updates the internal state of the controller.
        /// </summary>
        public virtual void Update()
        {
            // for stress testing to make sure memory is being passed around properly
            //GC.Collect();

            if (m_ChatState == ChatState.Uninitialized)
            {
                return;
            }

            ErrorCode ret = m_Chat.FlushEvents();

            if (Error.Failed(ret))
            {
                string err = Error.GetString(ret);
                ReportError(string.Format("Error flushing chat events: {0}", err));
            }
        }
Пример #2
0
        /// <summary>
        /// Periodically updates the internal state of the controller.
        /// </summary>
        public virtual void Update()
        {
            // for stress testing to make sure memory is being passed around properly
            //GC.Collect();

            if (!m_ChatInitialized)
            {
                return;
            }

            ErrorCode ret = m_Chat.FlushEvents();

            if (Error.Failed(ret))
            {
                string err = Error.GetString(ret);
                ReportError(string.Format("Error flushing chat events: {0}", err));
            }

            switch (m_ChatState)
            {
            case ChatState.Uninitialized:
            {
                break;
            }

            case ChatState.Initialized:
            {
                // connect to the channel
                if (m_Anonymous)
                {
                    ret = m_Chat.ConnectAnonymous();
                }
                else
                {
                    ret = m_Chat.Connect(m_ChannelName, m_AuthToken.Data);
                }

                if (Error.Failed(ret))
                {
                    string err = Error.GetString(ret);
                    ReportError(string.Format("Error connecting: {0}", err));

                    Shutdown();

                    FireDisconnected();
                }
                else
                {
                    m_ChatState = ChatState.Connecting;
                    DownloadEmoticonData();
                }

                break;
            }

            case ChatState.Connecting:
            {
                break;
            }

            case ChatState.Connected:
            {
                break;
            }

            case ChatState.Disconnected:
            {
                Disconnect();
                break;
            }
            }
        }