using System;
using System.Collections.Generic;
using Woodpecker.Specialized.Text;
namespace Woodpecker.Game.Arcade
{
///
/// Represents an arcade game.
///
public class arcadeGame
{
#region Fields
///
/// The unique database ID of this game, used for identification, arena allocation and score saving.
///
public int ID;
///
/// A value of the arcadeGameType enum representing the type of this game.
///
private arcadeGameType mType;
///
/// A value of the arcadeGameType enum representing the type of this game.
///
public arcadeGameType Type
{
get { return mType; }
}
///
/// A value of the arcadeGameType enum representing the type of this game.
///
private arcadeGameState mState;
///
/// A value of the arcadeGameState enum representing the state of this game.
///
public arcadeGameState State
{
get { return mState; }
}
///
/// The arcadeGameArena instance of this game. The arena is where all game action happens once the game has started. Null if the game is not started yet.
///
private arcadeGameArena mArena;
///
/// The database ID of the user that created this arcade game.
///
private int creatorUserID;
///
/// A List collection of the type arcadeGamePlayer, representing the players that have joined one of this game's teams.
///
private List mPlayers = new List();
///
/// A List collection of the type unsigned integer, holding the session IDs of the sessions that are currently spectating this game.
///
private List mSpectatorSessionIDs = new List();
#region Game details
///
/// The title of this arcade game, this name is assigned by the game owner upon creating.
///
public string Title;
///
/// The ID of the map that is being played on in this game.
///
public int mapID;
#endregion
#endregion
#region Methods
///
/// Tries to return the gamePlayer object of this game's creator.
///
///
public arcadeGamePlayer getOwnerPlayer()
{
foreach (arcadeGamePlayer lPlayer in mPlayers)
{
if (lPlayer.isGameOwner)
return lPlayer;
}
return null;
}
///
/// Returns the string representation of this arcade game for display in the game list.
///
public string ToSummaryString()
{
fuseStringBuilder FSB = new fuseStringBuilder();
FSB.appendWired(this.ID);
FSB.appendClosedValue(this.Title);
arcadeGamePlayer pOwner = this.getOwnerPlayer();
if (pOwner != null)
{
FSB.appendWired(pOwner.roomUnitID);
FSB.appendClosedValue(pOwner.Username);
}
else
{
FSB.appendWired(-1);
FSB.appendClosedValue("???");
}
FSB.appendWired(mapID);
return FSB.ToString();
}
///
/// Returns the string representation of this arcade game.
///
public override string ToString()
{
return "";
}
#endregion
#region Nested
///
/// A set of values for state of an arcade game.
///
public enum arcadeGameState
{
Waiting = 0,
Started = 1,
Ended = 2
}
#endregion
}
}