hellbound/Assets/Scripts/Game/TimeRewards/TimeRewards.cs

41 lines
1.1 KiB
C#

using System;
using game;
public class TimeRewards
{
public ITimeReward Offline { get; private set; } = new NullTimeReward();
public ITimeReward Daily { get; private set; } = new NullTimeReward();
public void Init()
{
InitOfflineReward();
InitDailyReward();
}
private void InitOfflineReward()
{
if (Settings.OFFLINE_REWARD_ENABLE == false)
return;
var offlineConf = G.Instance.Configs.Get<ConfOfflineReward>("@time_rewards/offline_reward");
if (offlineConf == null)
throw new NullReferenceException("Not found config for offline reward.");
Offline = new OfflineReward(offlineConf);
}
private void InitDailyReward()
{
if (Settings.DAILY_REWARD_ENABLE == false)
return;
var dailyConf = G.Instance.Configs.Get<ConfDailyReward>("@time_rewards/daily_reward");
if (dailyConf == null)
throw new NullReferenceException("Not found config for offline reward.");
Daily = new DailyReward(dailyConf);
}
}