muddesigner/MudEngine/WinPC.Engine/Core/Player.cs
Scionwest_cp f977376ac3 Player.ToString retuns IPlayer.Name
ServerDirector.GetPlayer() helper method added for getting a player from the server without providing access to the servers collection libraries.
ConnectState.Render() has some test code used when writing ServerDirector.GetPlayer()

Started converting ConnectedPlayer and ConnectedThread collections to a single Dictionary collection.  Not migrating everything to it until helper methods are finished.
2012-06-05 20:46:11 -07:00

38 lines
No EOL
890 B
C#

using System.Collections.Generic;
using System.Net.Sockets;
using WinPC.Engine.Abstract.Core;
namespace WinPC.Engine.Core
{
public class Player : IPlayer
{
public Socket Connection { get; private set; }
public IState CurrentState { get; private set; }
public List<byte> buffer = new List<byte>();
public string Name { get; set; }
public Player(IState initialState, Socket connection)
{
Connection = connection;
CurrentState = initialState;
Name = "Player";
}
public void Disconnect()
{
Connection.Close();
}
public void SwitchState(IState state)
{
CurrentState = state;
}
public override string ToString()
{
return this.Name;
}
}
}