Ejemplo n.º 1
0
        public static void Main()
        {
            Console.CursorVisible = false;

            // Setting the console height and width.
            Console.BufferHeight = Console.WindowHeight = Constants.WorldRows + 1;
            Console.BufferWidth  = Console.WindowWidth = Constants.WorldCols;

            // Creating a renderer with the console height and width.
            IRenderer renderer = new ConsoleRenderer(Constants.WorldRows, Constants.WorldCols);

            // Assigning the user input to the keyboard.
            IUserKeyboardInput userInput = new KeyboardInput();

            // Creating an aim for the console user experience.
            IAim aim = Aim.Instance;

            // Ataching the aim methods to the userInput events
            userInput.OnDownPressed  += (sender, args) => { aim.MoveDown(); };
            userInput.OnLeftPressed  += (sender, args) => { aim.MoveLeft(); };
            userInput.OnRightPressed += (sender, args) => { aim.MoveRight(); };
            userInput.OnUpPressed    += (sender, args) => { aim.MoveUp(); };

            GameInitializator gameInitializator = new GameInitializator();

            // Creating an engine of the game.
            Engine engine = new Engine(renderer, userInput, aim, gameInitializator);

            // Starting the game.
            engine.Start();
        }
Ejemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            GameInitializator init = GameInitializator.Instance;

            init.OfflineMode();
            closeWindow();
            init.InitializeGame();
        }
Ejemplo n.º 3
0
        // Client setup
        private void button2_Click(object sender, EventArgs e)
        {
            GameInitializator init = GameInitializator.Instance;

            label6.Text = "";
            try {
                init.ConnectToServer(textBox3.Text, ushort.Parse(textBox2.Text));
                closeWindow();
                init.InitializeGame();
            } catch {
                label6.Text = "Połączenie nieudane ;__;";
            }
        }