Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename rate to daily_rate #480

Merged
merged 8 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/Assets/Scripts/AfkRewards/AfkRewardRate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ public class AfkRewardRate
{
public string kalineTreeLevelId;
public string currency;
public float rate;
public float daily_rate;
}
19 changes: 10 additions & 9 deletions client/Assets/Scripts/AfkRewards/KalineTreeManager.cs
tkz00 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class KalineTreeManager : MonoBehaviour
[SerializeField] GameObject insufficientCurrencyPopup;
[SerializeField] GameObject afkRewardDetailUI;
[SerializeField] GameObject afkRewardsContainer;
private const int SECONDS_IN_DAY = 86400;

private const int MINUTES_IN_DAY = 1440;

void Start()
{
Expand All @@ -37,11 +38,11 @@ public void ShowRewards()
Destroy(child.gameObject);
}

foreach (var afkReward in afkRewards.Where(reward => user.User.kalineTreeLevel.afkRewardRates.Any(rewardRate => rewardRate.rate > 0 && rewardRate.currency == reward.currency)))
foreach (var afkReward in afkRewards.Where(reward => user.User.kalineTreeLevel.afkRewardRates.Any(rewardRate => rewardRate.daily_rate > 0 && rewardRate.currency == reward.currency)))
{
GameObject afkRewardGO = Instantiate(afkRewardDetailUI, afkRewardsContainer.transform);
AfkRewardDetail afkRewardDetail = afkRewardGO.GetComponent<AfkRewardDetail>();
afkRewardDetail.SetData(GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == afkReward.currency).image, $"{afkReward.amount} ({user.User.kalineTreeLevel.afkRewardRates.Single(arr => arr.currency == afkReward.currency).rate * 60}/m)");
afkRewardDetail.SetData(GlobalUserData.Instance.AvailableCurrencies.Single(currency => currency.name == afkReward.currency).image, $"{afkReward.amount} ({user.User.kalineTreeLevel.afkRewardRates.Single(arr => arr.currency == afkReward.currency).daily_rate / (MINUTES_IN_DAY)}/m)");
}

confirmPopUp.SetActive(true);
Expand Down Expand Up @@ -115,23 +116,23 @@ private void SetAfkRewardRatesTexts(User user)
switch (afkRewardRate.currency)
{
case "Gold":
goldAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.rate);
goldAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.daily_rate);
break;
case "Hero Souls":
heroSoulsAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.rate);
heroSoulsAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.daily_rate);
break;
case "Experience":
experienceAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.rate);
experienceAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.daily_rate);
break;
case "Arcane Crystals":
arcaneCrystalsAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.rate);
arcaneCrystalsAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.daily_rate);
break;
}
}
}

private string GetAfkRewardRateText(float rate)
private string GetAfkRewardRateText(float daily_rate)
{
return $"{rate * SECONDS_IN_DAY}/day";
return $"{daily_rate}/day";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private AfkRewardRate CreateAfkRewardRateFromData(Protobuf.Messages.AfkRewardRat
{
kalineTreeLevelId = afkRewardRateData.KalineTreeLevelId,
currency = afkRewardRateData.Currency.Name,
rate = afkRewardRateData.Rate
daily_rate = afkRewardRateData.DailyRate
};
}

Expand Down
2 changes: 1 addition & 1 deletion client/Assets/Scripts/Campaign/LevelData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class LevelData

public Dictionary<string, int> rewards = new Dictionary<string, int>();

// AFK Rewards rate granted
// AFK Rewards daily_rate granted
// These are how many a player makes in the maximum timespan available (12h now)
public Dictionary<Currency, int> afkCurrencyRate = new Dictionary<Currency, int>();

Expand Down
7 changes: 3 additions & 4 deletions client/Assets/Scripts/Dungeon/DungeonSettlementManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class DungeonSettlementManager : MonoBehaviour
[SerializeField] GameObject confirmPopUp;
[SerializeField] GameObject insufficientCurrencyPopup;
[SerializeField] GameObject levelUpButton;
private const int SECONDS_IN_DAY = 86400;

void Start()
{
Expand Down Expand Up @@ -76,7 +75,7 @@ private void SetAfkRewardRatesTexts(User user)
{
if (afkRewardRate.currency == "Supplies")
{
suppliesAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.rate);
suppliesAfkRewardRate.text = GetAfkRewardRateText(afkRewardRate.daily_rate);
}
else
{
Expand All @@ -85,8 +84,8 @@ private void SetAfkRewardRatesTexts(User user)
}
}

private string GetAfkRewardRateText(float rate)
private string GetAfkRewardRateText(float daily_rate)
{
return $"{rate * SECONDS_IN_DAY}/day";
return $"{daily_rate}/day";
}
}
Loading
Loading