Added SwitchStateCommand ability, Future (replace dual lists to single Dictionary)
This commit is contained in:
parent
a0c406d482
commit
ca97b9c439
7 changed files with 69 additions and 3 deletions
|
@ -1,18 +1,48 @@
|
|||
using WinPC.Engine.Abstract.Core;
|
||||
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 MainMenuState : IState
|
||||
{
|
||||
|
||||
public ServerDirector Director { get; private set; }
|
||||
private Socket Connection { get; set; }
|
||||
private ASCIIEncoding Encoding { get; set; }
|
||||
private int Index;
|
||||
|
||||
public MainMenuState(ServerDirector director)
|
||||
{
|
||||
Director = director;
|
||||
Encoding = new ASCIIEncoding();
|
||||
|
||||
}
|
||||
public void Render(int index)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
Index = index;
|
||||
|
||||
Connection = Director.ConnectedPlayers[index].Connection;
|
||||
|
||||
Director.ConnectedPlayers[index].Connection.Send(Encoding.GetBytes("Your now in the Main Menu State Welcome!! !"+"\n\r"));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ICommand GetCommand()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
||||
var input = Director.RecieveInput(Index);
|
||||
|
||||
if(input == "connect")
|
||||
{
|
||||
return new SwitchStateCommand(Director, new ConnectState(Director),Index);
|
||||
}
|
||||
return new InvalidCommand(Connection);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue