public InventoryGroupDetailUI() { InitializeComponent(); lOperation = GlobalVariables.Operation.Add; loInventoryGroup = new InventoryGroup(); }
protected virtual void SelectWeaponByMouseWheel() { if (UInput.GetAxisRaw(INC.MOUSE_WHEEL) == 0 || (switchWeaponAnimation != null || hideWeaponAnimation != null)) { return; } int sign = UInput.GetAxisRaw(INC.MOUSE_WHEEL) > 0 ? 1 : -1; int weaponIndex = 0; int weaponGroup = 0; if (currentWeaponKey != KeyCode.None && cacheKeyToID.ContainsKey(currentWeaponKey)) { string currentGroup = cacheKeyToID[currentWeaponKey].GetGroup(); if (!cacheGroupToSlots.ContainsKey(currentGroup)) { return; } List <InventorySlot> slots = cacheGroupToSlots[currentGroup]; for (int i = 0, length = groups.Count; i < length; i++) { InventoryGroup group = groups[i]; if (group.GetName() == currentGroup) { weaponGroup = i; slots = group.GetInventorySlots(); break; } } if (slots != null) { int s_length = slots.Count; for (int i = 0; i < s_length; i++) { InventorySlot slot = slots[i]; if (slot.GetKey() == currentWeaponKey) { weaponIndex = i; } } if (sign == 1) { if (weaponIndex - 1 >= 0) { KeyCode acivateKey = slots[weaponIndex - 1].GetKey(); if (acivateKey != currentWeaponKey) { ActivateWeapon(acivateKey); } return; } else if (weaponIndex - 1 < 0 && groups.Count == 1) { KeyCode acivateKey = slots[slots.Count - 1].GetKey(); if (acivateKey != currentWeaponKey) { ActivateWeapon(acivateKey); } return; } else if (weaponIndex - 1 < 0 && weaponGroup - 1 < 0) { List <InventorySlot> _slots = groups[groups.Count - 1].GetInventorySlots(); for (int i = 0, length = _slots.Count; i < length; i++) { InventorySlot slot = _slots[i]; if (slot.GetWeapon() != null) { ActivateWeapon(slot.GetKey()); return; } } } else if (weaponIndex - 1 < 0 && weaponGroup - 1 >= 0) { List <InventorySlot> _slots = groups[weaponGroup - 1].GetInventorySlots(); for (int i = 0, length = _slots.Count; i < length; i++) { InventorySlot slot = _slots[i]; if (slot.GetWeapon() != null) { ActivateWeapon(slot.GetKey()); return; } } } } else if (sign == -1) { if (weaponIndex + 1 <= slots.Count - 1) { KeyCode acivateKey = slots[weaponIndex + 1].GetKey(); if (acivateKey != currentWeaponKey) { ActivateWeapon(acivateKey); } return; } else if (weaponIndex + 1 > (slots.Count - 1) && groups.Count == 1) { KeyCode acivateKey = slots[0].GetKey(); if (acivateKey != currentWeaponKey) { ActivateWeapon(acivateKey); } return; } else if (weaponIndex + 1 > (slots.Count - 1) && weaponGroup + 1 < (groups.Count - 1)) { List <InventorySlot> _slots = groups[0].GetInventorySlots(); for (int i = 0, length = _slots.Count; i < length; i++) { InventorySlot slot = _slots[i]; if (slot.GetWeapon() != null) { ActivateWeapon(slot.GetKey()); return; } } } else if (weaponIndex + 1 > (slots.Count - 1) && weaponGroup + 1 <= (groups.Count - 1)) { List <InventorySlot> _slots = groups[weaponGroup + 1].GetInventorySlots(); for (int i = 0, length = _slots.Count; i < length; i++) { InventorySlot slot = _slots[i]; if (slot.GetWeapon() != null) { ActivateWeapon(slot.GetKey()); return; } } } } } } else if (currentWeaponKey == KeyCode.None) { List <InventorySlot> _slots = groups[0].GetInventorySlots(); for (int i = 0, _s_length = _slots.Count; i < _s_length; i++) { InventorySlot _slot = _slots[i]; if (_slot.GetWeapon() != null) { ActivateWeapon(_slot.GetKey()); break; } } } }
public void AddItem(InventoryGroup group) { Debug.Log(GameManagerScript.inventory[0].InventoryItem); inventoryGroup = group; amountText.text = group.Amount.ToString(); itemName.text = group.InventoryItem.ToString().Replace('_', ' '); bool isDepleted = false; if (group.Amount <= 0) { isDepleted = true; } foreach (Transform child in transform) { if (child.name == "ItemButton") { foreach (Transform grandChild in child) { if (grandChild.name == "Icon") { if (isDepleted) { grandChild.GetComponentInChildren <Image>().sprite = group.icon; grandChild.GetComponentInChildren <Image>().enabled = false; } else { grandChild.GetComponentInChildren <Image>().sprite = group.icon; grandChild.GetComponentInChildren <Image>().enabled = true; } } } } else if (child.name == "ItemName") { if (isDepleted) { child.GetComponent <Text>().text = ""; } } else if (child.name == "AmountText") { if (isDepleted) { child.GetComponent <Text>().text = ""; } } } // switch (item) // { // Thirst_Berry: // icon = sprite.none; // break; // default: // icon = sprite.none; // break; // } // icon.sprite = item.icon; // icon.enabled = true; }
public CustomerInventoryGroup GetCustomerInventoryGroupByKeyAndInventoryGroup(long key, InventoryGroup inventoryGroup) { var result = (from customer in CustomersInventoryGroup() where customer.CustomerNumber == key && customer.InventoryGroupId == inventoryGroup.InventoryGroupId select customer).FirstOrDefault(); return(result ?? new CustomerInventoryGroup()); }
public string updateInventoryGroup([FromBody] InventoryGroup pInventoryGroup) { return(loInventoryGroup.updateInventoryGroup(pInventoryGroup)); }
public string insertInventoryGroup([FromBody] InventoryGroup pInventoryGroup) { return(loInventoryGroup.insertInventoryGroup(pInventoryGroup)); }
public static InventoryGroup CreateInventoryGroup(int inventoryGroupID) { InventoryGroup inventoryGroup = new InventoryGroup(); inventoryGroup.InventoryGroupID = inventoryGroupID; return inventoryGroup; }
public void AddToInventoryGroup(InventoryGroup inventoryGroup) { base.AddObject("InventoryGroup", inventoryGroup); }