public static bool ItemTypeIsEquipped(this vItemManager itemManager, vItemType type) { if (itemManager.inventory) { return(System.Array.Find(itemManager.inventory.equipAreas, equipArea => equipArea.currentEquippedItem && equipArea.currentEquippedItem.type.Equals(type))); } return(false); }
public static bool ItemTypeIsEquipped(this vItemManager itemManager, vItemType type, out EquipedItemInfo equipedItemInfo) { equipedItemInfo = null; if (itemManager.inventory) { var area = System.Array.Find(itemManager.inventory.equipAreas, equipArea => equipArea.currentEquippedItem && equipArea.currentEquippedItem.type.Equals(type)); if (area) { equipedItemInfo = new EquipedItemInfo(area.currentEquippedItem, area); equipedItemInfo.indexOfArea = System.Array.IndexOf(itemManager.inventory.equipAreas, area); equipedItemInfo.indexOfItem = itemManager.items.IndexOf(area.currentEquippedItem); } return(area != null); } return(false); }
public static void CreateWindow() { if (instance == null) { var window = vItemEnumsWindow.GetWindow <vItemEnumsWindow>("Item Enums", true); instance = window; window.skin = Resources.Load("vSkin") as GUISkin; #region Get all vItemType values of current Enum try { window._itemTypeNames = Enum.GetNames(typeof(vItemType)).vToList(); for (int i = 0; i < window._itemTypeNames.Count; i++) { vItemType att = (vItemType)Enum.Parse(typeof(vItemType), (window._itemTypeNames[i])); window._itemTypeEnumFormats.Add(att.DisplayFormat()); } } catch { } #endregion #region Get all vItemAttributes values of current Enum try { window._itemAttributeNames = Enum.GetNames(typeof(vItemAttributes)).vToList(); for (int i = 0; i < window._itemAttributeNames.Count; i++) { vItemAttributes att = (vItemAttributes)Enum.Parse(typeof(vItemAttributes), (window._itemAttributeNames[i])); window._itemAttributesEnumFormats.Add(att.DisplayFormat()); } } catch { } #endregion window.datas = Resources.LoadAll <vItemEnumsList>(""); for (int i = 0; i < window.datas.Length; i++) { window.itemEnumEditorList.Add(DynamicEnum.vItemEnumsListEditor.CreateEditor(window.datas[i]) as DynamicEnum.vItemEnumsListEditor); } window.minSize = new Vector2(460, 600); } }
bool ItemTypesContainsDescription(string enumName, string description) { vItemType e = enumName.ToEnum <vItemType>(); return(e.DisplayFormat().Equals(description)); }