Merge branch 'dev' of https://github.com/Regalis11/Barotrauma.git into unstable-tests

This commit is contained in:
Evil Factory
2022-04-11 15:58:36 -03:00
38 changed files with 361 additions and 184 deletions
@@ -151,8 +151,13 @@ namespace Barotrauma
loadingTextures = true;
loading = true;
TaskPool.Add("LoadTextureAsync",
LoadTextureAsync(), (Task) =>
LoadTextureAsync(), task =>
{
if (task.Exception != null)
{
var innerMost = task.Exception.GetInnermost();
DebugConsole.ThrowError($"Failed to load \"{Sprite.FilePath}\"", innerMost);
}
loading = false;
lazyLoaded = true;
RectTransform.SizeChanged += RecalculateScale;
@@ -232,7 +237,7 @@ namespace Barotrauma
{
wait = activeTextureLoads.Contains(Sprite.FullPath);
}
}
}
}
try
{
@@ -981,17 +981,19 @@ namespace Barotrauma
BarSize = 0.1f,
OnMoved = (bar, scroll) =>
{
SetRewardText((int)(scroll * 100), rewardBlock);
int rewardDistribution = RoundRewardDistribution(scroll, bar.Step);
SetRewardText(rewardDistribution, rewardBlock);
return true;
},
OnReleased = (bar, scroll) =>
{
int newRewardDistribution = (int)(scroll * 100);
int newRewardDistribution = RoundRewardDistribution(scroll, bar.Step);
if (newRewardDistribution == targetWallet.RewardDistribution) { return false; }
SetRewardDistribution(character, newRewardDistribution);
return true;
}
};
int RoundRewardDistribution(float scroll, float step) => (int)MathUtils.RoundTowardsClosest(scroll * 100, step * 100);
SetRewardText(targetWallet.RewardDistribution, rewardBlock);