Skip to content

Commit

Permalink
GiveAmmo window fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Макс Дороболюк committed Aug 1, 2024
1 parent e09d792 commit f06ef8e
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace CombatExtended
{
public class Window_GiveAmmoAmountSlider : Window
{
public int ammoToGiveAmount = 1;
public float ammoToGiveAmount = 1;

public CompAmmoGiver sourceComp;

Expand All @@ -35,9 +35,7 @@ public override Vector2 InitialSize
}
public override void DoWindowContents(Rect inRect)
{
Widgets.Label(inRect.TopHalf().TopHalf(), "CE_AmmoAmount".Translate() + " " + ammoToGiveAmount.ToString());
//TODO: 1.5
ammoToGiveAmount = 1; // (int)Widgets.HorizontalSlider_NewTemp(inRect.TopHalf().BottomHalf(), ammoToGiveAmount, 0, maxAmmoCount);
Widgets.HorizontalSlider(inRect.TopHalf().BottomHalf(), ref ammoToGiveAmount, new FloatRange(0, maxAmmoCount), "CE_AmmoAmount".Translate() + " " + ammoToGiveAmount.ToString(), 1);

if (Widgets.ButtonText(inRect.BottomHalf().LeftHalf(), "Cancel".Translate()))
{
Expand All @@ -55,7 +53,7 @@ public override void Close(bool doCloseSound = true)
{
if (finalized)
{
sourceComp.GiveAmmo(selPawn, sourceAmmo, this.ammoToGiveAmount);
sourceComp.GiveAmmo(selPawn, sourceAmmo, (int)this.ammoToGiveAmount);
}

base.Close(doCloseSound);
Expand Down

0 comments on commit f06ef8e

Please sign in to comment.