/// <summary> /// Zwraca, lub tworzy nową instancję singletona. /// </summary> /// <returns>Instacja singletona.</returns> public static HighScores GetInstance() { if (instance == null) { instance = new HighScores(); } return instance; }
private void рекордыToolStripMenuItem_Click(object sender, EventArgs e) { HighScores h = new HighScores(); h.ShowDialog(); }
void timer_Tick(object sender, EventArgs e) { game.DrawField(); if (game.IsOver) { timer1.Enabled = false; if (game.IsWin) { time.Stop(); button1.BackgroundImage = game.WinSmiles[random.Next(0, game.WinSmiles.Length - 1)]; HighScores h = new HighScores(true); h.SetTime(time.Elapsed.ToString()); h.ShowDialog(); } else { button1.BackgroundImage = game.LoseSmiles[random.Next(0, game.LoseSmiles.Length - 1)]; } } }
public ListMenuItem(MenuScene menu, Rectangle boundaries, HighScores hs) : base(menu, boundaries, hs.ToString(), null) { textNaturalPosition = new Vector2(inner.Left + HORIZONTAL_PADDING, inner.Top + VERTICAL_PADDING); }
public ListMenuItem(MenuScene menu, Vector2 pos, HighScores hs) : base(menu) { this.Text = hs.ToString(); textDim = font.MeasureString(this.Text); outer = new Rectangle((int)pos.X, (int)pos.Y, (int)(textDim.X + 2 * HORIZONTAL_PADDING), (int)(textDim.Y + 2 * VERTICAL_PADDING)); inner = new Rectangle(outer.Left + BORDER, outer.Top + BORDER, outer.Width - 2 * BORDER, outer.Height - 2 * BORDER); textNaturalPosition = new Vector2(inner.Left + HORIZONTAL_PADDING, inner.Top + VERTICAL_PADDING); }
/// <summary> /// Ustawia instancję singletona. /// </summary> /// <param name="hs">Obiekt, który stanie się nową instancją</param> public static void SetInstance(HighScores hs) { instance = hs; }