コード例 #1
0
ファイル: Client.cs プロジェクト: nabondance/Tetris-network
        public static void Main(String[] args)
        {
            Console.CursorVisible = false;                                                    // Invisible cursor
            Player player = new Player(args[0], args[1], args[2], args[3], args[4], args[5]); // Create the player with informations from arguments typed during the cmd start

            Console.Title = player.ID;                                                        // Change the name of the console by the ID of the player

            while (true)
            {
                string initialize = SendMessage(args[0], Int32.Parse(args[1]), "<Initialize>" + player.ID, "<ReturnInitialize>");

                string[] Initialize = initialize.Split(';');

                player.ListeningPort = Int32.Parse(Initialize[3]);
                Platform platform = new Platform(Int32.Parse(Initialize[0]), Int32.Parse(Initialize[1]), Int32.Parse(Initialize[2]), player);

                if (Int64.Parse(Initialize[4]) == 1) // Game can start
                {
                    platform.StartGame();
                }
                else
                {
                    if (player.StartListening()) // Game can start
                    {
                        platform.StartGame();
                    }
                }
            }
        }