本文整理汇总了C#中GameDataCacheSet.QuickSort方法的典型用法代码示例。如果您正苦于以下问题:C# GameDataCacheSet.QuickSort方法的具体用法?C# GameDataCacheSet.QuickSort怎么用?C# GameDataCacheSet.QuickSort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameDataCacheSet
的用法示例。
在下文中一共展示了GameDataCacheSet.QuickSort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TakeAction
public override bool TakeAction()
{
if (ContextUser.VipLv < 4)
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnough;
return false;
}
List<UserLand> uLandArray = new GameDataCacheSet<UserLand>().FindAll(ContextUser.UserID, u => u.IsRedLand == 1);
if (uLandArray.Count < 9)
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St10011_RedLandNotEnough;
return false;
}
if (uLandArray.Count > 0 && uLandArray[uLandArray.Count - 1].IsBlackLand == 1)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St10011_BlackLandFull;
return false;
}
List<UserLand> landArray = new GameDataCacheSet<UserLand>().FindAll(ContextUser.UserID, u => u.IsBlackLand == 2);
landArray.QuickSort((x, y) =>
{
if (x == null && y == null) return 0;
if (x != null && y == null) return 1;
if (x == null) return -1;
return ((int)x.LandPositon).CompareTo((int)y.LandPositon);
});
int position = 0;
if (landArray.Count > 0)
{
position = landArray[0].LandPositon;
}
int sumGold = GetPostionUseGold(position);
if (ops == 1)
{
this.ErrorCode = 1;
this.ErrorInfo = string.Format(LanguageManager.GetLang().St10011_UpBlackLandUseGold, sumGold);
return false;
}
else if (ops == 2)
{
if (ContextUser.GoldNum < sumGold)
{
this.ErrorCode = 2;
this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
return false;
}
UserLand land = new GameDataCacheSet<UserLand>().FindKey(ContextUser.UserID, position);
if (land != null && land.IsRedLand == 1 && land.IsBlackLand == 2)
{
if (land.IsRedLand == 1 && land.IsBlackLand == 2)
{
ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold, int.MaxValue);
land.IsBlackLand = 1;
UserLogHelper.AppenLandLog(ContextUser.UserID, 3, 0, position, sumGold, 0, 0, 0);
}
}
else if (land != null && land.IsRedLand == 2)
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St10011_NotRedLand;
return false;
}
else
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St10010_UpRedLandNotEnough;
return false;
}
}
return true;
}
示例2: TakeAction
public override bool TakeAction()
{
int maxEquNum = ConfigEnvSet.GetInt("UserQueue.EquStrengMaxNum");
UserItemPackage package;
if (!string.IsNullOrEmpty(_toUserId))
{
package = UserItemPackage.Get(_toUserId);
}
else
{
package = UserItemPackage.Get(ContextUser.UserID);
}
_userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(_userItemId)) ?? new UserItemInfo();
_itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(_userItem.ItemID);
if (_itemInfo == null)
{
SaveDebuLog(string.Format("玩家{0}物品ID={1}[{2}]不存在!", Uid, _userItem.UserItemID, _userItem.ItemID));
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
return false;
}
if (_userItem.ItemLv > _itemInfo.DemandLv)
{
_demandLv = _userItem.ItemLv;
}
else
{
_demandLv = _itemInfo.DemandLv;
}
_strongMoney = new UserItemHelper(_userItem, 1).StrongMoney;
_tenTimesStrongMoney = new UserItemHelper(_userItem, 10).StrongMoney; // 强化 10 次用钱
_itemEquArray = new ConfigCacheSet<ItemEquAttrInfo>().FindAll(m => m.ItemID == _userItem.ItemID);
if (_userItem.ItemLv >= ContextUser.UserLv || _strongMoney > ContextUser.GameCoin)
{
_isStrong = 1;
}
List<UserQueue> userQueueArray = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.EquipmentStrong);
userQueueArray.QuickSort((x, y) =>
{
if (x == null && y == null) return 0;
if (x != null && y == null) return 1;
if (x == null) return -1;
return y.Timing.CompareTo(x.Timing);
});
if (userQueueArray.Count == ContextUser.QueueNum)
{
DateTime minDateTime = DateTime.MinValue;
foreach (UserQueue queue in userQueueArray)
{
if (queue.DoRefresh() > 0 && !queue.IsSuspend && minDateTime < queue.Timing && queue.StrengNum >= maxEquNum)
{
_coldTime = queue.DoRefresh();
}
}
}
UserHelper.SparePartPropertyList(Uid, _userItemId); //灵件属性
return true;
}