Ejemplo n.º 1
0
        public static void LoadOnLogin()
        {
            // load profile async on login
            //var profileTask = new Task(() =>
            //{
            // set profile (will set stats and achievements)
            Profile.Instance.CurrentProfile = ProfileAccess.Instance.GetUserProfile();
            AchievementManager.AchieveLogin();

            ProgressManager.InitializeRank();
            StatsManager.UpdateAchievementsUnlocked();

            // Set dayly
            Profile.Instance.Daily = DailyAccess.Instance.GetDaily();
            //DailyManager.DailyInitialize();
            //});
            //profileTask.Start();

            // Open websocket for chat
            WebsocketChatAccess.Instance.OpenSocket();

            // Open socket for connexion
            ConnexionWebsocketAccess.Instance.OpenSocket(UserToken.Token);

            // create new general chat canal
            WebsocketChatAccess.Instance.CreateNewCanal(ChatMenu.DefaultCanal, UserToken.Token);

            // Synchronize the zones
            ZoneSynchronizer.SynchronizeZone();

            // Open websocket for session event
            SessionEventWebsocketAccess.Instance.OpenSocket();

            // Todo: change to init method
            OnlineEventSubscriber.Initiate();

            ConnectionHelper.StartCheckConnectionThread();

            GameModel possibleJoin;

            if (ReconnectHelper.CanJoinBackGame(out possibleJoin))
            {
                var reconnectContext = new ReconnectViewModel(possibleJoin);
                var popup            = new ReconnectToGame(reconnectContext);
                popup.ShowDialog();
            }

            GeneralOnlineEventHandler.Initiate();
        }