示例#1
0
        private static void load_saved_scene(ViewGroup tableLayout, int aSide)
        {
            var saveGameArea = new SaveGameArea();
            var getSavedData = saveGameArea.GetGame_Area_(aSide);
            var gameButton   = new GameButton();

            for (var i = 0; i < aSide; i++)
            {
                for (var j = 0; j < aSide; j++)
                {
                    var tableRow    = (TableRow)tableLayout.GetChildAt(i);
                    var border      = (FrameLayout)tableRow.GetChildAt(j);
                    var frameLayout = (FrameLayout)border.GetChildAt(0);
                    if (getSavedData != null)
                    {
                        if (getSavedData.Values[i, j] <= 0)
                        {
                            continue;
                        }
                        frameLayout.SetBackgroundColor(gameButton.get_color_from_number(getSavedData.Values[i, j]));
                        GameButton.set_btn_number(border, getSavedData.Values[i, j].ToString());
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
示例#2
0
        add_new_number(
            int number)     //itt lehet majd újat hozzáadni a tablelayout-hoz úgyhogy a megfelelő sort és oszlop számot megadjuk
        {
            if (number < 10000)
            {
                if (is_place_for_btn())
                {
                    var random = new Random();
                    int randomRow;
                    int randomColoumn;
                    do
                    {
                        randomRow     = random.Next(0, _aSide);
                        randomColoumn = random.Next(0, _aSide);
                    } while (check_gameare_place(randomRow, randomColoumn));

                    GameButton.set_btn_number(_gameButtons[randomRow, randomColoumn],
                                              number.ToString()); //game_Buttons[random_row, random_coloumn].Text = number.ToString();
                    _gameButtons[randomRow, randomColoumn].GetChildAt(0)
                    .SetBackgroundColor(_gameButton.get_color_from_number(number));
                    _gombPlace[randomRow, randomColoumn] = 1; //van ott már egy szám
                    _informationContainer.add_point(number);
                    //save_game_Area_();
                }
                else
                {
                    New_game();
                }
            }
            else
            {
                bigger_then_the_biggest();
            }
        }
示例#3
0
        public void get_last_scene()
        {
            //   reset_game(false);
            var sum = 0;

            for (var i = 0; i < _lastPlaces.GetLength(0); i++)
            {
                for (var j = 0; j < _lastPlaces.GetLength(1); j++)
                {
                    if (_lastPlaces[i, j] == 1)
                    {
                        _gameButtons[i, j].GetChildAt(0)
                        .SetBackgroundColor(_gameButton.get_color_from_number(_lastValues[i, j]));
                        sum += _lastValues[i, j];
                        _gombPlace[i, j] = 1; //van ott már egy szám
                        GameButton.set_btn_number(_gameButtons[i, j], _lastValues[i, j].ToString());
                    }
                    else
                    {
                        _gombPlace[i, j] = 0;
                        GameButton.normal_btn(_gameButtons[i, j]);
                    }
                }
            }

            _informationContainer.set_score(sum);
        }
示例#4
0
        public void load_saved_game_Area(int[,] places, int[,] values)
        {
            var sum = 0;

            for (var i = 0; i < places.GetLength(0); i++)
            {
                for (var j = 0; j < places.GetLength(1); j++)
                {
                    if (places[i, j] == 1)
                    {
                        _gameButtons[i, j].GetChildAt(0)
                        .SetBackgroundColor(_gameButton.get_color_from_number(values[i, j]));
                        sum += values[i, j];
                        _gombPlace[i, j] = 1; //van ott már egy szám
                        GameButton.set_btn_number(_gameButtons[i, j], values[i, j].ToString());
                    }
                }
            }

            _informationContainer.add_point(sum);
        }