public void Update() { _bulletsList.RemoveAllChildren(); var capacity = _parent.Bullets.Length; string texturePath; if (capacity <= 20) { texturePath = "/Textures/Interface/ItemStatus/Bullets/normal.png"; } else if (capacity <= 30) { texturePath = "/Textures/Interface/ItemStatus/Bullets/small.png"; } else { texturePath = "/Textures/Interface/ItemStatus/Bullets/tiny.png"; } var texture = StaticIoC.ResC.GetTexture(texturePath); var spentTexture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/empty.png"); FillBulletRow(_bulletsList, texture, spentTexture); }
public void Update() { _chamberedBullet.ModulateSelfOverride = _parent.Chamber.chambered ? _parent.Chamber.spent ? Color.Red : Color.FromHex("#d7df60") : Color.Black; _bulletsListTop.RemoveAllChildren(); _bulletsListBottom.RemoveAllChildren(); if (_parent.MagazineCount == null) { _noMagazineLabel.Visible = true; return; } var(count, capacity) = _parent.MagazineCount.Value; _noMagazineLabel.Visible = false; string texturePath; if (capacity <= 20) { texturePath = "/Textures/Interface/ItemStatus/Bullets/normal.png"; } else if (capacity <= 30) { texturePath = "/Textures/Interface/ItemStatus/Bullets/small.png"; } else { texturePath = "/Textures/Interface/ItemStatus/Bullets/tiny.png"; } var texture = StaticIoC.ResC.GetTexture(texturePath); const int tinyMaxRow = 60; if (capacity > tinyMaxRow) { FillBulletRow(_bulletsListBottom, Math.Min(tinyMaxRow, count), tinyMaxRow, texture); FillBulletRow(_bulletsListTop, Math.Max(0, count - tinyMaxRow), capacity - tinyMaxRow, texture); } else { FillBulletRow(_bulletsListBottom, count, capacity, texture); } }