You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.8 KiB
104 lines
3.8 KiB
using System;
|
|
using System.Linq;
|
|
using ProtoCSStruct;
|
|
using Sog;
|
|
|
|
namespace Rank
|
|
{
|
|
/// <summary>
|
|
/// 活动排行榜
|
|
/// </summary>
|
|
public class ActRank
|
|
{
|
|
public static void InitActRank(int rem, int actId)
|
|
{
|
|
var actDesc = ActivityDescMgr.Instance.GetConfig(actId);
|
|
if (actDesc == null)
|
|
{
|
|
TraceLog.Error("ActRank.InitActRank get PandoraActivityDesc is null! id;{0}", actId);
|
|
return;
|
|
}
|
|
RankServerData serverData = RankServerUtils.GetRankServerData();
|
|
var remOne = serverData.m_configRealm[rem];
|
|
|
|
ActRemRank remRank = null;
|
|
serverData.m_ActRank.TryGetValue(rem, out remRank);
|
|
if (remRank == null)
|
|
{
|
|
return;
|
|
}
|
|
var actRankOne = new ActRankOne();
|
|
actRankOne.RealmId = rem;
|
|
actRankOne.ActRankID = actId;
|
|
actRankOne.BeginTime = remOne.openTime;
|
|
actRankOne.EndTime = remOne.openTime + actDesc.duration * AppTime.SECONDS_ADAY;
|
|
|
|
remRank.m_AcRank.TryAdd(actId, actRankOne);
|
|
actRankOne.MakeDirty();
|
|
}
|
|
|
|
// public static void LoadActRank()
|
|
// {
|
|
// RankServerData serverData = RankServerUtils.GetRankServerData();
|
|
// var actDescs = ActivityDescMgr.Instance.ItemTable.Values.Where(one => one.type == (int)ActivityPandoraType.ActTypeOpenerverRank).DefaultIfEmpty().ToList();
|
|
// if (actDescs.Count <= 0)
|
|
// {
|
|
// TraceLog.Trace("ActRank.LoadActRank is null act Rank!");
|
|
// return;
|
|
// }
|
|
// //判断时间是否符合
|
|
//
|
|
// foreach (var rem in serverData.m_configRealm.Values)
|
|
// {
|
|
// foreach (var desc in actDescs)
|
|
// {
|
|
// if (desc == null) continue;
|
|
// //有的时候检查活动和排行榜次数
|
|
// if (OverTimeRank(rem, desc)) continue;
|
|
//
|
|
// //没有 Load actRank
|
|
// ActRemRank actRem = null;
|
|
// serverData.m_ActRank.TryGetValue(rem.realmId, out actRem);
|
|
// if (actRem != null)
|
|
// {
|
|
// //存在就不需要再加载了
|
|
// if (actRem.m_AcRank.ContainsKey(desc.id)) continue;
|
|
// }
|
|
//
|
|
// //加载这个排行版
|
|
// var req = new SSQueryActRankDbReq();
|
|
// req.ActRankId = desc.id;
|
|
// req.RealmId = rem.realmId;
|
|
// uint dbServerID = GameDBServerIDUtils.GetGameDBServerID(1);
|
|
// RankServerUtils.GetPacketSender().SendToServerByID(dbServerID, (int)SSGameMsgID.QueryActRankDbReq, ref req, 0);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
//过期超过一天就不加载
|
|
// public static bool OverTimeRank(RealmBriefInfo reml, ActivityDesc activityDesc)
|
|
// {
|
|
// var nowTime = RankServerUtils.GetTimeSecond();
|
|
// var openFlAG = false;
|
|
// switch (activityDesc.timeType)
|
|
// {
|
|
// //开服时间
|
|
// //EnumActivityPandoraTimeType
|
|
// case 2:
|
|
// {
|
|
// if (nowTime < reml.openTime) return true;
|
|
//
|
|
// if (AppTime.GetDayElapse(nowTime, reml.openTime) > activityDesc.duration)
|
|
// {
|
|
// openFlAG = false;
|
|
// }
|
|
// break;
|
|
// }
|
|
// default:
|
|
// openFlAG = false;
|
|
// break;
|
|
// }
|
|
// return openFlAG;
|
|
// }
|
|
}
|
|
}
|
|
|