Exemple #1
0
        //Function called when the save game button is clicked
        private void SaveGameButton_Click(object sender, EventArgs e)
        {//Create an in instance of a new Party object
            Party a = new Party();
            //Create an in instance of a new Party object
            Party b = new Party();
            //Create an enum variable
            Enum E;
            //Create a new list of Party objects
            List <Party> pList = new List <Party>();

            //Create a new int variable and set it to the index
            int number = iIndex;

            //Set the units list inside this party to the playerParty
            a.ulUnits = ulPlayerParty;
            //Set the units list inside this party to the enemyParty
            b.ulUnits = ulEnemyParty;
            //Set the Enum variable to the currentStates name
            E = refer.fsm.sCurrentState.eName;

            //Serialize the Current state as a string and store it into a file called GameData
            _Save.SerializeToSave("GameData", E.ToString());
            //Serialize the a Party object and store it into a file called PartyData
            _Save.SerializeToSave("PartyData", a);
            //Serialize the b Party object and store it into a file called EnemyParty
            _Save.SerializeToSave("EnemyParty", b);
            //Serialize the number variable and store it into a file called CurrentAttacker
            _Save.SerializeToSave("CurrentAttacker", number);
            //Message box prompts user that the Game has been saved
            MessageBox.Show("Game Has Been Saved!", "Save", MessageBoxButtons.OK);
        }