CTT/Server/Hotfix/Game/System/Other/ActiveComponentSystem.cs

42 lines
1.3 KiB
C#
Raw Normal View History

2021-05-17 00:19:52 +08:00
using System;
using Cal.DataTable;
namespace ET
2021-05-05 13:36:19 +08:00
{
2021-05-17 00:19:52 +08:00
public class ActiveComponentAwakeSystem: AwakeSystem<ActiveComponent>
2021-05-05 13:36:19 +08:00
{
public override void Awake(ActiveComponent self)
{
ActiveComponent.instance = self;
}
}
public static class ActiveComponentSystem
{
2021-05-17 00:19:52 +08:00
public static bool GetSigninReward(this ActiveComponent self, long id, out SignInRewardConfig config)
{
if (!self.SignInRewardDic.TryGetValue(id, out int currId))
{
self.SignInRewardDic[id] = currId = DateTime.UtcNow.DayOfYear;
config = SignInRewardConfigCategory.Instance.GetByDay(currId);
return false;
}
config = SignInRewardConfigCategory.Instance.GetByDay(currId);
return true;
}
public static bool GetOnLineReward(this ActiveComponent self, long id, out OnlineRewardBase config)
{
if (!self.SignInRewardDic.TryGetValue(id, out int currId))
{
self.SignInRewardDic[id] = currId = DateTime.UtcNow.DayOfYear;
config = OnlineRewardBaseCategory.Instance.Get(currId);
return false;
}
config = OnlineRewardBaseCategory.Instance.Get(currId);
return true;
}
2021-05-05 13:36:19 +08:00
}
}