using System;
using Woodpecker.Game;
namespace Woodpecker.Game.Arcade
{
public class arcadeReactor : Reactor
{
private int mGameID = -1;
///
/// Sends a given gamesys error message to the client. (mesasge 236)
///
/// The ID of the error message.
private void sendGameError(int errorID)
{
Response.Initialize(236); // "Cl"
Response.appendWired(errorID);
sendResponse();
}
///
/// Performs a ticket check, to check if the user has enough game tickets to play a game, if not, it alerts the session user. The result is returned.
///
private bool performTicketCheck()
{
if (Session.User.Tickets >= 2)
{
return true;
}
sendGameError(2);
return false;
}
///
/// 159 - "B_"
///
public void GET_GAME_LIST()
{
Response.Initialize(232); // "Ch"
arcadeGameLobby pLobby = Engine.Game.Arcade.getLobby(Session.roomID);
if (pLobby != null)
Response.Append(pLobby.buildGameIndex());
sendResponse();
}
///
/// 160 - "B`"
///
public void START_OBSERVING_GAME()
{
int gameID = Request.getNextWiredParameter();
arcadeGame pGame = Engine.Game.Arcade.getLobby(Session.roomID).getGame(gameID);
Response.Initialize(233); // "Ci"
if(pGame != null)
{
mGameID = gameID;
// TODO: ADD
Response.Append(pGame.ToString());
}
sendResponse();
}
///
/// 162 - "Bb"
///
public void GET_CREATE_GAME_INFO()
{
Response.Initialize(171); // "Bk"
arcadeGameLobby pLobby = Engine.Game.Arcade.getLobby(Session.roomID);
if (pLobby != null)
{
// TODO: append info keys
}
sendResponse();
}
///
/// 163 - "Bc"
///
public void CREATE_GAME()
{
arcadeGameLobby pLobby = Engine.Game.Arcade.getLobby(Session.roomID);
if (pLobby != null)
{
if (performTicketCheck() == true)
{
}
}
}
///
/// 165 - "Be"
///
public void JOIN_GAME()
{
}
///
/// 166 - "Bf"
///
public void SPECTATE_GAME()
{
}
///
/// 167 - "Bg"
///
public void LEAVE_GAME()
{
}
///
/// 168 - "Bh"
///
public void KICK_USER()
{
}
///
/// 170 - "Bj"
///
public void START_GAME()
{
}
///
/// 171 - "Bk"
///
public void GAME_INTERACT()
{
}
///
/// 172 - "Bl"
///
public void PLAY_AGAIN()
{
arcadeGame pGame = Engine.Game.Arcade.getLobby(Session.roomID).getGame(mGameID);
if (pGame != null && pGame.State == arcadeGame.arcadeGameState.Ended)
{
if (performTicketCheck() == true)
{
}
}
}
}
}