public virtual void ClearGame() { if (m_GameTimer != null) { m_GameTimer.Stop(); m_GameTimer = null; } if (m_ScoreTimer != null) { m_ScoreTimer.Stop(); m_ScoreTimer = null; } if (m_GumpTimer != null) { m_GumpTimer.Stop(); m_GumpTimer = null; } m_Winners.Clear(); m_PlayerScores.Clear(); List <Mobile> toRemove = new List <Mobile>(); foreach (Mobile player in Players) { toRemove.Add(player); } foreach (Mobile player in toRemove) { RemovePlayer(player); } m_RunningGames.Remove(this); m_Running = false; Open = false; BeginGame = false; m_GameMaster = null; }
public virtual void ClearGame() { if (m_GameTimer != null) { m_GameTimer.Stop(); m_GameTimer = null; } if (m_ScoreTimer != null) { m_ScoreTimer.Stop(); m_ScoreTimer = null; } if (m_GumpTimer != null) { m_GumpTimer.Stop(); m_GumpTimer = null; } m_Winners.Clear(); m_PlayerScores.Clear(); List<Mobile> toRemove = new List<Mobile>(); foreach (Mobile player in Players) { toRemove.Add(player); } foreach (Mobile player in toRemove) { RemovePlayer(player); } m_RunningGames.Remove(this); m_Running = false; Open = false; BeginGame = false; m_GameMaster = null; }
public virtual void StartGame(Mobile from) { if (Open && BeginGame) { try { m_RunningGames.Add(this); m_GameMaster = from; m_StartTime = DateTime.Now; } catch (Exception e) { Console.WriteLine(e.ToString()); } } if (!Open) { throw new EventException("You cannot start a game that is not open!"); } if (Running) { throw new EventException("The game is already running!"); } try { m_RunningGames.Add(this); m_GameMaster = from; m_StartTime = DateTime.Now; } catch (Exception e) { Console.WriteLine(e.ToString()); } if (m_GameTimer != null) { m_GameTimer.Stop(); m_GameTimer = null; } if (m_ScoreTimer != null) { m_ScoreTimer.Stop(); m_ScoreTimer = null; } if (m_GumpTimer != null) { m_GumpTimer.Stop(); m_GumpTimer = null; } if (Length.TotalSeconds > 0) { m_GameTimer = new GameTimer(this); m_GameTimer.Start(); } if (m_UseGump) { //m_GumpTimer = new GameGumpTimer(this); //m_GumpTimer.Start(); } }