private void _EnsureAwake() { if (!this._awake) { if (this._lock_awake) { Debug.LogWarning("Something tried to ensure this while it was being awoken in ensure awake", this); } else if (this._destroyed) { Debug.LogWarning("This window was destroyed before it could be awoke", this); } else if (this._lock_destroy) { Debug.LogWarning("This window is in the process of being destroyed, please look at the call stack and avoid this", this); } else { try { this._lock_awake = true; this._myPanel = base.GetComponent <UIPanel>(); this.panelsEnabled = false; if (this._closeButton != null) { this.closeButtonListener = UIEventListener.Get(this._closeButton.gameObject); if (this.closeButtonListener != null) { this.closeButtonListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(this.closeButtonListener.onClick, this.buttonCallback); } } this.WindowAwake(); } catch (Exception exception) { Debug.LogError(string.Format("A exception was thrown during window awake ({0}, title={1}) and has probably broken something, exception is below\r\n{2}", this, this.TitleText, exception), this); } finally { this._awake = true; this._lock_awake = false; if (this._destroyAfterAwake) { Debug.LogWarning("Because of something trying to destroy this while we were awaking, destroy will occur now", this); try { this._lock_destroy = true; this.WindowDestroy(); } catch (Exception exception2) { Debug.LogError(string.Format("A exception was thrown during window destroy following awake. ({0}, title={1}) and potentially screwed up stuff, exception is below\r\n{2}", this, this.TitleText, exception2), this); } finally { this._destroyed = true; this._lock_destroy = false; } } else { RPOS.RegisterWindow(this); } } } } }