void OnGUI() { int columnCount = 0; int rowCount = 0; int providerAreaHeight = 0; foreach (Provider p in Enum.GetValues(typeof(Provider))) { if (gui.Button( baseMargin + (providerMargin + providerWidth) * columnCount, baseMargin + (providerMargin + providerHeight) * rowCount, providerWidth, providerHeight, p.ToString())) { var connector = this.gameObject.AddComponent <KiiSocialNetworkConnector>(); connector.LogIn(p, (KiiUser user, Provider provider, Exception exception) => { if (user != null) { ConsoleLog.D(KiiUserToString(user)); } else { ConsoleLog.D(exception.ToString()); } UnityEngine.Object.Destroy(connector); }); } columnCount++; if (columnCount >= providerColumn) { columnCount = 0; rowCount++; } providerAreaHeight = (baseMargin * 2) + (providerMargin * rowCount) + (providerHeight * (rowCount + 1)); } // Clear Log if (gui.Button( baseMargin, providerAreaHeight, (width - (baseMargin * 3)) / 2, providerHeight, "Clear Log")) { ConsoleLog.Clear(); } // Show user info if (gui.Button( baseMargin * 2 + (width - (baseMargin * 3)) / 2, providerAreaHeight, (width - (baseMargin * 3)) / 2, providerHeight, "Show UserInfo")) { ConsoleLog.D(KiiUserToString(KiiUser.CurrentUser)); } int logHeight = providerAreaHeight + providerHeight + baseMargin; // Log area currentScrollPosition = gui.ScrollView(baseMargin, logHeight, width - baseMargin * 2, height - logHeight, currentScrollPosition, ConsoleLog.GetLogsByString()); }