Created 2 new projects that are basically rewrites of the other two, many many many things are missing. but I want to effectively be able to switch states and commands without having to create dependencies.

Currently you can connect and Reach the "ConnectState" from there anything you state will just be an "InvalidCommand"
This commit is contained in:
darxval_cp 2012-06-04 18:40:46 -07:00
parent bec840f5e4
commit a0c406d482
37 changed files with 960 additions and 3 deletions

View file

@ -0,0 +1,44 @@
using System;
using System.Net.Sockets;
using System.Text;
using WinPC.Engine.Abstract.Core;
using WinPC.Engine.Commands;
using WinPC.Engine.Directors;
namespace WinPC.Engine.States
{
public class ConnectState : IState
{
public ServerDirector Director { get; private set; }
private Socket Connection { get; set; }
private ASCIIEncoding Encoding { get; set; }
private int Index;
public ConnectState(ServerDirector director)
{
Director = director;
Encoding = new ASCIIEncoding();
}
public void Render(int index)
{
Index = index;
Connection = Director.ConnectedPlayers[index].Connection;
Director.ConnectedPlayers[index].Connection.Send(Encoding.GetBytes("Welcome to Scionwest's Mud Engine!"+"\n\r"));
Director.ConnectedPlayers[index].Connection.Send(Encoding.GetBytes("Please enter your name" + "\n\r"));
}
public ICommand GetCommand()
{
var input = Director.RecieveInput(Index);
return new InvalidCommand(Connection);
}
}
}