Skip to content

Commit

Permalink
Merge pull request #3325 from CombatExtended-Continued/GiveAmmo_Window
Browse files Browse the repository at this point in the history
GiveAmmo window fix
  • Loading branch information
N7Huntsman authored Aug 6, 2024
2 parents 7543361 + f06ef8e commit 56513a3
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 56513a3

Please sign in to comment.