Exemple #1
0
        private static void GUI_DrawDebugUsers(int id)
        {
            GUILayout.Label("Username:"******"Add"))
            {
                var follower = FollowerUtil.CreateFollower(addUser_UserName, new FollowerMessageInfo());
                SingletonUtil.GetMain().Client.Followers.Add(follower);
                SimulationUtil.GetSimulation().FollowersToAdd.Enqueue(follower);
            }
        }
Exemple #2
0
        void Update()
        {
            SimulationUtil.ManageStateChanging();

            State currentState = SimulationUtil.GetCurrentState();

            SimulationUtil.UpdateTick();

            switch (currentState)
            {
            case State.INTIALIZE:
                AccessUtil.LoadAccess();
                SimulationUtil.InitializeSimulation();
                CameraUtil.InitializeMainCameraComponent();
                UIUtil.InitializeUI();
                SimulationUtil.SetState(State.LOGIN);
                break;

            case State.LOGIN:
            {
                if (Simulation.Backend != null)
                {
                    SimulationUtil.SetState(State.CONNECTING);
                }
            }
            break;

            case State.IN_CHAT:
            {
                if (!ClientUtil.IsConnected())
                {
                    UnityEngine.Debug.Log("Disconnected");

                    if (Simulation.Backend != null && Simulation.Backend.HasExited)
                    {
                        Simulation.Backend = null;
                    }

                    SimulationUtil.SetState(State.LOGIN);
                    break;
                }

                if (SimulationUtil.Tick())
                {
                    FollowerUtil.UpdateFollowers();
                }

                ChatUtil.UpdateChat();
            }
            break;

            case State.LOGIN_SETTINGS:
                break;

            case State.CONNECTING:
            {
                if (!SimulationUtil.Tick())
                {
                    break;
                }

                UnityEngine.Debug.Log("Connecting");

                if (ClientUtil.IsConnected())
                {
                    SimulationUtil.SetState(State.HUB);
                    UnityEngine.Debug.Log("Connection complete !");
                }
            }
            break;

            case State.HUB:
            {
                Client.ReadMessages = true;

                if (SimulationUtil.Tick())
                {
                    FollowerUtil.UpdateFollowers();
                }
            }
            break;
            }

            UIUtil.UpdateUI();
        }