void OnInspectorUpdate() { Repaint(); if (BankRefresher.TimeUntilBankRefresh() != float.MaxValue) { closeTime = float.MaxValue; } if (Time.realtimeSinceStartup > closeTime) { Close(); } }
void DrawStatus() { GUIStyle labelStyle = new GUIStyle(EditorStyles.whiteLargeLabel); labelStyle.alignment = TextAnchor.MiddleCenter; GUIStyle largeErrorStyle = new GUIStyle(labelStyle); largeErrorStyle.normal.textColor = Color.red; GUIStyle errorStyle = new GUIStyle(GUI.skin.box); errorStyle.alignment = TextAnchor.UpperLeft; errorStyle.wordWrap = true; errorStyle.normal.textColor = Color.red; float timeSinceFileChange = BankRefresher.TimeSinceSourceFileChange(); if (timeSinceFileChange != float.MaxValue) { GUILayout.Label(string.Format("The FMOD source banks changed {0} ago.", EditorUtils.DurationString(timeSinceFileChange)), labelStyle); float timeUntilBankRefresh = BankRefresher.TimeUntilBankRefresh(); if (timeUntilBankRefresh == 0) { GUILayout.Label("Refreshing banks now...", labelStyle); readyToRefreshBanks = true; } else if (timeUntilBankRefresh != float.MaxValue) { if (DrawCountdown("Refreshing banks", timeUntilBankRefresh, Settings.Instance.BankRefreshCooldown, labelStyle) || ConsumeEscapeKey()) { BankRefresher.DisableAutoRefresh(); } } else { GUILayout.Label("Would you like to refresh banks?", labelStyle); } } else { if (lastRefreshError == null) { GUILayout.Label("The FMOD banks are up to date.", labelStyle); } else { GUILayout.Label("Bank refresh failed:", largeErrorStyle); GUILayout.Box(lastRefreshError, errorStyle, GUILayout.ExpandWidth(true)); } } if (closeTime != float.MaxValue) { float timeUntilClose = Mathf.Max(0, closeTime - Time.realtimeSinceStartup); if (DrawCountdown("Closing", timeUntilClose, CloseDelay, labelStyle) || ConsumeEscapeKey()) { closeTime = float.MaxValue; } } }