38 lines
1.0 KiB
C#
38 lines
1.0 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;
|
|||
|
var 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--)
|
|||
|
{
|
|||
|
var time = self.timeList[i];
|
|||
|
if (time <= onlineTime.TotalMinutes)
|
|||
|
return time;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|