Skip to content
Snippets Groups Projects
Commit 510d708d authored by Sillinger Péter's avatar Sillinger Péter
Browse files

Remove unneeded comments.

parent e96e80f1
Branches
No related tags found
No related merge requests found
......@@ -63,7 +63,6 @@ namespace zsirozas
{
remoteServer = new RawTcpRemoteServer(serverAddr.Address, serverAddr.Port, this, IPAddress.Any, serverIncoming);
//if (SendRequest(ServerAction.Login, nickname + "\n" + ((IPEndPoint)incomingListener.Server.LocalEndPoint).Port))
//TODO: ez így ronda!
userID = remoteServer.CreateUser(nickname, ConnectionType.RawTCP, ((IPEndPoint) (remoteServer as RawTcpRemoteServer).incomingListener.Server.LocalEndPoint).Port);
if (!string.IsNullOrEmpty(userID))
......@@ -193,10 +192,6 @@ namespace zsirozas
{
line = sr.ReadLine();
}
//if (Enum.TryParse(line, out GameEvent gameEvent))
//{
// InGameNotify(gameEvent, sr.ReadLine());
//}
InGameNotify((GameEvent)Enum.Parse(typeof(GameEvent), line), sr.ReadLine());
}
......@@ -219,7 +214,6 @@ namespace zsirozas
playerIDX = Array.IndexOf<string>(gameState.playersByOrder, userID);
gameStateCanged(this, @event);
//SendRequest(ServerAction.GameAction, PlayerAction.GetCards + "\n0");
Cards = remoteServer.GameAction(gameID, userID, PlayerAction.GetCards, 0) as Card[];
cardsChanged();
break;
......@@ -229,8 +223,7 @@ namespace zsirozas
break;
case GameEvent.GameOver:
gameID = null;
//var dummy = new { ID = "", score = 0 };
var scores = ser.Deserialize<IEnumerable<Dictionary<string, object>>>(param0);//.Select((arg) => CastByExample(dummy, arg));
var scores = ser.Deserialize<IEnumerable<Dictionary<string, object>>>(param0);
string msg = string.Join("\n", scores.Select((arg) => arg["score"] + " \t " + arg["ID"]).ToArray());
gameOver(this, "A játéknak vége!\n" + msg);
break;
......@@ -269,7 +262,6 @@ namespace zsirozas
{
try
{
//return SendRequest(ServerAction.GameAction, PlayerAction.Card + "\n" + Cards[card_num].ID);
remoteServer.GameAction(gameID, userID, PlayerAction.Card, Cards[card_num].ID);
return true;
}
......@@ -285,7 +277,6 @@ namespace zsirozas
{
try
{
//return SendRequest(ServerAction.GameAction, PlayerAction.EndTurn + "\n0");
remoteServer.GameAction(gameID, userID, PlayerAction.EndTurn, 0);
return true;
}
......@@ -299,15 +290,6 @@ namespace zsirozas
public MidGameState gameState;
public event EventHandler<GameEvent> gameStateCanged;
//névtelen típusra cast-oláshoz
//private static T CastByExample<T>(T typeHolder, Object x)
//{
// // typeHolder above is just for compiler magic
// // to infer the type to cast x to
// return (T)x;
//}
}
......
......@@ -50,15 +50,6 @@ namespace zsirozas
{
public static void Main(string[] args)
{
//if (args.Contains("--server"))
//{
// var srv = new GameServer(args.Contains("--bigroom"), args.Contains("--oneshot"));
// new ServerWrapper(srv).Run(args.Contains("--signalr"), !args.Contains("--notcp"));
//}
//else
//{
// Application.Run(new Form1());
//}
Parser.Default.ParseArguments<CommandLineOptions>(args).WithParsed((options) =>
{
if (options.StartServer)
......
......@@ -100,68 +100,6 @@ namespace zsirozas
}
}
}
//using (var sr = new StreamReader(messageStream))
//{
// string line = "";
// while (true)
// {
// try
// {
// while (string.IsNullOrEmpty(line))
// {
// line = sr.ReadLine();
// }
// var @event = (ServerEvent)Enum.Parse(typeof(ServerEvent), line);
// switch (@event)
// {
// case ServerEvent.GameEvent:
// //ToODO: validálni
// line = sr.ReadLine();
// GameEvent gameEvent;
// Enum.TryParse<GameEvent>(line, out gameEvent);
// switch (gameEvent)
// {
// case GameEvent.NewTurn:
// gameState = new JavaScriptSerializer().Deserialize<MidGameState>(sr.ReadLine());
// //ToODO: ezt majd valahol máshol nézegetni...
// playerIDX = Array.IndexOf<string>(gameState.playersByOrder, userID);
// gameStateCanged(this, gameEvent);
// //SendRequest(ServerAction.GameAction, PlayerAction.GetCards + "\n0");
// remoteServer.GameAction(gameID, userID, PlayerAction.GetCards, 0); cardsChanged();
// break;
// case GameEvent.CardAction:
// gameState = new JavaScriptSerializer().Deserialize<MidGameState>(sr.ReadLine());
// gameStateCanged(this, gameEvent);
// break;
// case GameEvent.GameOver:
// string msg = sr.ReadLine();
// var dummy = new { ID = "", score = 0 };
// var scores = new JavaScriptSerializer()
// .Deserialize<IEnumerable<object>>(msg)
// .Select((arg) => CastByExample(dummy, arg));
// msg = string.Join("\n", scores.Select((arg) => arg.ID + "\t" + arg.score).ToArray());
// gameOver(this, "A játéknak vége!\n" + msg);
// break;
// default:
// break;
// }
// break;
// case ServerEvent.Logout:
// return;
// default:
// break;
// }
// }
// catch (Exception)
// {
// line = sr.ReadLine();
// continue;
// }
// }
//}
}
......@@ -245,7 +183,6 @@ namespace zsirozas
messageStream = incomingListener.AcceptTcpClient().GetStream();
new Thread(ListenForServer) { IsBackground = true }.Start();
return userID;
}
}
......@@ -522,123 +459,5 @@ namespace zsirozas
}
}
}
//public bool SendRequest(string userID, ServerAction action, string @params = null)
//{
// var tempConn = new TcpClient();
// tempConn.Connect(server);
// using (var sw = new StreamWriter(tempConn.GetStream()))
// using (var sr = new StreamReader(tempConn.GetStream()))
// {
// sw.WriteLine();
// string status = null;
// sw.WriteLine(action);
// switch (action)
// {
// case ServerAction.CreateRoom:
// sw.WriteLine(userID);
// sw.Flush();
// if ((status = sr.ReadLine()) != "OK")
// {
// status = sr.ReadLine();
// handleServerError(this, status);
// return false;
// }
// else
// {
// roomID = sr.ReadLine();
// }
// break;
// case ServerAction.JoinRoom:
// sw.WriteLine(userID);
// sw.WriteLine(@params);
// sw.Flush();
// if ((status = sr.ReadLine()) != "OK")
// {
// status = sr.ReadLine();
// handleServerError(this, status);
// return false;
// }
// else
// {
// roomID = @params;
// }
// break;
// case ServerAction.LeaveRoom:
// sw.WriteLine(userID);
// sw.Flush();
// if ((status = sr.ReadLine()) != "OK")
// {
// status = sr.ReadLine();
// handleServerError(this, status);
// return false;
// }
// break;
// case ServerAction.InviteUser:
// break;
// case ServerAction.GameAction:
// sw.WriteLine(gameID);
// sw.WriteLine(userID);
// sw.WriteLine(@params);
// sw.Flush();
// //TOoDO: ez a getCards idegesítően különc...
// if ((status = sr.ReadLine()) != "OK")
// {
// status = sr.ReadLine();
// handleServerError(this, status);
// return false;
// }
// else if (@params.Contains(PlayerAction.GetCards.ToString()))
// {
// status = sr.ReadLine();
// Cards = (new JavaScriptSerializer().Deserialize<IEnumerable<Card>>(status)).ToArray();
// cardsChanged();
// }
// break;
// case ServerAction.Logout:
// sw.WriteLine(userID);
// sw.Flush();
// break;
// case ServerAction.Ping:
// break;
// case ServerAction.Login:
// sw.WriteLine(@params);
// sw.Flush();
// if ((status = sr.ReadLine()) != "OK")
// {
// status = sr.ReadLine();
// handleServerError(this, status);
// return false;
// }
// else
// {
// userID = sr.ReadLine();
// }
// break;
// case ServerAction.StartGame:
// sw.WriteLine(@params);
// sw.Flush();
// if ((status = sr.ReadLine()) != "OK")
// {
// status = sr.ReadLine();
// handleServerError(this, status);
// return false;
// }
// else
// {
// gameID = sr.ReadLine();
// }
// break;
// case ServerAction.ListRooms:
// //case ServerAction.ListUsers:
// //case ServerAction.ListGames:
// default:
// break;
// }
// }
// tempConn.Close();
// return true;
//}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment