Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public static void SetClient()
        {
            Client client     = GetClient();
            string clientJson = JsonUtility.ToJson(client);

            string jsonPath;

#if UNITY_EDITOR
            jsonPath = AccessUtil.GetCredentialsJsonPath() + "/DevClient.json";
#else
            jsonPath = AccessUtil.GetCredentialsJsonPath() + "/client.json";
#endif

            File.WriteAllText(jsonPath, clientJson);
        }
Ejemplo n.º 3
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;
            }
        }
Ejemplo n.º 4
0
        public static Client LoadClient()
        {
            string jsonPath = AccessUtil.GetCredentialsJsonPath();
            string filePath = string.Empty;

#if UNITY_EDITOR
            filePath = jsonPath + "/DevClient.json";
#else
            filePath = jsonPath + "/client.json";
#endif
            try
            {
                string clientJson = File.ReadAllText(filePath);
                Client client     = JsonUtility.FromJson <Client>(clientJson);

                return(client);
            }
            catch
            {
                return(null);
            }
        }