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(); }
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); }
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; } }
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); } }