Daily Bonus¶
In many video games, a daily bonus is a reward that a player can receive for logging in to the game daily. The reward can take many forms, such as in-game currency, items, or special perks. The purpose of the daily bonus is to encourage players to log in to the game regularly and keep playing. Some games may offer a different daily bonus each day to keep things interesting for players.
- Open the Daily Bonus section.
- Add at least one Daily Bonus document. You can have multiple Daily Bonuses for different segments of your players for testing, or you can change them during the players' progress in your game.
- You can create multiple Daily Bonus documents, but since only one of them can be active, make sure the Conditions of those Daily Bonuses do not intersect. For example you might want to use one Daily Bonus calendar for players between 1-10 levels, and a completely another one for the 11-20 levels.
Daily Bonus parameters¶
Parameter | Description |
---|---|
Name | The name of the bonus it's used for your convenience only. |
Condition | You can set up specific conditions for Daily Bonus to activate. For example, you can launch Daily Bonus only after the tutorial. |
Type | Determines how Daily Bonus resets. CollectAllToReset - resets when you collect all the rewards, SkipToReset - resets when you collect all the rewards or skip a day, CalendarReset - resets only when the new month starts. |
Rewards | The list of all the daily rewards. Each daily reward can contain multiple items. |
Bonus Reward | It's mostly used with CalendarReset type of bonuses. Players will get the Bonus Reward every day when all the rewards are collected until the new month starts. |
Section for programmers¶
-
Use the following methods to work with Daily Bonus
//Returns the list of all the rewards with statuses Balancy.LiveOps.DailyBonus.GetAllRewards(); //Returns the next Reward Balancy.LiveOps.DailyBonus.GetNextReward(); //Returns the next Reward number, starting from 1 Balancy.LiveOps.DailyBonus.GetNextRewardNumber(); //Returns true if you can claim the next reward Balancy.LiveOps.DailyBonus.CanClaimNextReward(); //Returns the number of seconds till the next reward. 0 - the reward is already available, -1 - something went wrong with the dates. Balancy.LiveOps.DailyBonus.GetSecondsTillTheNextReward(); //Claims the next available reward and returns its value Balancy.LiveOps.DailyBonus.ClaimNextReward(); //Returns true if the next reward is the Bonus Reward Balancy.LiveOps.DailyBonus.IsNextRewardBonus();
-
You can also subscribe the listener for LiveOps DailyBonus to receive events when the next Daily Bonus is available. It'll be triggered when you start the game or if the day will change during the session.
using Balancy.Interfaces; using Balancy.Models.SmartObjects; using UnityEngine; namespace Balancy { //TOTO make your own version of this file, because the original file will be overwritten after Balancy update public class LiveOpsEventsExample : ILiveOpsEvents { public void OnDailyRewardAvailable(Reward reward, int dayNumber) { Debug.Log("=> OnDailyRewardAvailable: " + dayNumber); } } }
Subscribe an instance of your class to the LiveOps events:
ExternalEvents.RegisterLiveOpsListener(new LiveOpsEventsExample());