private void InitializeControls(bool reinit = false) { Texture2D back = GFXManager.TextureFromResource(GFXTypes.PreLoginUI, 24, true); _backButton = new XNAButton(back, new Vector2(589, 0), new Rectangle(0, 0, back.Width, back.Height / 2), new Rectangle(0, back.Height / 2, back.Width, back.Height / 2)) { DrawOrder = 100 }; _backButton.OnClick += MainButtonPress; _backButton.ClickArea = new Rectangle(4, 16, 16, 16); //hide all the components to start with foreach (IGameComponent iGameComp in Components) { DrawableGameComponent component = iGameComp as DrawableGameComponent; //don't hide dialogs if reinitializing if (reinit && (XNAControl.Dialogs.Contains(component as XNAControl) || (component as XNAControl != null && XNAControl.Dialogs.Contains((component as XNAControl).TopParent)))) { continue; } //...except for the four main buttons if (component != null) { component.Visible = false; } } }