protected void DisplaySelectionView(int slotIndex) { int offset = currentPage * itemsPerPage; if (slotIndex == 0) { // display weapon selections int itemsToDisplay = Mathf.Min(playerStock.weaponStock.Count - currentPage * itemsPerPage, itemsPerPage); selectionViews.ClearViewGroup(); for (int i = 0; i < itemsToDisplay; ++i) { UIInventoryState.DisplayWeapon(selectionViews.views[i], playerStock.weaponStock[offset + i]); } } else { // display wearable selections int itemsToDisplay = Mathf.Min(playerStock.wearableStock.Count - currentPage * itemsPerPage, itemsPerPage); selectionViews.ClearViewGroup(); for (int i = 0; i < itemsToDisplay; ++i) { UIInventoryState.DisplayWearable(selectionViews.views[i], playerStock.wearableStock[offset + i]); } } }
protected void DisplayPlayerSlot() { slotViews.ClearViewGroup(); // There is always a weapon at slot 0 List <ItemData.WeaponRuntimeData> weapons = playerStock.weaponStock; int currentWeapon = playerSlot.weaponIndex; ItemData.WeaponRuntimeData weaponData = weapons[currentWeapon]; UIInventoryState.DisplayWeapon(slotViews.views[0], weaponData); // slot one List <ItemData.WearableRuntimeData> wearables = playerStock.wearableStock; int currentWearableOne = playerSlot.wearableOneIndex; int currentWearableTwo = playerSlot.wearableTwoIndex; if (playerSlot.IsWearableInUse(playerStock, currentWearableOne)) { UIInventoryState.DisplayWearable(slotViews.views[1], wearables[currentWearableOne]); } else { slotViews.views[1].image.gameObject.SetActive(true); slotViews.views[1].image.sprite = UIIconLoader.EmptySprite; } if (playerSlot.IsWearableInUse(playerStock, currentWearableTwo)) { UIInventoryState.DisplayWearable(slotViews.views[2], wearables[currentWearableTwo]); } else { slotViews.views[2].image.gameObject.SetActive(true); slotViews.views[2].image.sprite = UIIconLoader.EmptySprite; } // Debug.Log("weapon: " + weapons[currentWeapon].weapon.ToString()); // Debug.Log("slot one: " + wearables[currentWearableOne].wearable.ToString()); // Debug.Log("slot two: " + wearables[currentWearableTwo].wearable.ToString()); // slot two }