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

38 lines
1.1 KiB
C#

using Cal.DataTable;
using System;
using System.Collections.Generic;
namespace ET
{
public class OnlineRewardComponentAwakeSystem : AwakeSystem<OnlineRewardComponent>
{
public override void Awake(OnlineRewardComponent self)
{
self.Awake();
}
}
public static class OnlineRewardComponentSystem
{
public static void Awake(this OnlineRewardComponent self)
{
OnlineRewardComponent.instance = self;
IEnumerable<OnlineRewardBase> list = DataTableHelper.GetAll<OnlineRewardBase>();
foreach (OnlineRewardBase item in list)
{
self.timeList.Add((int)item.Id);
}
self.timeList.Sort();
}
public static int GetRewardTime(this OnlineRewardComponent self,TimeSpan onlineTime)
{
for (int i = self.timeList.Count - 1; i >= 0; i--)
{
int time = self.timeList[i];
if (time <= onlineTime.TotalMinutes)
return time;
}
return 0;
}
}
}