Пример #1
0
        /// <summary>
        /// receive an event targeted to this particular player
        /// </summary>
        /// <param name="post"></param>
        static void ListenForMessages()
        {
            _isRunning = true;
            var listener = new ServiceBusListener();

            while (_shouldRun)
            {
                try
                {
                    listener.ListenForMessages();
                }
                catch (WebException ex)
                {
                    // if the server has not created a topic yet for the client then a 404 error will be returned so do not report
                    if (!ex.Message.Contains("The remote server returned an error: (404) Not Found"))
                    {
                        if (OnListenError != null)
                        {
                            OnListenError.Invoke(null, new ErrorEventArgs(ex));
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (OnListenError != null)
                    {
                        OnListenError.Invoke(null, new ErrorEventArgs(ex));
                    }
                }
            }

            _isRunning = false;
        }
Пример #2
0
    void Start()
    {
        _instance = Guid.NewGuid();

        //// initial setup of IGL
        IGL.Configuration.CommonConfiguration.Instance.BackboneConfiguration.IssuerName       = "IGLGuestClient";
        IGL.Configuration.CommonConfiguration.Instance.BackboneConfiguration.IssuerSecret     = "zQttoJG+laBopt7WMvbzV5Hk3oq0y6SxSqucjwnP7T4=";
        IGL.Configuration.CommonConfiguration.Instance.BackboneConfiguration.ServiceNamespace = "indiegameslab";

        IGL.Configuration.CommonConfiguration.Instance.GameId   = 100;
        IGL.Configuration.CommonConfiguration.Instance.PlayerId = "TestingTesting";

        _listener = new IGL.Client.ServiceBusListener();

        IGL.Client.ServiceBusListener.OnGameEventReceived += ServiceBusListener_OnGameEventReceived;
        IGL.Client.ServiceBusListener.OnListenError       += ServiceBusListener_OnListenError;
    }