Skip to content

Commit

Permalink
[ui] make bag total storage number animate when changed
Browse files Browse the repository at this point in the history
  • Loading branch information
nroutasuo committed Mar 22, 2023
1 parent 8e4810b commit 1df6ad4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/game/constants/UIConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,9 @@ define(['ash',

getBagCapacityDisplayValue: function (bagComponent) {
if (bagComponent.bonusCapacity > 0) {
return bagComponent.baseCapacity + " +" + bagComponent.bonusCapacity;
return bagComponent.totalCapacity + " +" + bagComponent.bonusCapacity;
} else {
return bagComponent.baseCapacity;
return bagComponent.totalCapacity;
}
},

Expand Down
3 changes: 1 addition & 2 deletions src/game/systems/BagSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ define([
let carryCapacity = Math.max(playerBagBonus, ItemConstants.PLAYER_DEFAULT_STORAGE) + followerBagBonus;

playerResources.storageCapacity = carryCapacity;
playerBag.baseCapacity = playerBagBonus;
playerBag.totalCapacity = carryCapacity;
playerBag.bonusCapacity = followerBagBonus;
playerBag.totalCapacity = carryCapacity;

this.updateUsedCapacity(playerBag, playerResources, playerItems);

Expand Down
5 changes: 3 additions & 2 deletions src/game/systems/ui/UIOutHeaderSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,10 @@ define([
!changedInOut
);

var bagComponent = this.playerStatsNodes.head.entity.get(BagComponent);
let bagComponent = this.playerStatsNodes.head.entity.get(BagComponent);
let bagCapacityDisplayValue = UIConstants.getBagCapacityDisplayValue(bagComponent);
$("#header-bag-storage .value").text(Math.floor(bagComponent.usedCapacity * 10) / 10);
$("#header-bag-storage .value-total").text(UIConstants.getBagCapacityDisplayValue(bagComponent));
UIAnimations.animateOrSetNumber($("#header-bag-storage .value-total"), true, bagCapacityDisplayValue);
}
}

Expand Down

0 comments on commit 1df6ad4

Please sign in to comment.