Exemplo n.º 1
0
        public void SetInitialRoomIndex(InitialRooms.ID roomIndex)
        {
            Debug.Assert(InitialRooms.IsValidInitialRoomIndex(roomIndex));

            mInitialRoomIndex = roomIndex;

            mDescription = InitialRooms.initialRooms[roomIndex].mDescription;
        }
Exemplo n.º 2
0
 public void GenerateFreshGame(InitialRooms.ID initialRoomID = defaultInitialRoom)
 {
     mLastCommandResponse = newGameCommand;
     mInventory           = new Inventory();
     mRoom          = new Room();
     mGameTime      = new GameTime();
     mNPCIdentities = InitialRooms.identityData;
     InitialRooms.Initialize();
     mRoom.CreateFrom(initialRoomID, this);
 }
Exemplo n.º 3
0
        // Returns true if the game was successfully parsed
        public bool ParsePreviousText(string inputText)
        {
            string[] lines = inputText.Split('\n');

            if (lines.Length != numTotalRows)
            {
                return(false);
            }

            string saveDataLine = lines[saveDataRowIndex];

            mRoom          = new Room();
            mInventory     = new Inventory();
            mGameTime      = new GameTime();
            mNPCIdentities = new Dictionary <int, NPCIdentityData>();
            InitialRooms.Initialize();

            Load(saveDataLine);

            return(true);
        }
Exemplo n.º 4
0
        public void Stream(SaveStream stream)
        {
            if (stream.IsWriting())
            {
                Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex));
                stream.Stream(ref mInitialRoomIndex);
            }
            else
            {
                InitialRooms.ID roomIndex = InitialRooms.ID.Unknown;
                stream.Stream(ref roomIndex);
                SetInitialRoomIndex(roomIndex);
                LoadStaticGridFromInitialRoom();
            }

            int dynamicObjectCount = mDynamicObjects.Count;

            stream.Stream(ref dynamicObjectCount, SaveUtils.GetNumBitsToStoreValue(maxNumDynamicObjects));

            if (stream.IsWriting())
            {
                foreach (DynamicObject dynamicObject in mDynamicObjects)
                {
                    dynamicObject.Stream(stream);
                }
            }
            else
            {
                mDynamicObjects.Clear();

                for (int dynamicObjectIndex = 0; dynamicObjectIndex < dynamicObjectCount; dynamicObjectIndex++)
                {
                    DynamicObject dynamicObject = (DynamicObject)Emoji.CreateObject(stream as ReadStream);

                    dynamicObject.Stream(stream);
                    mDynamicObjects.Add(dynamicObject);
                }
            }
        }
Exemplo n.º 5
0
        void LoadDynamicObjectsFromInitialRoom()
        {
            Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex));

            mDynamicObjects = InitialRooms.initialRooms[mInitialRoomIndex].mDynamicObjects;
        }
Exemplo n.º 6
0
        void LoadStaticGridFromInitialRoom()
        {
            Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex));

            mStaticRoomGrid = InitialRooms.initialRooms[mInitialRoomIndex].mStaticRoomGrid;
        }