Ejemplo n.º 1
0
        public GameIO()
        {
            Scoredata = new ScoreData(5);
            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory))
            {
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory);
            }
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory + "/" + fileName))
            {
                SaveScores();
            }
            else
            {
                LoadScores();
            }

            dataDirectory = "Spectrum/Data";
            fileName      = "abilities.dat";
            Abilitydata   = new AbilityData(4);
            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory))
            {
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory);
            }
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory + "/" + fileName))
            {
                SaveAbilities();
            }
            else
            {
                LoadAbilities();
            }
        }
Ejemplo n.º 2
0
        public void LoadScores()
        {
            FileStream stream = File.Open(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory + "/" + fileName, FileMode.OpenOrCreate, FileAccess.Read);

            try
            {
                XmlSerializer s = new XmlSerializer(typeof(ScoreData));
                Scoredata = (ScoreData)s.Deserialize(stream);
            }
            finally
            {
                stream.Close();
            }
        }
Ejemplo n.º 3
0
        public GameIO()
        {
            Scoredata = new ScoreData(5);
            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory))
            {
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory);
            }
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory + "/" + fileName))
            {
                SaveScores();
            }
            else
            {
                LoadScores();
            }

            dataDirectory = "Spectrum/Data";
            fileName = "abilities.dat";
            Abilitydata = new AbilityData(4);
            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory))
            {
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory);
            }
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory + "/" + fileName))
            {
                SaveAbilities();
            }
            else
            {
                LoadAbilities();
            }
        }
Ejemplo n.º 4
0
 public void LoadScores()
 {
     FileStream stream = File.Open(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dataDirectory + "/" + fileName, FileMode.OpenOrCreate, FileAccess.Read);
     try
     {
         XmlSerializer s = new XmlSerializer(typeof(ScoreData));
         Scoredata = (ScoreData)s.Deserialize(stream);
     }
     finally
     {
         stream.Close();
     }
 }
Ejemplo n.º 5
0
        public override void EnterState()
        {
            base.EnterState();

            data = mGameReference.aaDisplay.aaGame.aaHSManager.Scoredata;

            highscoreKit = new AssetKit_HighScore_Plaque();
            highscorePlaque = new UIElement_StaticMenuElement(mGameReference.aaDisplay, mGameReference.aaGameWorld, highscoreKit.ASSET_NAME, 640, 360, (int)highscoreKit.ORIGIN.X, (int)highscoreKit.ORIGIN.Y, Constants.LAYER_ENTITY_DEPTH, highscoreKit.SRC_RECTX, highscoreKit.SRC_RECTY, highscoreKit.SRC_RECTWIDTH, highscoreKit.SRC_RECTHEIGHT, 0.0f);
            mGameReference.aaDisplay.AddMenuUIElement(highscorePlaque);

            oneName = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 415, 290, Color.White, data.mName[0] + "");
            mGameReference.aaDisplay.AddMenuUIElement(oneName);
            twoName = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 415, 330, Color.White, data.mName[1] + "");
            mGameReference.aaDisplay.AddMenuUIElement(twoName);
            threeName = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 415, 370, Color.White, data.mName[2] + "");
            mGameReference.aaDisplay.AddMenuUIElement(threeName);
            fourName = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 415, 410, Color.White, data.mName[3] + "");
            mGameReference.aaDisplay.AddMenuUIElement(fourName);
            fiveName = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 415, 450, Color.White, data.mName[4] + "");
            mGameReference.aaDisplay.AddMenuUIElement(fiveName);

            if(data.mScore[0] != 0 && data.mWave[0] != 0)
            {
                oneScore = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 620, 290, Color.White, data.mScore[0] + "");
                mGameReference.aaDisplay.AddMenuUIElement(oneScore);
                oneWave = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 810, 290, Color.White, data.mWave[0] + "");
                mGameReference.aaDisplay.AddMenuUIElement(oneWave);
            }
            if (data.mScore[1] != 0 && data.mWave[1] != 0)
            {
                twoScore = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 620, 330, Color.White, data.mScore[1] + "");
                mGameReference.aaDisplay.AddMenuUIElement(twoScore);
                twoWave = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 810, 330, Color.White, data.mWave[1] + "");
                mGameReference.aaDisplay.AddMenuUIElement(twoWave);
            }
            if (data.mScore[2] != 0 && data.mWave[2] != 0)
            {
                threeScore = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 620, 370, Color.White, data.mScore[2] + "");
                mGameReference.aaDisplay.AddMenuUIElement(threeScore);
                threeWave = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 810, 370, Color.White, data.mWave[2] + "");
                mGameReference.aaDisplay.AddMenuUIElement(threeWave);
            }
            if (data.mScore[3] != 0 && data.mWave[3] != 0)
            {
                fourScore = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 620, 410, Color.White, data.mScore[3] + "");
                mGameReference.aaDisplay.AddMenuUIElement(fourScore);
                fourWave = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 810, 410, Color.White, data.mWave[3] + "");
                mGameReference.aaDisplay.AddMenuUIElement(fourWave);
            }
            if (data.mScore[4] != 0 && data.mWave[4] != 0)
            {
                fiveScore = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 620, 450, Color.White, data.mScore[4] + "");
                mGameReference.aaDisplay.AddMenuUIElement(fiveScore);
                fiveWave = new UIElement_Text(mGameReference.aaDisplay, mGameReference.aaGameWorld, mGameReference.aaDisplay.aaGame.mScoreFont, 810, 450, Color.White, data.mWave[4] + "");
                mGameReference.aaDisplay.AddMenuUIElement(fiveWave);
            }

            backButtonKit = new AssetKit_Menu_BackButton();
            backButton = new UIElement_MenuButton(mGameReference.aaDisplay, mGameReference.aaGameWorld, backButtonKit.ASSET_NAME, 15, 625, (int)backButtonKit.ORIGIN.X, (int)backButtonKit.ORIGIN.Y, Constants.LAYER_ENTITY_DEPTH, backButtonKit.SRC_RECTX, backButtonKit.SRC_RECTY, backButtonKit.SRC_RECTWIDTH, backButtonKit.SRC_RECTHEIGHT, 0.0f);
            mGameReference.aaDisplay.AddMenuUIElement(backButton);
        }