コード例 #1
0
        public void Update(InputHandler input, StateHandler sh)
        {
            for (int i = 0; i < saveFileCount; i++)
            {
                this.playButtons[i].Update(input);
                this.deleteButtons[i].Update(input);

                if (deleteButtons[i].clicked)
                {
                    this.deleteButtons[i].clicked = false;
                    File.Delete(this.saveDir + saveNames[i] + ".ah");
                    this.Reload();
                }

                if (playButtons[i].clicked)
                {
                    this.playButtons[i].clicked = false;
                    sh.setCurState(State.GAME);
                    ((GameState)sh.curState).UpdateSaveData(PlayerSaver.LoadPlayerSaveFile(saveNames[i]));
                }
            }

            backButton.Update(input);

            if (backButton.clicked)
            {
                backButton.clicked = false;
                ((MenuState)sh.curState).curScreen = "main";
            }
        }
コード例 #2
0
        private void getSaveData(String dir)
        {
            for (int i = 0; i < this.saveFileCount; i++)
            {
                this.saveNames.Add(saveFilePaths[i].Split(new String[] { "My Games/Afterhour/" }, StringSplitOptions.None)[1].Split(new char[] { '.' })[0]);

                SaveData tempData = PlayerSaver.LoadPlayerSaveFile(saveNames[i]);
                this.saveLevels.Add(tempData.worldData.curLevel);

                //System.Diagnostics.Debug.WriteLine("Name " + (i+1) + ": " + saveNames[i] + "  Level: " + saveLevels[i]);
            }
        }
コード例 #3
0
        private void UpdateCharStats(InputHandler input, StateHandler sh)
        {
            nextButton2.Update(input);
            backButton2.Update(input);

            for (int i = 0; i < statCount; i++)
            {
                plusBoxes[i].Update(input);
                minusBoxes[i].Update(input);

                if (plusBoxes[i].clicked)
                {
                    plusBoxes[i].clicked = false;
                    if (remainingPoints > 0)
                    {
                        statValues[i]++;
                        remainingPoints--;
                    }
                }
                else if (minusBoxes[i].clicked)
                {
                    minusBoxes[i].clicked = false;
                    if (statValues[i] > 10)
                    {
                        statValues[i]--;
                        remainingPoints++;
                    }
                }


                statIcons[i].Update(input);
            }

            if (backButton2.clicked)
            {
                backButton2.clicked = false;
                this.curStep        = "character";
            }

            if (nextButton2.clicked)
            {
                nextButton2.clicked = false;
                if (remainingPoints == 0)
                {
                    PlayerSaver.SaveNewGame(new CharData(this.nameBox.text, this.genderBoxes.curSelectedID, this.hairstyleList.curElementID,
                                                         this.manaColorSlider.curColor, this.skinColorSlider.curColor, this.hairColorSlider.curColor, this.shirtColorSlider.curColor),
                                            this.statValues);

                    sh.setCurState(State.GAME);
                    ((GameState)sh.curState).UpdateSaveData(PlayerSaver.LoadPlayerSaveFile(this.nameBox.text));
                }
            }
        }