updated insta-reload single clip weapon labels to display in format of "xxx" instead of "xxx-xxx" (#133)

This commit is contained in:
Aleksejs Sergejevs 2022-07-15 20:37:33 +03:00 committed by GitHub
parent 6f0605f839
commit 549922f7b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -206,7 +206,16 @@ namespace SanAndreasUnity.UI {
this.weaponImage.texture = weaponTextureToDisplay;
this.weaponAmmoText.enabled = true;
string ammoText = weapon != null ? weapon.AmmoOutsideOfClip + "-" + weapon.AmmoInClip : string.Empty;
string ammoText = string.Empty;
if (weapon != null)
{
if (weapon.ReloadTime == 0f && weapon.AmmoClipSize == 1)
ammoText = weapon.TotalAmmo.ToString();
else
ammoText = $"{weapon.AmmoOutsideOfClip}-{weapon.AmmoInClip}";
}
if (this.weaponAmmoText.text != ammoText)
this.weaponAmmoText.text = ammoText;