/* * Util.MiniGameInfo.cs * Authors: Adam Nabinger * Copyright (c) 2007-2008 Cornell University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace Util { /// /// An Information class, for the ColonySim to find out about any and all minigames that are available to it. /// More features will be added as needed. /// public abstract class MiniGameInfo : IComparable { #region Fields /// /// Represents the score that was received during the play of a mini-game /// public static MiniGameReward Reward = new MiniGameReward(); /// /// Represents the score that was received during the play of a mini-game /// public static int ScoreValue = 0; /// /// Whether a mini-game has been played recently or not /// public static bool HasPlayed = true; /// /// The root directory of the mini game /// internal string RootDirectory = ProjectInfo.HomeDirectory; // The number of times this mini game has been prompted. private int mNumPrompts; // The number of times this mini game has been rejected. private int mNumRejects; // The number of times this mini game has been played. private int mNumPlayed; // The strings for the name of the icons to be used for the game protected string mIconUp = null; protected string mIconDown = null; // Whether the project should ever be visible in the colony sim or not protected bool mCSPlayable = false; // Some games should be flagged as lower priority than others protected bool mIsLowPriority = false; #endregion #region Properties /// /// The number of times this mini game has been prompted. /// public int NumPrompts { get { return mNumPrompts; } set { mNumPrompts = value; } } /// /// The number of times this mini game has been rejected. /// public int NumRejects { get { return mNumRejects; } set { mNumRejects = value; } } /// /// The number of times this mini game has been played. /// public int NumPlayed { get { return mNumPlayed; } set { mNumPlayed = value; } } /// /// The up icon for display in the colony sim for the mini game. /// public string IconUp { get { return mIconUp; } } /// /// The down icon for display in the colony sim for the mini game. /// public string IconDown { get { return mIconDown; } } /// /// Whether the game can be played in the Colony Sim or not. /// public bool CSPlayable { get { return mCSPlayable; } } /// /// The name that is displayed about the mini-game. /// public string DisplayName { get { return GetDisplayName(); } } /// /// Gets a reference to a new GameScreen which can be used to start /// a new instance of the mini-game. /// public GameScreen GameScreen { get { GameScreen game = GetGameScreen(); game.RootDirectory = RootDirectory; return game; } } /// /// This data can be used in groupings of game lists when some items should be less prominent or a lower priority /// public bool IsLowPriority { get { return mIsLowPriority; } } #endregion #region Getters /// /// Returns the display name of the mini game this contains. /// /// The name of the mini game. protected abstract string GetDisplayName(); /// /// Returns the game screen associated with this game info. /// /// The game screen. protected abstract GameScreen GetGameScreen(); #endregion #region Comparison /// /// Used by List.Sort /// /// /// public int CompareTo(object o) { MiniGameInfo that = (MiniGameInfo)o; // Sort by priority, then alphabetically if (this.IsLowPriority != that.IsLowPriority) { return IsLowPriority ? 1 : -1; } else { return this.DisplayName.CompareTo(that.DisplayName); } } #endregion } }