private void ProcessRooms(RoomsType rooms)
    {
        if (rooms == null)
        {
            return;
        }
        foreach (RoomsTypeRoom room in rooms.Room)
        {
            GERoom newRoom = new GERoom(room.id, null, room.imgSrc, null, room.activeAtStart, room.isCheckpoint)
            {
                Properties = ProcessProperties(room.Properties),
                MenuItems  = ProcessMenuItems(room.MenuItems, room.id),
                Items      = ProcessItems(room.Items),
                Npcs       = ProcessNpcs(room.NPCs),
                Texts      = ProcessTexts(room.Texts),
                Neighbours = ProcessNeighbours(room.Neighbours)
            };

            OnReferenceProcessing += delegate(object o, EventArgs e)
            {
                newRoom.NameText = elementManager.GetTextElement(room.nameTextId);
                if (room.descTextId != null)
                {
                    newRoom.DescText = elementManager.GetTextElement(room.descTextId);
                }
                else
                {
                    logger.LogInfo("There was no descTextId given for the Room with id: " + room.id);
                }
            };

            elementManager.AddRoom(newRoom);
        }
    }
Example #2
0
    public static MenuItemBundle CreateBundle(GERoom room, MenuItemBundle parent)
    {
        MenuItemBundle newBundle = new MenuItemBundle(room.NameText.GetText(), parent);

        //Action menuitems
        foreach (GEMenuItem action in room.MenuItems.Values)
        {
            newBundle.AddMenuItem(new MIGameElementAction(action.MenuName.GetText(), newBundle, action));
            action.OnActivationChange += newBundle.RefreshOnEvent;
        }

        //Items menuitem
        newBundle.AddMenuItem(MIOpenList <GEItem> .CreateMIOpenList(LabelUtility.Instance.GetLabel(LabelNames.ITEMS), newBundle, room.Items.Values));

        //NPC menuitem
        newBundle.AddMenuItem(MIOpenList <GENpc> .CreateMIOpenList(LabelUtility.Instance.GetLabel(LabelNames.NPCS), newBundle, room.Npcs.Values));

        //Props menuItem
        List <GEProperty> propsToShow = GEProperty.GetPropertiesWithNames(room.Properties.Values);

        if (propsToShow.Count != 0)
        {
            newBundle.AddMenuItem(new MIShowDescription(LabelUtility.Instance.GetLabel(LabelNames.ROOMPROPS), newBundle, () => GEProperty.GetPropertyDescText(propsToShow)));
        }

        //Back menuitem
        newBundle.AddMenuItem(new MIBack(parent));

        return(newBundle);
    }
 public void LoadRoom(GERoom room)
 {
     baseBundle.SetRoom(room);
     CurrentBundle = baseBundle;
     foreach (MenuItemBundle bundle in usedBundles)
     {
         bundle.DestroyItems();
     }
     usedBundles.Clear();
 }
 public void SetRoom(GERoom room)
 {
     if (roomMenu != null)
     {
         roomMenu.DestroyGO();
     }
     if (gotoMenu != null)
     {
         gotoMenu.DestroyGO();
     }
     roomMenu = new MIOpenBundle <GERoom>(room.NameText.GetText(), room, this);
     gotoMenu = MIOpenList <GENeighbour> .CreateMIOpenList(LabelUtility.Instance.GetLabel(LabelNames.GONEXTROOM), this, room.Neighbours.Values);
 }
Example #5
0
 public void LoadRoom(GERoom room)
 {
     ObjectManager.CurrentGEM.CurrentRoom = room;
     LoadCurrentRoom();
 }
Example #6
0
 public void SetFirstRoom()
 {
     CurrentRoom = rooms[gameProperties.firstRoomId];
 }
Example #7
0
 public void AddRoom(GERoom room)
 {
     AddToDic(rooms, room);
 }