/** Update Ammo Grid ( grids[1] ) depending on the selection sent from the event * from StashController. */ void updateAmmoGrid(GunUIObject selection, int index) { if (index == -1) { for (int i = 0; i < 3; i++) { AmmoUIObject ammo = (AmmoUIObject)grids[1].itemArray[i]; ammo.ammo = selection.gunObj.compatibleAmmo[i]; ammo.mWidget.spriteName = selection.gunObj.compatibleAmmo[i].spriteName; // If ammo grid is already active, and the current ammo is displayed, update Description if (grids[1].isActive && grids[1].curPos == i) { onSelection(ammo); } } } else { if (grids[1].isActive) { moveGridTo(index, MainMenuController.instance.menuState); } } }
/// <summary> /// Gets the alpha value for DB items. /// </summary> /// <returns> /// The alpha value. /// </returns> /// <param name='item'> /// Item. /// </param> float getAlphaValue(SuppliesUIObject item) { Type g = typeof(GunUIObject); Type h = typeof(HealthUIObject); Type a = typeof(AmmoUIObject); Type t = item.GetType(); if (t == g) { GunUIObject temp = (GunUIObject)item; if (temp.itemLocale == SuppliesUIObject._ItemLocale.StoreGridItem) { return((temp.gunObj.isPurchased) ? 0.5f : 1f); } } if (t == h) { HealthUIObject temp = (HealthUIObject)item; if (temp.itemLocale == SuppliesUIObject._ItemLocale.StashGridItem) { return((temp.hPack.quantity > 0) ? 1f : 0.5f); } } if (t == a) { AmmoUIObject temp = (AmmoUIObject)item; int index = itemArray.IndexOf(temp); if (temp.itemLocale == SuppliesUIObject._ItemLocale.StoreGridItem) { if (index < 2) { return(1f); } else { return((temp.ammo.isPurchased) ? 0.5f : 1f); } } return((temp.ammo.isPurchased) ? 1f : 0.5f); } return(1f); }