Example #1
0
        public override void Connect()
        {
            State = SubSystemState.Connected;

            string portraitId = EB.Dot.String("portraitId", Hub.Instance.DataStore.LoginDataStore.LoginData, "");

            if (portraitId != "")
            {
                SetPortrait(Hub.Instance.DataStore.LoginDataStore.LocalUserId.Value, portraitId, PortraitPriority.High);
            }

            EB.Sparx.Config config  = SparxHub.Instance.Config;
            EndPointOptions options = new EndPointOptions {
                Key = config.ApiKey.Value
            };
            Hashtable social = EB.Dot.Object("social", Hub.Instance.DataStore.LoginDataStore.LoginData, null);

            if (null == social)
            {
                return;
            }

            string endpointUrl = EB.Dot.String("endpoint", social, null);

            _imageBaseUrl   = EB.Dot.String("imageBase", social, null);;
            _socialEndPoint = EndPointFactory.Create(endpointUrl, options);

            _socialEndPoint.AddData("stoken", Hub.Instance.ApiEndPoint.GetData("stoken"));
            _api.SetSocialEndpoint(_socialEndPoint);

            _allowPullFriendsPortraitInfoUntil = new DateTimeRef(System.DateTime.Now);
            _allowPullAdHocPortraitInfoUntil   = new DateTimeRef(System.DateTime.Now);

            UpdateUniqueTimestamp();
            GetFriendsPortraitInfo(null);

            Hub.Instance.GetManager <PushManager>().OnDisconnected += OnPushDisconnected;
        }