Exemple #1
0
 public SaveFile(Lingo lingoGame, WordManager wordManager, Colors[] result,
     Colors[] foundLetters, Colors[,] earlierResult, String[,] earlierLetters)
 {
     this.lingoGame = lingoGame;
     this.wordManager = wordManager;
     this.result = result;
     this.foundLetters = foundLetters;
     this.earlierLetters = earlierLetters;
     this.earlierResult = earlierResult;
 }
Exemple #2
0
        /// <summary>
        /// Initiate start values in the form
        /// </summary>
        private void initializeGUI()
        {

            ///Initiate the objects that is needed from the start
            loadSaveManager = new LoadSave();
            lingoGame = new Lingo();
            wordManager = new WordManager();
            resultColors = new Colors[5];
            foundLetters = new Colors[5] { Colors.Red, Colors.Red, Colors.Red,
                    Colors.Red, Colors.Red };
            
            ///Initiate the playboard and put all the 
            ///textboxes to the playboard-array
            playBoard = new TextBox[5, 5];
            getGuiBoxesToArray();

            getFirstLetter(); ///Get the first letter to ease up the game

            updateGUI();
        }
Exemple #3
0
        /// <summary>
        /// Start a new game from scratch
        /// </summary>
        private void newGame()
        {
            lingoGame = new Lingo();
            wordManager = new WordManager();

            resetBoard();
            btnCheck.Enabled = true;

            getFirstLetter();

            updateGUI();

            ///Re-install the ability to save
            saveToolStripMenuItem.Enabled = true;
        }
Exemple #4
0
        /// <summary>
        /// Load a previous game-session into the current session of the game
        /// </summary>
        /// <returns></returns>
        private bool loadGame()
        {


            LoadForm loadForm = new LoadForm();
            loadForm.ShowDialog();
            string loadPath = loadForm.saveFilePath;

            loadSaveManager = new LoadSave();
            saveFile = loadSaveManager.loadData(saveFile, loadPath);

            if (saveFile != null)
            {
                resetBoard();

                lingoGame = saveFile.lingoGame;
                wordManager = saveFile.wordManager;
                resultColors = saveFile.result;
                foundLetters = saveFile.foundLetters;
                earlierLetters = saveFile.earlierLetters;
                earlierResult = saveFile.earlierResult;

                ///If a game is loaded after the previous is finnished
                if (!btnCheck.Enabled) 
                    btnCheck.Enabled = true;

                return true;
            }

            else { return false; }
        }