/// <summary> /// Equip type to string convertion. /// </summary> /// <returns>The string.</returns> public static string EquipTypeToString(UIEquipmentType type) { string str = "Undefined"; switch (type) { case UIEquipmentType.Head: str = "Head"; break; case UIEquipmentType.Necklace: str = "Necklace"; break; case UIEquipmentType.Shoulders: str = "Shoulders"; break; case UIEquipmentType.Chest: str = "Chest"; break; case UIEquipmentType.Bracers: str = "Bracers"; break; case UIEquipmentType.Gloves: str = "Gloves"; break; case UIEquipmentType.Belt: str = "Belt"; break; case UIEquipmentType.Pants: str = "Pants"; break; case UIEquipmentType.Boots: str = "Boots"; break; case UIEquipmentType.Trinket: str = "Trinket"; break; case UIEquipmentType.Weapon_MainHand: str = "Main Hand"; break; case UIEquipmentType.Weapon_OffHand: str = "Off Hand"; break; } return(str); }
/// <summary> /// Gets a slot within it's children by the specified type. /// </summary> /// <returns>The slot by type.</returns> /// <param name="type">Type.</param> public UIEquipSlot GetSlotByType(UIEquipmentType type) { UIEquipSlot[] slots = this.m_SlotsContainer.GetComponentsInChildren<UIEquipSlot>(); // Find a suitable slot for the given type foreach (UIEquipSlot slot in slots) { if (slot.enabled && slot.gameObject.activeSelf && slot.equipType == type) return slot; } return null; }
/// <summary> /// Gets a slot within it's children by the specified type. /// </summary> /// <returns>The slot by type.</returns> /// <param name="type">Type.</param> public UIEquipSlot GetSlotByType(UIEquipmentType type) { UIEquipSlot[] slots = this.m_SlotsContainer.GetComponentsInChildren <UIEquipSlot>(); // Find a suitable slot for the given type foreach (UIEquipSlot slot in slots) { if (slot.enabled && slot.gameObject.activeSelf && slot.equipType == type) { return(slot); } } return(null); }
public RnMUI_EquipSlot GetSlotByType(UIEquipmentType type) { RnMUI_EquipSlot[] slots = this.GetComponentsInChildren <RnMUI_EquipSlot>(); // Find a suitable slot for the given type foreach (RnMUI_EquipSlot slot in slots) { if (slot.equipType == type) { return(slot); } } return(null); }
/// <summary> /// Gets the first equip slot found with the specified Equipment Type. /// </summary> /// <returns>The slot.</returns> /// <param name="type">The slot Equipment Type.</param> public static UIEquipSlot GetSlotWithType(UIEquipmentType type) { UIEquipSlot[] sl = Resources.FindObjectsOfTypeAll <UIEquipSlot>(); foreach (UIEquipSlot s in sl) { // Check if the slow is active in the hierarchy if (s.gameObject.activeInHierarchy && s.equipType == type) { return(s); } } // Default return(null); }
/* * Creator: Yunzheng Zhou * Gets all the equip slots with the specified Equipment Type. * Parameter: type - UIEquipmentType * Return: a list of slot variables */ public static List <UIEquipSlot> GetSlotsWithType(UIEquipmentType type) { List <UIEquipSlot> slots = new List <UIEquipSlot>(); UIEquipSlot[] sl = Resources.FindObjectsOfTypeAll <UIEquipSlot>(); foreach (UIEquipSlot s in sl) { // Check if the slow is active in the hierarchy if (s.gameObject.activeInHierarchy && s.equipType == type) { slots.Add(s); } } return(slots); }
public override void OnInspectorGUI() { EditorGUIUtility.labelWidth = 120f; EditorGUILayout.Space(); RnMUI_EquipSlot slot = target as RnMUI_EquipSlot; UIEquipmentType eType = (UIEquipmentType)EditorGUILayout.EnumPopup("Equip Type", slot.equipType); if (eType != slot.equipType) { slot.equipType = eType; } DrawTargetSprite(); //DrawDragAndDrop(); DrawBehaviour(); }
public UIItemInfo(string _itemId, string _name, string _iconName, int _equipType, string _itemType, int _damage, int _armor, int _vitality, int _strength, int _dexterity, int _intellect, int _spirit, int _crit) { //id = counter; itemId = _itemId; displayName = _name; icon = Resources.Load<Sprite>("ItemIcons/" + _iconName); equipType = (UIEquipmentType)_equipType; itemType = _itemType; itemClass = "Item"; damage = _damage; armor = _armor; vitality = _vitality; strength = _strength; dexterity = _dexterity; intellect = _intellect; spirit = _spirit; crit = _crit; //counter++; }