Exemple #1
0
        public Llatext.Instructions.Instruction Introduction()
        {
            InevitableGUI.Output("You wake up the next morning. You grab some of your previous inventory items and take them with you");
            InevitableGUI.Output("Your next mission is to obtain some breakfast from the Supermarket: cerial and milk.");


            //Bit dirty - but this means it doesn't come from a savegame
            if (InventoryHandling.InventoryCount() != 0)
            {
                //clear the inventory
                InventoryHandling.RemoveAll();

                InventoryHandling.AddItem(new InventoryItem("money", "Enough cash to buy yourself some cerial and milk"));
                InventoryHandling.AddItem(new InventoryItem("hammerdriver", "Your faithful multi-tool companion"));

                return(new Instruction(InstructionType.SAVE, "1")); //save day 1
            }
            else
            {
                //comes from a savegame
                InventoryHandling.AddItem(new InventoryItem("money", "Enough cash to buy yourself some cerial and milk"));
                InventoryHandling.AddItem(new InventoryItem("hammerdriver", "Your faithful multi-tool companion"));

                return(new Instruction());
            }
        }
Exemple #2
0
        /// <summary>
        /// Loads a game from a saved file
        /// </summary>
        /// <param name="name">The name of the file to load</param>
        private static Instruction LoadSavedGame(string name)
        {
            //Is the file really there
            try
            {
                FileStream stream = new FileStream(name + ".isg", FileMode.Open);

                BinaryReader reader = new BinaryReader(stream);

                //first one is the day, second is the gotdfc and third is the time

                int day = reader.ReadInt32();
                InventoryHandling.Goodfc = reader.ReadInt32();

                //Change the start time

                TimeSpan span = new TimeSpan(0, 0, reader.ReadInt32());

                startTime = DateTime.Now - span;
                InventoryHandling.RemoveAll(); //clear the inventory

                return(new Instruction(InstructionType.LOAD, "day" + day));
            }
            catch
            {
                //File not there
                InevitableGUI.Output("The save game does not exist :( Sorry.");
                return(new Instruction(InstructionType.UNKNOWN, ""));
            }
            //We have to read 3 values
        }