Example #1
0
        ///<summary>Show information (modal) about current levelset</summary>
        private void ActionLevelSetInfo()
        {
            string sMessage;

            //Main information
            sMessage = "File: " + uLevelSet.sFileName + "\r\n";
            if (uLevelSet.sTitle.Length > 0)
                sMessage += "Name: " + uLevelSet.sTitle + "\r\n";
            else
                sMessage += "Unnamed levelset\r\n";
            if (uLevelSet.sAuthor.Length > 0)
                sMessage += "Author: " + uLevelSet.sAuthor + "\r\n";
            if (uLevelSet.sCopyright.Length > 0)
                sMessage += "Copyright: " + uLevelSet.sCopyright + "\r\n";
            if (uLevelSet.sComment.Length > 0)
                sMessage += "Comment: " + uLevelSet.sComment + "\r\n";

            //Statistic
            sMessage += "\r\nLevels: " + uLevelSet.GetLevelsNum().ToString() + "\r\n";
            sMessage += "Unsolved: " + uLevelSet.GetNumOfUnsolved().ToString() + "\r\n";
            sMessage += "Now loaded level " + (uLevelSet.GetCurrentLevel() + 1).ToString() + ", '" + uGame.sTitle + "'\r\n";

            formShowInfo frmInf = new formShowInfo();
            LogSimpleLine(ActionID.ShowForm, "LevelSet Info; " + uLevelSet.sFileName);
            frmInf.ShowInfoText(sMessage, "LevelSet Info");//Show
        }
Example #2
0
        /*
        public void ActionChooseLevel()
        {
            ChooseLevel hChooseLevel = new ChooseLevel();
            hChooseLevel.bShowOnlyUnsolvedLevels = uSetting.bShowOnlyUnsolvedLevels;
            DialogResult uSelectResult;
            uSelectResult = hChooseLevel.SelectLevel(uLevelSet);
            if (uSelectResult == DialogResult.OK)
            {
                if (uLevelSet.LoadLevel(uCurrentLevel, hChooseLevel.iSelectedLevel)==0)
                    AfterLoadLevel();
            }
            uSetting.bShowOnlyUnsolvedLevels = hChooseLevel.bShowOnlyUnsolvedLevels;
        }*/
        /*
        public void ActionChooseLevelSet()
        {
            ChooseLevelSet hChooseLevelSet = new ChooseLevelSet();
            //hChooseLevel.bShowOnlyUnsolvedLevels = uSetting.bShowOnlyUnsolvedLevels;
            if (hChooseLevelSet.SelectLevelSet(uLevelSetList) == DialogResult.OK)
            {
                FunctionResult uRV;
                Cursor.Current = Cursors.WaitCursor;
                //LoadLevelSet(hChooseLevelSet.sSelectedSet);
                uRV = uLevelSetList.LoadLevelSet(uLevelSet, hChooseLevelSet.iSelectedSet);
                if (uRV != FunctionResult.OK)
                {
                    MessageBox.Show("Unable to load LevelSet, result: " + uRV.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    goto lExit;
                }
                uSetting.sLastLevelSet = uLevelSetList.GetCurrentLevelSet();

                int iNum = uLevelSet.GetNextUnsolved();
                if (iNum == -1)
                {
                    iNum = 0;
                }

                uLevelSet.LoadLevel(uCurrentLevel, iNum);//__what if not loaded?
                AfterLoadLevel();
                SaveSettings();
            lExit:
                Cursor.Current = Cursors.Default;
            }
            //uSetting.bShowOnlyUnsolvedLevels = hChooseLevel.bShowOnlyUnsolvedLevels;
        }*/
        /*
        public void ActionChooseLevelSet_OLD()
        {
            /*
            OpenFileDialog hSelectLevelSet = openFileDialog1; //new OpenFileDialog();
            hSelectLevelSet.InitialDirectory = sApplicationDirectory + @"Levels";//sLevelsDirectory;
            hSelectLevelSet.Filter = "All files (*.*)|*.*";
            if (hSelectLevelSet.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show(hSelectLevelSet.FileName);//sFileName);
                //LoadLevelSet(hSelectLevelSet.FileName.

            }
             /**/
        /*
        // * simple choose of file
        OpenFile hSelectLevelSet = new OpenFile();
        hSelectLevelSet.sFolder = sLevelsDirectory;
        hSelectLevelSet.sTitle = "Select Level Set";
        //string sFileName;

        if (hSelectLevelSet.SelectFileForLoad())
        {
            //MessageBox.Show(hSelectLevelSet.sFileName);
            LoadLevelSet(hSelectLevelSet.sFileName);

            uLevelSet.LoadLevel(uCurrentLevel, 0);//__what if not loaded?
            AfterLoadLevel();
            SaveSettings();
        }
        }*/
        /*
        public void ActionSetPlayerName()
        {
            InputBox sGetPlayerName = new InputBox();
            if (sGetPlayerName.AskUser(uSetting.sPlayerName, "Player name", "Input player name:") == DialogResult.OK)
            {
                uSetting.sPlayerName = sGetPlayerName.GetResult();
                SaveSettings();
            }

        }*/
        ///<summary>Show (modal) information about current level</summary>
        private void ActionLevelInfo()
        {
            //Main information
            string sMessage = "Level #" + (uLevelSet.GetCurrentLevel() + 1).ToString() + "\r\n";
            if (uGame.sTitle.Length > 0)
                sMessage += "Name: " + uGame.sTitle + "\r\n";
            if (uGame.sAuthor.Length > 0)
                sMessage += "Author: " + uGame.sAuthor + "\r\n";
            if (uGame.sComment.Length > 0)
                sMessage += "Comment: " + uGame.sComment + "\r\n";

            //Solving status and records
            if (uGame.IsSolved())
            {
                sMessage += "\r\nLevel is solved\r\n\r\n";//"+1" - to numerate level from 1
                sMessage += "Best moves: " + uGame.uBestMovesSolution.iMoves.ToString() + "\r\n" + "'" + uGame.uBestMovesSolution.sName + "'\r\n\r\n";
                sMessage += "Best pushes: " + uGame.uBestPushesSolution.iPushes.ToString() + "\r\n" + "'" + uGame.uBestPushesSolution.sName + "'\r\n\r\n";
            }
            else
            {
                sMessage += "\r\nLevel not solved\r\n";//"+1" - to numerate level from 1
            }

            //Sizes and statistic of elements
            sMessage += "Size: " + uGame.iXsize.ToString() + "x" + uGame.iYsize.ToString() + "\r\n";
            LevelStats uLevelStats = uGame.CalcLevelStats();
            if (uLevelStats.iNumPlayers != 1)
            {
                sMessage += uLevelStats.iNumPlayers.ToString() + " players,\r\n";
            }
            else
                sMessage += "One player,\r\n";
            if (uLevelStats.iNumBoxes == uLevelStats.iNumTargets)
            {
                sMessage += uLevelStats.iNumBoxes.ToString() + " boxes and targets,\r\n";
            }
            else
            {
                sMessage += uLevelStats.iNumBoxes.ToString() + " boxes, " + uLevelStats.iNumTargets.ToString() + " targets,\r\n";
            }
            sMessage += uLevelStats.iNumWalls.ToString() + " walls, ";
            sMessage += uLevelStats.iNumEmpty.ToString() + " spaces, ";
            sMessage += uLevelStats.iNumBackground.ToString() + " unused\r\n";
            sMessage += "Now " + uLevelStats.iNumBoxesOnTargets.ToString() + " boxes set to targets";

            sMessage += "\r\n" + uGame.iNumRemainExceedBoxes.ToString() + " exceeding boxes not in deadlock";

            //sMessage += "Best pushes: '" + uCurrentLevel.uBestPushesSolution.sName + "' " + uCurrentLevel.uBestPushesSolution.iMoves.ToString() + "/" + uCurrentLevel.uBestPushesSolution.iPushes.ToString() + "\r\n";
            //MessageBox.Show(sMessage, "Level information");

            formShowInfo frmInf = new formShowInfo();
            LogSimpleLine(ActionID.ShowForm, "Level Info; " + (uLevelSet.GetCurrentLevel() + 1).ToString() + "; " + uLevelSet.sFileName);
            frmInf.ShowInfoText(sMessage, "Level Info");//Showing to user
        }