private void Open() { isOpened = true; if (this.GDHUD().GDOwner.CanPause) { this.GDHUD().GDOwner.IsPaused = true; } var t1 = L10N.T(L10NImpl.STR_PAUS_RESUME); var t2 = L10N.T(L10NImpl.STR_PAUS_RESTART); var t3 = L10N.T(L10NImpl.STR_PAUS_EXIT); var w1 = FontRenderHelper.MeasureStringCached(Textures.HUDFontBold, t1, 40f); var w2 = FontRenderHelper.MeasureStringCached(Textures.HUDFontBold, t2, 40f); var w3 = FontRenderHelper.MeasureStringCached(Textures.HUDFontBold, t3, 40f); var w = FloatMath.Max(w1.Width, w2.Width, w3.Width); int cnt = (_showResume ? 1 : 0) + (_showRestart ? 1 : 0) + (_showExit ? 1 : 0); var m = new List <HUDPauseMenuButton>(); int idx = 0; int dep = -1; if (_showResume) { m.Add(new HUDPauseMenuButton(this, t1, w, dep--, idx++, cnt, OnResume)); } if (_showRestart) { m.Add(new HUDPauseMenuButton(this, t2, w, dep--, idx++, cnt, OnRestart)); } if (_showExit) { m.Add(new HUDPauseMenuButton(this, t3, w, dep--, idx++, cnt, OnExit)); } subMenu = m.ToArray(); Owner.AddElements(subMenu); }
private void Open() { if (isOpened) { return; } if (!IsEnabled) { return; } isOpened = true; isDragging = true; if (speedButtons != null) { foreach (var btn in speedButtons) { btn.Remove(); btn.IsOpened = false; btn.IsClickable = false; } speedButtons = null; } speedButtons = new[] { new HUDSpeedSetButton(this, GameSpeedModes.SUPERSLOW), new HUDSpeedSetButton(this, GameSpeedModes.SLOW), new HUDSpeedSetButton(this, GameSpeedModes.NORMAL), new HUDSpeedSetButton(this, GameSpeedModes.FAST), new HUDSpeedSetButton(this, GameSpeedModes.SUPERFAST), }; Owner.AddElements(speedButtons); }