本文整理汇总了C#中CacheList.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# CacheList.ToArray方法的具体用法?C# CacheList.ToArray怎么用?C# CacheList.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheList
的用法示例。
在下文中一共展示了CacheList.ToArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetApply
/// <summary>
/// 晋级公会
/// </summary>
/// <returns></returns>
public static ServerFight[] GetApply(FightStage stage, int cityID)
{
int fastID = info.FastID;
FightStage fightStage = FightStage.Ready;
if (stage == FightStage.Apply && info.FastID > 1)
{
fastID = MathUtils.Subtraction(fastID, 1);
fightStage = FightStage.final;
}
if (stage == FightStage.semi_Wait)
{
fightStage = FightStage.quarter_final;
}
else if (stage == FightStage.final_Wait)
{
fightStage = FightStage.semi_final;
}
var fightGroupList = new ShareCacheStruct<ServerFightGroup>().FindAll(s => s.FastID == fastID && s.Stage == fightStage);
foreach (var fightgroup in fightGroupList)
{
if (string.IsNullOrEmpty(fightgroup.WinGuildID))
{
ServerFightGroupWinGuildID(fightgroup, fastID);
}
}
var applyList = new ShareCacheStruct<ServerFight>().FindAll(s => s.FastID == info.FastID && s.Stage == stage && s.CityID == cityID);
applyList.QuickSort((x, y) =>
{
int result;
if (x == null && y == null) return 0;
if (x != null && y == null) return 1;
if (x == null) return -1;
result = (int)y.GetResult(stage).CompareTo(x.GetResult(stage));
if (result == 0)
{
var userGuildA = new ShareCacheStruct<UserGuild>().FindKey(x.GuildID);
var userGuildB = new ShareCacheStruct<UserGuild>().FindKey(y.GuildID);
if (userGuildA != null && userGuildB != null)
{
result = userGuildB.GuildLv.CompareTo(userGuildA.GuildLv);
if (result == 0)
{
result = userGuildB.CurrExperience.CompareTo(userGuildA.CurrExperience);
}
}
}
return result;
});
var apply = new CacheList<ServerFight>();
for (int i = 0; i < info.Lenght && i < applyList.Count; i++)
{
apply.Add(applyList[i]);
}
return apply.ToArray();
}