Example #1
0
        private static void DisplayCharactersUsername()
        {
            Chat    chat    = ChatUtil.GetChat();
            Prefabs prefabs = SingletonUtil.GetMain().Prefabs;
            InChatPanelComponent inChatPanelComponent = (InChatPanelComponent)UIPanelUtil.GetUIPanel(PanelType.IN_CHAT);

            if (inChatPanelComponent.CharactersUsername.Length != chat.Characters.Count)
            {
                if (inChatPanelComponent.CharactersUsername.Length > chat.Characters.Count)
                {
                    int diff = inChatPanelComponent.CharactersUsername.Length - chat.Characters.Count;
                    for (int i = diff + 1; i < inChatPanelComponent.CharactersUsername.Length; i++)
                    {
                        inChatPanelComponent.CharactersUsername[i].gameObject.SetActive(false);
                    }
                }
                else
                {
                    int diff = chat.Characters.Count - inChatPanelComponent.CharactersUsername.Length;
                    for (int i = 0; i < diff; i++)
                    {
                        Pool.TryGetMonoBehaviourFromPool <UIText>(ref inChatPanelComponent.CharactersUsername, prefabs.UiText);
                    }
                }
            }
        }
Example #2
0
        public void SaveLoginSettings()
        {
            Manager manager = SingletonUtil.GetMain();
            Access  access  = AccessUtil.GetAccessData();
            LoginSettingsPanelComponent loginSettingsPanelComponent = (LoginSettingsPanelComponent)UIPanelUtil.GetUIPanel(PanelType.LOGIN_SETTINGS);

#if UNITY_EDITOR
            access.DevJsonPath = loginSettingsPanelComponent.InputField_DevJsonPath.text;
#endif
            access.JsonPath = loginSettingsPanelComponent.InputField_JsonPath.text;

#if UNITY_EDITOR
            PlayerPrefs.SetString("DevJsonPath", access.DevJsonPath);
#endif
            PlayerPrefs.SetString("JsonPath", access.JsonPath);
#if UNITY_EDITOR
            if (loginSettingsPanelComponent.InputField_DevJsonPath.text != string.Empty)
            {
                ClientUtil.SetClient();
            }
#else
            if (loginSettingsPanelComponent.InputField_JsonPath.text != string.Empty)
            {
                ClientUtil.SetClient();
            }
#endif
        }
Example #3
0
        public static void InitializeUI()
        {
            Manager manager = SingletonUtil.GetMain();

            manager.UI = GameObject.Instantiate(manager.Prefabs.UIHolder);
            manager.UI.transform.position = Vector3.zero;
            GameObject.DontDestroyOnLoad(manager.UI);
        }
Example #4
0
        public static void InitializeChat()
        {
            Manager manager = SingletonUtil.GetMain();
            Chat    chat    = GetChat();

            chat.Ground = GameObject.Instantiate(manager.Prefabs.Ground);
            SetObjectLayer(chat.Ground.gameObject, LayerMask.NameToLayer(chat.GroundLayer), true);
        }
Example #5
0
        public static void InitializeMainCameraComponent()
        {
            Manager manager = SingletonUtil.GetMain();

            manager.MainCameraComponent = GameObject.Instantiate(manager.Prefabs.MainCameraComponent);
            manager.MainCameraComponent.transform.position = new Vector3(0, 0, -10);

            GameObject.DontDestroyOnLoad(manager.MainCameraComponent.gameObject);
        }
Example #6
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);
            }
        }
Example #7
0
        public static void SetupPanel()
        {
            Manager manager = SingletonUtil.GetMain();
            Access  access  = manager.Access;
            LoginSettingsPanelComponent panel = (LoginSettingsPanelComponent)UIPanelUtil.GetUIPanel(PanelType.LOGIN_SETTINGS);

#if UNITY_EDITOR
            panel.InputField_DevJsonPath.text = AccessUtil.GetCredentialsJsonPath();
#endif

            panel.InputField_JsonPath.text = AccessUtil.GetCredentialsJsonPath();
        }
Example #8
0
        private static Character AddCharacter(Follower follower)
        {
            Manager   manager   = SingletonUtil.GetMain();
            Character character = new Character();

            character.PCharacter        = PCharacterInstanceUtil.CreateInstanceFromBase(CharacterCollectionUtil.GetDefaultCharacter());
            character.Position          = Vector2.zero + Vector2.up;
            character.FollowerReference = follower;
            SetObjectLayer(character.PCharacter.gameObject, LayerMask.NameToLayer(manager.Chat.CharacterLayer), true);

            character.PCharacter.gameObject.SetActive(false);

            return(character);
        }
Example #9
0
        public static CharacterBaseCollection GetCollection(string collectionName)
        {
            Manager manager = SingletonUtil.GetMain();

            for (int i = 0; i < manager.Prefabs.CharacterCollection.Length; i++)
            {
                CharacterBaseCollection collection = manager.Prefabs.CharacterCollection[i];
                if (collection.Name == collectionName)
                {
                    return(collection);
                }
            }

            return(null);
        }
Example #10
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;
            }
        }
Example #11
0
        public static Access GetAccessData()
        {
            Manager manager = SingletonUtil.GetMain();

            return(manager.Access);
        }
Example #12
0
        public static MainCameraComponent GetMainCameraComponent()
        {
            Manager manager = SingletonUtil.GetMain();

            return(manager.MainCameraComponent);
        }
Example #13
0
        public static Chat GetChat()
        {
            Manager manager = SingletonUtil.GetMain();

            return(manager.Chat);
        }
Example #14
0
        public static UIPanel GetUIPanel(PanelType panelType)
        {
            UIHolder uiHolder = UIUtil.GetUIHolder();
            UIPanel  uiPanel  = null;

            Prefabs prefabs = SingletonUtil.GetMain().Prefabs;

            switch (panelType)
            {
            case PanelType.LOGIN:
            {
                if (uiHolder.LoginPanelComponent == null)
                {
                    uiHolder.LoginPanelComponent = GameObject.Instantiate(prefabs.LoginPanelComponent, uiHolder.Canvas.transform);
                    uiHolder.InstantiatedPanels.Add(uiHolder.LoginPanelComponent.PanelType);
                }

                uiPanel = uiHolder.LoginPanelComponent;
            }
            break;

            case PanelType.LOGIN_SETTINGS:
            {
                if (uiHolder.LoginSettingsPanelComponent == null)
                {
                    uiHolder.LoginSettingsPanelComponent = GameObject.Instantiate(prefabs.LoginSettingsPanelComponent, uiHolder.Canvas.transform);
                    uiHolder.InstantiatedPanels.Add(uiHolder.LoginSettingsPanelComponent.PanelType);
                }
                uiPanel = uiHolder.LoginSettingsPanelComponent;
            }
            break;

            case PanelType.CONNECTING:
            {
                if (uiHolder.ConnectingPanelComponent == null)
                {
                    uiHolder.ConnectingPanelComponent = GameObject.Instantiate(prefabs.ConnectingPanelComponent, uiHolder.Canvas.transform);
                    uiHolder.InstantiatedPanels.Add(uiHolder.ConnectingPanelComponent.PanelType);
                }
                uiPanel = uiHolder.ConnectingPanelComponent;
            }
            break;

            case PanelType.HUB:
            {
                if (uiHolder.HubPanelComponent == null)
                {
                    uiHolder.HubPanelComponent = GameObject.Instantiate(prefabs.HubPanelComponent, uiHolder.Canvas.transform);
                    uiHolder.InstantiatedPanels.Add(uiHolder.HubPanelComponent.PanelType);
                }
                uiPanel = uiHolder.HubPanelComponent;
            }
            break;

            case PanelType.IN_CHAT:
            {
                if (uiHolder.InChatPanelComponent == null)
                {
                    uiHolder.InChatPanelComponent = GameObject.Instantiate(prefabs.InChatPanelComponent, uiHolder.Canvas.transform);
                    uiHolder.InstantiatedPanels.Add(uiHolder.InChatPanelComponent.PanelType);
                }

                uiPanel = uiHolder.InChatPanelComponent;
            }
            break;
            }

            uiPanel.transform.position = uiHolder.Camera.WorldToScreenPoint(Vector3.zero);

            return(uiPanel);
        }
Example #15
0
 public static UIHolder GetUIHolder()
 {
     return(SingletonUtil.GetMain().UI);
 }
Example #16
0
 public static Simulation GetSimulation()
 {
     return(SingletonUtil.GetMain().Simulation);
 }
Example #17
0
        public static Client GetClient()
        {
            Manager manager = SingletonUtil.GetMain();

            return(manager.Client);
        }