SamsonGame/Assets/Scripts/Game/TimeRewards/TimeRewards.cs

46 lines
1.3 KiB
C#

using System;
using game;
namespace RND
{
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);
Log.Info("TimeRewards: Offline reward initiated.");
}
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);
Log.Info("TimeRewards: Daily reward initiated.");
}
}
}