Ejemplo n.º 1
0
        public FormJoinGameInternet(Form _parent)
        {
            InitializeComponent();

            BackgroundImage             = ResourceCollection.GetResourceByName("menu_game_lobby.png");
            btnCancel.BackgroundImage   = ResourceCollection.GetResourceByName("menu_button_back.png");
            btnJoinGame.BackgroundImage = ResourceCollection.GetResourceByName("menu_button_join_game.png");

            SetColumnsToDgv();

            this.TransparencyKey = Color.FromArgb(31, 32, 33);
            this.BackColor       = Color.FromArgb(31, 32, 33);

            Control.CheckForIllegalCrossThreadCalls = false;

            Cursor = new Cursor(Properties.Resources.cursor.Handle);

            fg                = new FormGame(this);
            model             = new ModelGame();
            ctrl              = new ControllerInternet(model, fg);
            fg.GameController = ctrl;

            _movable     = false;
            this._parent = _parent;

            FindGames();
        }
Ejemplo n.º 2
0
        public FormLanMenu(Form _parent)
        {
            InitializeComponent();

            BackgroundImage               = ResourceCollection.GetResourceByName("main_menu.png");
            btnBack.BackgroundImage       = ResourceCollection.GetResourceByName("menu_button_back.png");
            btnJoinGame.BackgroundImage   = ResourceCollection.GetResourceByName("menu_button_join_game.png");
            btnCreateGame.BackgroundImage = ResourceCollection.GetResourceByName("menu_button_create_game.png");

            this.TransparencyKey = Color.FromArgb(31, 32, 33);
            this.BackColor       = Color.FromArgb(31, 32, 33);
            this.Icon            = Properties.Resources.logo1;
            this._parent         = _parent;
            Location             = _parent.Location;

            _movable = false;

            _tCreate = new Timer()
            {
                Interval = 5,
                Enabled  = false
            };

            _tJoin = new Timer()
            {
                Interval = 5,
                Enabled  = false
            };

            _tCreate.Tick += _tCreate_Tick;
            _tJoin.Tick   += _tJoin_Tick;
        }
Ejemplo n.º 3
0
        public FormOptionsMenu(Form _parent)
        {
            InitializeComponent();

            TransparencyKey = Color.FromArgb(31, 32, 33);
            BackColor       = Color.FromArgb(31, 32, 33);

            string image = "";
            string label = "Audio: ";

            if (Ad_Gloriam.Manager.AudioManager.Enabled)
            {
                image  = "soundEnabled.png";
                label += "ON";
            }
            else
            {
                image  = "soundDisable.png";
                label += "OFF";
            }

            btnAudio.BackgroundImage = ResourceCollection.GetResourceByName(image);
            lblAudio.Text            = label;

            this._parent = _parent;
            Location     = new Point(_parent.Location.X, _parent.Location.Y);

            _t = new Timer()
            {
                Enabled  = true,
                Interval = 10
            };

            _t.Tick += _t_Tick;
        }
Ejemplo n.º 4
0
        public FormCreateGameInternet(Form _parent)
        {
            InitializeComponent();

            BackgroundImage               = ResourceCollection.GetResourceByName("menu_create_game.png");
            btnCancel.BackgroundImage     = ResourceCollection.GetResourceByName("menu_button_back.png");
            btnCreateGame.BackgroundImage = ResourceCollection.GetResourceByName("menu_button_create_game.png");

            this.TransparencyKey = Color.FromArgb(31, 32, 33);
            this.BackColor       = Color.FromArgb(31, 32, 33);
            this._parent         = _parent;
            this.Icon            = Properties.Resources.logo1;

            tbxGameName.BackColor     = Color.FromArgb(179, 179, 179);
            tbxGamePassword.BackColor = Color.FromArgb(179, 179, 179);

            _movable = false;

            _names = new List <string>();

            Random r = new Random();

            for (int i = 0; i < 10000; i++)
            {
                _names.Add(_gameNames[r.Next(0, _gameNames.Length - 1)] + i);
            }
        }
Ejemplo n.º 5
0
        public FormGame(Form _parent)
        {
            Ad_Gloriam.Manager.AudioManager.PlayLoop(Audio.GameLoop);
            InitializeComponent();

            BackgroundImage = ResourceCollection.GetResourceByName("ad_gloriam_game_background.png");

            _buttons          = new Button[8, 8];
            pnlGame.BackColor = Color.Transparent;
            Draw();

            TransparencyKey = Color.FromArgb(31, 32, 33);
            BackColor       = Color.FromArgb(31, 32, 33);
            Icon            = Properties.Resources.logo1;

            _movable = false;

            this._parent = _parent;

            _t = new Timer()
            {
                Enabled  = true,
                Interval = 10
            };

            _t.Tick += _t_Tick;
        }
Ejemplo n.º 6
0
        private void Draw()
        {
            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    _buttons[i, j]             = new Button();
                    _buttons[i, j].Size        = new Size(65, 65);
                    _buttons[i, j].Location    = new Point(i * 80, j * 80);
                    _buttons[i, j].Name        = i + "" + j;
                    _buttons[i, j].KeyDown    += Button_KeyDown;
                    _buttons[i, j].TabStop     = false;
                    _buttons[i, j].Click      += Button_Click;
                    _buttons[i, j].MouseEnter += Button_MouseEnter;
                    _buttons[i, j].MouseLeave += Button_MouseLeave;
                    _buttons[i, j].MouseMove  += Button_MouseMove;
                    _buttons[i, j].FlatStyle   = FlatStyle.Flat;
                    _buttons[i, j].FlatAppearance.CheckedBackColor   = Color.Transparent;
                    _buttons[i, j].FlatAppearance.BorderSize         = 0;
                    _buttons[i, j].FlatAppearance.MouseDownBackColor = Color.Transparent;
                    _buttons[i, j].FlatAppearance.MouseOverBackColor = Color.Transparent;
                    _buttons[i, j].BackgroundImage       = ResourceCollection.GetResourceByName("token_neutral.png");
                    _buttons[i, j].BackgroundImageLayout = ImageLayout.Stretch;
                    pnlGame.Controls.Add(_buttons[i, j]);
                }
            }

            _buttons[0, 0].BackgroundImage = ResourceCollection.GetResourceByName("token_player1.png");
            _buttons[7, 0].BackgroundImage = ResourceCollection.GetResourceByName("token_player1.png");
            _buttons[0, 7].BackgroundImage = ResourceCollection.GetResourceByName("token_player2.png");
            _buttons[7, 7].BackgroundImage = ResourceCollection.GetResourceByName("token_player2.png");
        }
Ejemplo n.º 7
0
        private void btnAudio_Click(object sender, EventArgs e)
        {
            bool oldStatus = Ad_Gloriam.Manager.AudioManager.Enabled;

            Ad_Gloriam.Manager.AudioManager.Enabled = !oldStatus;

            if (btnAudio.BackgroundImage.Equals(ResourceCollection.GetResourceByName("soundEnabled.png")))
            {
                btnAudio.BackgroundImage = ResourceCollection.GetResourceByName("soundDisable.png");
                lblAudio.Text            = "Audio: OFF";
                Ad_Gloriam.Manager.AudioManager.StopLoop();
            }
            else
            {
                btnAudio.BackgroundImage = ResourceCollection.GetResourceByName("soundEnabled.png");
                Ad_Gloriam.Manager.AudioManager.PlayLoop(Ad_Gloriam.Model.Audio.MainTheme);
                lblAudio.Text = "Audio: ON";
            }
        }
Ejemplo n.º 8
0
        public void ShowAvailableFields(int x, int y)
        {
            var   coordinates = _controller.GetAvailableFieldsCoordinates(x, y);
            Point selected    = _controller.GetSelectedCoordinates();

            foreach (var point in coordinates)
            {
                if (point.X < 0 || point.X > 7 || point.Y < 0 || point.Y > 7)
                {
                    return;
                }
                _buttons[point.X, point.Y].BackgroundImage = ResourceCollection.GetResourceByName("token_neutral_jump.png");

                if (point.X == selected.X + 2 || point.X == selected.X - 2 || point.Y == selected.Y + 2 || point.Y == selected.Y - 2)
                {
                    _buttons[point.X, point.Y].BackgroundImage = ResourceCollection.GetResourceByName("token_neutral_avaiable.png");
                }
            }
        }
Ejemplo n.º 9
0
        public void Redraw()
        {
            Board.Field[,] table = _controller.GetTableFields();
            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    if (table[i, j] == Board.Field.Player1)
                    {
                        _buttons[i, j].BackgroundImage = ResourceCollection.GetResourceByName("token_player1.png");
                    }
                    if (table[i, j] == Board.Field.Player2)
                    {
                        _buttons[i, j].BackgroundImage = ResourceCollection.GetResourceByName("token_player2.png");
                    }
                    if (table[i, j] == Board.Field.Free)
                    {
                        _buttons[i, j].BackgroundImage = ResourceCollection.GetResourceByName("token_neutral.png");
                    }
                }
            }
            var coords = _controller.GetSelectedCoordinates();
            int x      = coords.X;
            int y      = coords.Y;

            if (x == -1 || y == -1)
            {
                return;
            }

            ShowAvailableFields(x, y);
            if (table[x, y] == Board.Field.Player1)
            {
                _buttons[x, y].BackgroundImage = _buttons[x, y].BackgroundImage = ResourceCollection.GetResourceByName("token_player1_selected.png");
            }
            else if (table[x, y] == Board.Field.Player2)
            {
                _buttons[x, y].BackgroundImage = _buttons[x, y].BackgroundImage = ResourceCollection.GetResourceByName("token_player2_selected.png");
            }
        }
Ejemplo n.º 10
0
        public FormMultiPlayerMenu(FormMainMenu _parent)
        {
            InitializeComponent();

            BackgroundImage             = ResourceCollection.GetResourceByName("main_menu.png");
            btnHotseat.BackgroundImage  = ResourceCollection.GetResourceByName("menu_button_hot_seat.png");
            btnLan.BackgroundImage      = ResourceCollection.GetResourceByName("menu_button_lan.png");
            btnInternet.BackgroundImage = ResourceCollection.GetResourceByName("menu_button_internet.png");
            button1.BackgroundImage     = ResourceCollection.GetResourceByName("menu_button_back.png");

            this.TransparencyKey = Color.FromArgb(31, 32, 33);
            this.BackColor       = Color.FromArgb(31, 32, 33);
            this.Icon            = Properties.Resources.logo1;
            this._parent         = _parent;

            _movable = false;

            _tHotseat = new Timer()
            {
                Interval = 5,
                Enabled  = false
            };

            _tLan = new Timer()
            {
                Interval = 5,
                Enabled  = false
            };

            _tInternet = new Timer()
            {
                Interval = 5,
                Enabled  = false
            };

            _tHotseat.Tick  += _tHotseat_Tick;
            _tLan.Tick      += _tLan_Tick;
            _tInternet.Tick += _tInternet_Tick;
        }
Ejemplo n.º 11
0
        public FormMainMenu()
        {
            Ad_Gloriam.Manager.AudioManager.PlayLoop(Audio.MainTheme);
            LoadServerIP();
            Opacity = 0;

            if (!File.Exists("./config.txt"))
            {
                ResourceCollection.SetDefaultCollection();
                StreamWriter sw = new StreamWriter("./config.txt");
                sw.WriteLine("Default");
                sw.Close();
            }
            else
            {
                StreamReader sr     = new StreamReader("./config.txt");
                string       config = sr.ReadLine();
                sr.Close();
                if (config.Equals("Default"))
                {
                    ResourceCollection.SetDefaultCollection();
                    StreamWriter sw = new StreamWriter("./config.txt");
                    sw.WriteLine("Default");
                    sw.Close();
                }
                else
                {
                    ResourceManagerImpl.LoadImages("./Themes/" + config);
                }
            }

            InitializeComponent();
            this.TransparencyKey = Color.FromArgb(31, 32, 33);
            this.BackColor       = Color.FromArgb(31, 32, 33);
            this.Icon            = Properties.Resources.logo1;

            BackgroundImage                 = ResourceCollection.GetResourceByName("main_menu.png");
            btnExit.BackgroundImage         = ResourceCollection.GetResourceByName("menu_button_exit.png");
            btnMultiPlayer.BackgroundImage  = ResourceCollection.GetResourceByName("menu_button_multyplayer.png");
            btnSinglePlayer.BackgroundImage = ResourceCollection.GetResourceByName("menu_button_singleplayer.png");
            btnOptions.BackgroundImage      = ResourceCollection.GetResourceByName("menu_button_options.png");

            _movable = false;

            _t = new Timer()
            {
                Enabled  = true,
                Interval = 10
            };

            _tSinglePlayer = new Timer()
            {
                Enabled  = false,
                Interval = 5
            };

            _tMultiplayer = new Timer()
            {
                Enabled  = false,
                Interval = 5
            };

            _tOptions = new Timer()
            {
                Enabled  = false,
                Interval = 5
            };

            _tSinglePlayer.Tick += _tSinglePlayer_Tick;
            _tMultiplayer.Tick  += _tMultiplayer_Tick;
            _tOptions.Tick      += _tOptions_Tick;
            _t.Tick             += _t_Tick;
        }