コード例 #1
0
        /// <summary>
        /// Updates the locally stored variables that allow ALL rooms to be visible, including ones behind closed doors
        /// </summary>
        /// <param name="room"></param>
        private void CheckForDoors(ref Place room)
        {
            foreach (Item item in room.GetItems())
            {
                int doorCounterpart = item.GetDoorCounterpart(Saves.Items);

                if (doorCounterpart != -1) // if item is a door
                {
                    List <string[]> itemResults = item.GetResults();

                    switch (LocalConvert.ToLocationDirection(itemResults[0][0]))
                    {
                    case LocationDirection.North:
                        room.NorthDoor = item.ID;
                        North          = Convert.ToInt16(itemResults[0][1]);
                        break;

                    case LocationDirection.East:
                        room.EastDoor = item.ID;
                        East          = Convert.ToInt16(itemResults[0][1]);
                        break;

                    case LocationDirection.South:
                        room.SouthDoor = item.ID;
                        South          = Convert.ToInt16(itemResults[0][1]);
                        break;

                    case LocationDirection.West:
                        room.WestDoor = item.ID;
                        West          = Convert.ToInt16(itemResults[0][1]);
                        break;

                    case LocationDirection.Up:
                        room.UpDoor = item.ID;
                        Up          = Convert.ToInt16(itemResults[0][1]);
                        break;

                    case LocationDirection.Down:
                        room.DownDoor = item.ID;
                        Down          = Convert.ToInt16(itemResults[0][1]);
                        break;
                    }
                }
            }
        }
コード例 #2
0
        public Dictionary <LocationDirection, Item> GetDoors()
        {
            Dictionary <LocationDirection, Item> valuePairs = new Dictionary <LocationDirection, Item>();

            foreach (Item item in GetItems())
            {
                if (item.GetDoorCounterpart(Saves.Items) != -1)
                {
                    LocationDirection direction = LocalConvert.ToLocationDirection(item.GetResults()[0][0]);
                    if (!valuePairs.ContainsKey(direction))
                    {
                        valuePairs.Add(direction, item);
                    }
                }
            }

            return(valuePairs);
        }