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 static MenuItemBundle CreateBundle(GEItem item, MenuItemBundle parent) { MenuItemBundle newBundle = new MenuItemBundle(item.ItemName.GetText(), parent); if (item.Equipable && !item.IsEquipped) { newBundle.AddMenuItem(new MIEquip(item, newBundle)); } foreach (GEMenuItem action in item.MenuItems.Values) { newBundle.AddMenuItem(new MIGameElementAction(action.MenuName.GetText(), newBundle, action)); action.OnActivationChange += newBundle.RefreshOnEvent; } //Props menuItem List <GEProperty> propsToShow = GEProperty.GetPropertiesWithNames(item.Properties.Values); if (propsToShow.Count != 0) { newBundle.AddMenuItem(new MIShowDescription(LabelUtility.Instance.GetLabel(LabelNames.ITEMPROPS), newBundle, () => GEProperty.GetPropertyDescText(propsToShow))); } newBundle.AddMenuItem(new MIBack(parent)); Description.GetInstance().AddDescriptionText(item.Description.GetText()); return(newBundle); }
//Creates the menuitem set that is shown for an NPC public static MenuItemBundle CreateBundle(GENpc npc, MenuItemBundle parent) { MenuItemBundle newBundle = new MenuItemBundle(npc.NameText.GetText(), parent); foreach (GEMenuItem action in npc.MenuItems.Values) { newBundle.AddMenuItem(new MIGameElementAction(action.MenuName.GetText(), newBundle, action)); action.OnActivationChange += newBundle.RefreshOnEvent; } //Props menuItem List <GEProperty> propsToShow = GEProperty.GetPropertiesWithNames(npc.Properties.Values); if (propsToShow.Count != 0) { newBundle.AddMenuItem(new MIShowDescription(LabelUtility.Instance.GetLabel(LabelNames.NPCPROPS), newBundle, () => GEProperty.GetPropertyDescText(propsToShow))); } //newBundle.AddMenuItem(new MIShowDescription(LabelUtility.Instance.GetLabel(LabelNames.SHOWDESCRUPTION), newBundle, npc.DescText.GetText())); //FIXME: this runs only once, when the bundle is created. Feature or bug? We might not want it to see more thane once tho... Description.GetInstance().AddDescriptionText(npc.DescText.GetText()); newBundle.AddMenuItem(new MIConversation(LabelUtility.Instance.GetLabel(LabelNames.STARTCONVERSATION), parent, npc)); newBundle.AddMenuItem(new MIBack(parent)); return(newBundle); }
public void Execute(GameElementManager elementManager) { GEProperty property = elementManager.GetProperty(refId); if (property == null) { ObjectManager.Logger.LogWarn("There is no property element with the given id, however an action is reffering it! The given id: " + refId); } switch (changeType) { case PropertyChangeType.SET: { property.Value = this.value; break; } case PropertyChangeType.INC: { property.Value += this.value; break; } case PropertyChangeType.DEC: { property.Value -= this.value; break; } } }
public BaseMenuItemBundle() : base(LabelUtility.Instance.GetLabel(LabelNames.MENU), null) { inventoryMenu = MIOpenList <GEItem> .CreateMIOpenList(LabelUtility.Instance.GetLabel(LabelNames.INVENTORY), this, ObjectManager.CurrentGEM.Player.Items.Values); List <GEProperty> propsToShow = GEProperty.GetPropertiesWithNames(ObjectManager.CurrentGEM.Player.Properties.Values); if (propsToShow.Count != 0) { propertiesMenu = new MIShowDescription(LabelUtility.Instance.GetLabel(LabelNames.PLAYERPROPS), this, () => GEProperty.GetPropertyDescText(propsToShow)); } }
public bool Check() { GEProperty propertyToCheck = elementManager.GetProperty(refId); if (propertyToCheck == null) { System.Console.WriteLine("There is no property element with the given id! " + refId); return(false); } switch (conditionType) { case PropertyConditionType.EQ: return(propertyToCheck.Value == valueToCheck); case PropertyConditionType.LT: return(propertyToCheck.Value < valueToCheck); case PropertyConditionType.GT: return(propertyToCheck.Value > valueToCheck); default: return(false); } }
private SortedList <string, GEProperty> ProcessProperties(PropertiesType properties) { SortedList <string, GEProperty> processedProperties = new SortedList <string, GEProperty>(); if (properties == null) { return(processedProperties); } foreach (PropertiesTypeProperty property in properties.Property) { GEProperty newProperty = new GEProperty(property.id, null, property.defValue, property.minValue, property.maxValue); OnReferenceProcessing += delegate(object o, EventArgs e) { newProperty.Name = elementManager.GetTextElement(property.nameTextId); }; elementManager.AddProperty(newProperty); processedProperties.Add(property.id, newProperty); } return(processedProperties); }
public void AddProperty(GEProperty property) { AddToDic(properties, property); }