示例#1
0
        public static PlayerRoomLayout FromPlaceableObjects(List <PlaceableObject> placeableObjects)
        {
            List <CompoundRoomItem> list = new List <CompoundRoomItem>(placeableObjects.Count);

            while (placeableObjects.Count > 0)
            {
                PlaceableObject placeableObject = placeableObjects[0];
                placeableObjects.Remove(placeableObject);
                if (placeableObject.PieceNumber == 1)
                {
                    List <PlaceableObject> list2 = new List <PlaceableObject>();
                    list2.Add(placeableObject);
                    while (placeableObject.Next != null)
                    {
                        list2.Add(placeableObject.Next);
                        placeableObjects.Remove(placeableObject.Next);
                        placeableObject = placeableObject.Next;
                    }
                    list.Add(CompoundRoomItem.FromPlaceableObjects(list2));
                }
            }
            PlayerRoomLayout playerRoomLayout = new PlayerRoomLayout();

            playerRoomLayout._compoundRoomItems = list;
            return(playerRoomLayout);
        }
        public static CompoundRoomItem FromPlaceableObjects(List <PlaceableObject> placeableObjects)
        {
            List <RoomItem>  list             = new List <RoomItem>(placeableObjects.Count);
            CompoundRoomItem compoundRoomItem = new CompoundRoomItem();

            foreach (PlaceableObject placeableObject in placeableObjects)
            {
                if (!string.IsNullOrEmpty(placeableObject.FurnitureTemplateID))
                {
                    compoundRoomItem.furnitureTemplateId = placeableObject.FurnitureTemplateID;
                }
                list.Add(RoomItem.FromPlaceableObject(placeableObject));
            }
            compoundRoomItem.roomItems = list;
            return(compoundRoomItem);
        }
 protected bool Equals(CompoundRoomItem other)
 {
     return(object.Equals(_roomItems, other._roomItems));
 }