Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zsirozas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sillinger Péter
Zsirozas
Commits
510d708d
Commit
510d708d
authored
Mar 12, 2021
by
Sillinger Péter
Browse files
Options
Downloads
Patches
Plain Diff
Remove unneeded comments.
parent
e96e80f1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
zsirozas/GameClient.cs
+1
-19
1 addition, 19 deletions
zsirozas/GameClient.cs
zsirozas/Program.cs
+0
-9
0 additions, 9 deletions
zsirozas/Program.cs
zsirozas/RawTcpTransport.cs
+0
-181
0 additions, 181 deletions
zsirozas/RawTcpTransport.cs
with
1 addition
and
209 deletions
zsirozas/GameClient.cs
+
1
−
19
View file @
510d708d
...
...
@@ -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;
//}
}
...
...
This diff is collapsed.
Click to expand it.
zsirozas/Program.cs
+
0
−
9
View file @
510d708d
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
zsirozas/RawTcpTransport.cs
+
0
−
181
View file @
510d708d
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment