public void OnGUI() { GUIHelpers.IsInsepctor = false; //if (string.IsNullOrEmpty(MarketPlace.Token) || jsonInfo == null || string.IsNullOrEmpty(MarketPlace.Cookies)) //{ DoLoginScreen(); if (GUILayout.Button("Logout")) { MarketPlace.Token = null; MarketPlace.Cookies = null; loginResponse = null; jsonInfo = null; } //} //else //{ // if (jsonInfo == null) // { // jsonInfo = MarketPlace.GetMarketInfo(); // } // if (jsonInfo == null) // { // return; // } // DoMarketScreen(); //} }
private void DoLoginScreen() { if (loginResponse != null && !loginResponse.Success) { EditorGUILayout.HelpBox(loginResponse.Message, MessageType.Error); } username = EditorGUILayout.TextField("Username:"******"Password:"******"Login")) { loginResponse = MarketPlace.Login(username, password); jsonInfo = MarketPlace.GetMarketInfo(); } }
private void DoMarketScreen() { foreach (var item in jsonInfo.MarketItems) { if ( GUIHelpers.DoTriggerButton(new UFStyle(string.Format("{0} {1:C}", item.Name, item.Price), ElementDesignerStyles.EventButtonStyleSmall) { FullWidth = false })) { } } if (GUILayout.Button("Logout")) { MarketPlace.Token = null; MarketPlace.Cookies = null; loginResponse = null; jsonInfo = null; } }