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:
parent
bec840f5e4
commit
a0c406d482
37 changed files with 960 additions and 3 deletions
44
MudEngine/WinPC.Engine/States/ConnectState.cs
Normal file
44
MudEngine/WinPC.Engine/States/ConnectState.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue