示例#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);
                    }
                }
            }
        }
示例#2
0
        public static void UpdatePanel()
        {
            LoginPanelComponent loginPanelComponent = (LoginPanelComponent)UIPanelUtil.GetUIPanel(PanelType.LOGIN);
            Access access = AccessUtil.GetAccessData();

            bool displayLogin = true;

#if UNITY_EDITOR
            displayLogin = access.DevJsonPath != string.Empty;
#else
            displayLogin = access.JsonPath != string.Empty;
#endif

            loginPanelComponent.InputField_Username.enabled = displayLogin;
            loginPanelComponent.InputField_Token.enabled    = displayLogin;
            loginPanelComponent.Button_Submit.enabled       = displayLogin && loginPanelComponent.InputField_Token.text != string.Empty && loginPanelComponent.InputField_Username.text != string.Empty;

            if (!loginPanelComponent.Button_Submit.enabled)
            {
                loginPanelComponent.Button_Submit.image.color = loginPanelComponent.Button_Submit.colors.disabledColor;
            }
            else
            {
                loginPanelComponent.Button_Submit.image.color = Color.white;
            }
        }
示例#3
0
        public static void UpdateUI()
        {
            State state = SimulationUtil.GetCurrentState();

            if (state == State.INTIALIZE)
            {
                return;
            }

            UIPanelUtil.ManagePanels();
        }
示例#4
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();
        }
示例#5
0
        private static void UpdateUsernamesAppearance()
        {
            Chat chat = ChatUtil.GetChat();
            MainCameraComponent  cameraComponent      = CameraUtil.GetMainCameraComponent();
            InChatPanelComponent inChatPanelComponent = (InChatPanelComponent)UIPanelUtil.GetUIPanel(PanelType.IN_CHAT);

            for (int i = 0; i < inChatPanelComponent.CharactersUsername.Length; i++)
            {
                UIText    uiText             = inChatPanelComponent.CharactersUsername[i];
                Character referenceCharacter = chat.Characters[i];

                uiText.text = chat.CharacterConfiguration.BaseName;
                UIUtil.FormatUIText(uiText, referenceCharacter);

                uiText.fontSize = chat.CharacterConfiguration.UsernameSize;
                uiText.color    = chat.CharacterConfiguration.UsernameColor;
            }
        }
示例#6
0
        private static void UpdateUsernamesPosition()
        {
            Chat chat = ChatUtil.GetChat();
            MainCameraComponent  cameraComponent      = CameraUtil.GetMainCameraComponent();
            InChatPanelComponent inChatPanelComponent = (InChatPanelComponent)UIPanelUtil.GetUIPanel(PanelType.IN_CHAT);

            for (int i = 0; i < inChatPanelComponent.CharactersUsername.Length; i++)
            {
                UIText    uiText             = inChatPanelComponent.CharactersUsername[i];
                Character referenceCharacter = chat.Characters[i];

                uiText.transform.SetParent(inChatPanelComponent.CharacterUsernamesHolder);

                Vector2 worldPosition = chat.Characters[i].Position + Vector2.up * referenceCharacter.PCharacter.Render.sprite.bounds.size;
                Vector2 offset        = chat.CharacterConfiguration.UsernameOffset;

                uiText.transform.position = cameraComponent.Camera.WorldToScreenPoint(worldPosition + offset);
            }
        }
示例#7
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;
            }
        }
示例#8
0
        public void Login()
        {
            LoginPanelComponent loginPanelComponent = (LoginPanelComponent)UIPanelUtil.GetUIPanel(PanelType.LOGIN);

            Client client = ClientUtil.GetClient();

            client.UserName     = loginPanelComponent.InputField_Username.text;
            client.AccessToken  = loginPanelComponent.InputField_Token.text;
            client.ReadMessages = false;
            client.Followers    = new List <Follower>();

            ClientUtil.SetClient();

            Simulation       simulation = SimulationUtil.GetSimulation();
            ProcessStartInfo backEnd    = new ProcessStartInfo();

            backEnd.FileName         = "TwitchChat_bckEnd.exe";
            backEnd.WorkingDirectory = AccessUtil.GetBackEndProcessPath();
            simulation.Backend       = Process.Start(backEnd);
        }
示例#9
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
        }
示例#10
0
 public static void SetupPanel()
 {
     HubPanelComponent hubPanelComponent = (HubPanelComponent)UIPanelUtil.GetUIPanel(PanelType.HUB);
 }