Exemplo n.º 1
0
        private static GeneralistProto Chat(string Order)
        {
            GeneralistProto proto = new GeneralistProto {
                Type = CmdTarget.Chat,
                Chat = new Chat {
                    Msg = Order
                }
            };

            return(proto);
        }
Exemplo n.º 2
0
        private static GeneralistProto List(string Order)
        {
            GeneralistProto proto = new GeneralistProto {
                Type      = CmdTarget.Servercmd,
                Servercmd = new CServer {
                    Cmd = CServer.Types.Cmd.Listing
                }
            };

            return(proto);
        }
Exemplo n.º 3
0
        private static GeneralistProto Hand(string Order)
        {
            GeneralistProto proto = new GeneralistProto {
                Type    = CmdTarget.Gamecmd,
                Gamecmd = new CGame {
                    Cmd = CGame.Types.Cmd.Hand
                }
            };

            return(proto);
        }
Exemplo n.º 4
0
 public void Send(ref GeneralistProto proto)
 {
     try
     {
         var data = proto.ToByteArray();
         State.Socket.Send(data);
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e.ToString());
         Environment.Exit(84);
     }
 }
Exemplo n.º 5
0
        public static GeneralistProto Generate(string Order)
        {
            GeneralistProto Proto = null;

            string keyResult = keys.FirstOrDefault <string>(s => Order.Contains(s));

            switch (keyResult)
            {
            case "#CREATE":
                Proto = Create(Order);
                break;

            case "#JOIN":
                Proto = Join(Order);
                break;

            case "#LIST":
                Proto = List(Order);
                break;

            case "#USERNAME":
                Proto = Username(Order);
                break;

            case "#TEAM":
                Proto = Team(Order);
                break;

            case "#CARD":
                Proto = Card(Order);
                break;

            case "#CONTRACT":
                Proto = Contract(Order);
                break;

            case "#HAND":
                Proto = Hand(Order);
                break;

            case "#EXIT":
                Environment.Exit(0);
                break;

            default:
                Proto = Chat(Order);
                break;
            }
            return(Proto);
        }
Exemplo n.º 6
0
        private static GeneralistProto Team(string Order)
        {
            if (Order.Length < 6)
            {
                return(null);
            }
            GeneralistProto proto = new GeneralistProto {
                Type     = CmdTarget.Lobbycmd,
                Lobbycmd = new CLobby {
                    Cmd  = CLobby.Types.Cmd.Team,
                    Team = (Order.Substring(6).Equals("BLUE")) ? CoincheClient.Team.Blue : CoincheClient.Team.Red
                }
            };

            return(proto);
        }
Exemplo n.º 7
0
        private static GeneralistProto Username(string Order)
        {
            if (Order.Length < 10)
            {
                return(null);
            }
            GeneralistProto proto = new GeneralistProto {
                Type     = CmdTarget.Lobbycmd,
                Lobbycmd = new CLobby {
                    Cmd   = CLobby.Types.Cmd.Username,
                    Value = Order.Substring(10)
                }
            };

            return(proto);
        }
Exemplo n.º 8
0
        private static GeneralistProto Join(string Order)
        {
            if (Order.Length < 6)
            {
                return(null);
            }
            GeneralistProto proto = new GeneralistProto {
                Type      = CmdTarget.Servercmd,
                Servercmd = new CServer {
                    Cmd   = CServer.Types.Cmd.Join,
                    Value = Order.Substring(6)
                }
            };

            return(proto);
        }
Exemplo n.º 9
0
        private static GeneralistProto Contract(string Order)
        {
            if (Order.Length < 10)
            {
                return(null);
            }
            GeneralistProto proto = new GeneralistProto {
                Type    = CmdTarget.Gamecmd,
                Gamecmd = new CGame {
                    Cmd   = CGame.Types.Cmd.Contract,
                    Value = Order.Substring(10)
                }
            };

            return(proto);
        }
Exemplo n.º 10
0
        private static void ConnectAndStart()
        {
            Console.Out.WriteLine("Please insert your name, you little peace of shit:");
            var         name   = Console.In.ReadLine();
            AsyncClient client = new AsyncClient("localhost", 42000);

            client.Start();
            GeneralistProto proto = new GeneralistProto {
                Type = CmdTarget.Authentification,
                Auth = new Authentification {
                    Name = name
                },
                //optional timestamp
            };

            client.Send(ref proto);
            StartInteraction(ref client);
        }