Ejemplo n.º 1
0
        private static void TryEnqueueNewFollower()
        {
            Simulation simulation = SimulationUtil.GetSimulation();

            Client loadedClient = ClientUtil.GetClient();

            ClientUtil.LoadClient(out loadedClient);

            Client localClient = ClientUtil.GetClient();

            for (int i = 0; i < loadedClient.Followers.Count; i++)
            {
                Follower loadedFollower = loadedClient.Followers[i];
                Follower clientFollower = null;

                if (ExistInClient(out clientFollower, loadedFollower))
                {
                    if (loadedFollower.Messages.Count != clientFollower.Messages.Count)
                    {
                        clientFollower.Messages.Add(loadedFollower.Messages[loadedFollower.Messages.Count - 1]);
                    }

                    continue;
                }

                Follower followerToEnqueue = CreateFollower(loadedFollower.UserName, loadedFollower.Messages[loadedFollower.Messages.Count - 1]);

                localClient.Followers.Add(followerToEnqueue);
                Debug.Log("Added client to chat: " + followerToEnqueue.UserName);

                simulation.FollowersToAdd.Enqueue(followerToEnqueue);
            }
        }
Ejemplo n.º 2
0
        public static void SetupPanel()
        {
            LoginPanelComponent loginPanelComponent = (LoginPanelComponent)UIPanelUtil.GetUIPanel(PanelType.LOGIN);

            string credentialsPath = string.Empty;

#if UNITY_EDITOR
            credentialsPath = AccessUtil.GetCredentialsJsonPath() + "/DevClient.json";
#else
            credentialsPath = AccessUtil.GetCredentialsJsonPath() + "/client.json";
#endif
            if (System.IO.File.Exists(credentialsPath))
            {
                Manager manager = SingletonUtil.GetMain();
                manager.Client = ClientUtil.LoadClient();

                loginPanelComponent.InputField_Username.text = manager.Client.UserName;
                loginPanelComponent.InputField_Token.text    = manager.Client.AccessToken;
            }
        }