Click here to Skip to main content
15,891,778 members
Articles / Desktop Programming / WPF

Game Attack Combos : WPF Hybrid Smart Client for Combo Calculations

Rate me:
Please Sign up or sign in to vote.
4.96/5 (35 votes)
23 May 2009CPOL37 min read 84.5K   3.2K   50  
A WPF hybrid smart client for calculating attack combos in the Prince of Persia game.
namespace GG.GameAttackCombos.Logic {

	/// <summary>
	/// Represents select information about a combo package.
	/// </summary>
	public class ComboPackageInfo {

		/// <summary>
		/// Represents a ComboPackageInfo that is empty.
		/// </summary>
		public static readonly ComboPackageInfo Empty;

		#region Properties

		/// <summary>
		/// Gets a flag indicating whether or not this instance is empty.
		/// </summary>
		public bool IsEmpty {
			get { return (FileName == null && GameCode == null && Title == null && Version == null); }
		}

		/// <summary>
		/// Gets the file name of the combo package represented by this instance.
		/// </summary>
		public string FileName { get; private set; }

		/// <summary>
		/// Gets the game code used to download the combo package represented by this instance.
		/// </summary>
		public string GameCode { get; private set; }

		/// <summary>
		/// Gets the title of the combo package represented by this instance.
		/// </summary>
		public string Title { get; private set; }

		/// <summary>
		/// Gets the version of the combo package represented by this instance.
		/// </summary>
		public string Version { get; private set; }

		/// <summary>
		/// Gets the binary data for the icon of the combo package represented by this instance.
		/// </summary>
		public byte[] IconData { get; private set; }

		#endregion

		#region Constructors

		/// <summary>
		/// Initializes the class.
		/// </summary>
		static ComboPackageInfo() {
			Empty = new ComboPackageInfo();
		}

		/// <summary>
		/// Creates an empty instance of ComboPackageInfo.
		/// </summary>
		private ComboPackageInfo() { }

		/// <summary>
		/// Creates an instance of ComboPackageInfo with the specified file name and title.
		/// </summary>
		/// <param name="fileName">The file name of the combo package info to create.</param>
		/// <param name="gameCode">The game code of the combo package info to create.</param>
		/// <param name="title">The title of the combo package info to create.</param>
		/// <param name="version">The version of the combo package info to create.</param>
		/// <param name="iconData">The binary data for the icon of the combo package info to create.</param>
		public ComboPackageInfo(string fileName, string gameCode, string title, string version, byte[] iconData)
			: this() {
			FileName = fileName;
			GameCode = gameCode;
			Title = title;
			Version = version;
			IconData = iconData;
		}

		/// <summary>
		/// Creates an instance of ComboPackageInfo with the specified file name and title.
		/// </summary>
		/// <param name="fileName">The file name of the combo package info to create.</param>
		/// <param name="gameCode">The game code of the combo package info to create.</param>
		/// <param name="title">The title of the combo package info to create.</param>
		/// <param name="version">The version of the combo package info to create.</param>
		public ComboPackageInfo(string fileName, string gameCode, string title, string version)
			: this(fileName, gameCode, title, version, null) {
		}

		/// <summary>
		/// Creates an instance of ComboPackageInfo from the specified ComboPackage.
		/// </summary>
		/// <param name="package">The ComboPackage to be represented.</param>
		/// <param name="includeIcon">A flag indicating whether or not to include the icon.</param>
		public ComboPackageInfo(ComboPackage package, bool includeIcon)
			: this(package.OriginalFileName, package.GameCode, package.Title, package.Version) {
			if (includeIcon) {
				IconData = package.GetIconData();
			}
		}

		/// <summary>
		/// Creates an instance of ComboPackageInfo from the specified ComboPackage.
		/// </summary>
		/// <param name="package">The ComboPackage to be represented.</param>
		public ComboPackageInfo(ComboPackage package)
			: this(package, false) {
		}

		#endregion

	}

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
I began programming on my Commodore 64 at around the age of 12. After migrating to DOS and then Windows, I decided to take on the Web. Several languages and platforms later, I have settled in with .NET nicely. I am currently the owner of a software consulting company and lead application developer for a learning-based technology consultation company.

The love of a finished application is usually at war with the desire to improve it as soon as it's released (they're never really finished).

Comments and Discussions