本文整理汇总了C#中PersonalCacheStruct.FindAll方法的典型用法代码示例。如果您正苦于以下问题:C# PersonalCacheStruct.FindAll方法的具体用法?C# PersonalCacheStruct.FindAll怎么用?C# PersonalCacheStruct.FindAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersonalCacheStruct
的用法示例。
在下文中一共展示了PersonalCacheStruct.FindAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TakeAction
public override bool TakeAction()
{
var cacheSet = new PersonalCacheStruct<UserQueue>();
List<UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);
foreach (UserQueue queue in userQueueList)
{
if (queue != null)
{
int npcCount = new ShareCacheStruct<PlotNPCInfo>().FindAll(m => m.PlotID == plotID).Count;
//战斗次数
int totalBattleNum = (int)Math.Floor((double)(queue.TotalColdTime - queue.DoRefresh()) / PlotInfo.BattleSpeedNum);
int turnsNum = totalBattleNum / npcCount;
int battleNum = totalBattleNum % npcCount;
//没发生战斗或上未通关都返还精力
//if (turnsNum == 0 || battleNum > 0)
//{
// ContextUser.EnergyNum = ContextUser.EnergyNum.Addition(PlotInfo.BattleEnergyNum, short.MaxValue);
//}
cacheSet.Delete(queue);
}
}
if (ContextUser.UserStatus == UserStatus.SaoDang)
{
ContextUser.ResetSweepPool(0);
ContextUser.UserStatus = UserStatus.Normal;
//ContextUser.Update();
}
return true;
}
示例2: SendAllowTask
/// <summary>
/// 下发任务
/// </summary>
/// <param name="user"></param>
/// <param name="taskID"></param>
public static List<UserTask> SendAllowTask(GameUser user, int taskID)
{
List<UserTask> userTaskList = new List<UserTask>();
var cacheSet = new PersonalCacheStruct<UserTask>();
UserTask preTask = cacheSet.FindKey(user.UserID, taskID);
if (taskID > 0 && preTask != null && (preTask.TaskState != TaskState.Close || preTask.TaskType == TaskType.Offset))
{
return userTaskList;
}
if (taskID == 0 && cacheSet.FindAll(user.UserID, m => m.TaskType < TaskType.Daily).Count > 0)
{
return userTaskList;
}
IList<StoryTaskInfo> taskList = StoryTaskInfo.GetNextTask(taskID);
bool isSend = true;
foreach (StoryTaskInfo taskInfo in taskList)
{
if (taskInfo.CountryID != CountryType.None && user.CountryID != taskInfo.CountryID)
{
continue;
}
UserTask userTask = cacheSet.FindKey(user.UserID, taskInfo.TaskID);
if (userTask == null)
{
userTask = new UserTask
{
TaskID = taskInfo.TaskID,
UserID = user.UserID,
TaskType = taskInfo.TaskType,
TaskState = taskInfo.TaskLv <= user.UserLv ? TaskState.AllowTake : TaskState.NoTake,
CompleteNum = 0,
CreateDate = DateTime.Now
};
cacheSet.Add(userTask);
userTask = cacheSet.FindKey(user.UserID, taskInfo.TaskID);
userTaskList.Add(userTask);
}
else
{
//判断是否已下发过
isSend = false;
break;
}
}
if (isSend)
{
return userTaskList;
}
return new List<UserTask>();
}
示例3: DoSuccess
protected override bool DoSuccess(int userId, out IUser user)
{
user = null;
var cacheSet = new PersonalCacheStruct<GameUser>();
var roleCache = new PersonalCacheStruct<UserRole>();
var roleList = roleCache.FindAll(userId.ToString());
GameUser gameUser = cacheSet.FindKey(userId.ToString());
if (gameUser == null || roleList.Count == 0)
{
//通知客户跳转到创建角色接口
GuideId = 1005;
return true;
}
user = new SessionUser(gameUser);
if (gameUser.CurrRoleId == 0)
{
gameUser.CurrRoleId = roleList[0].RoleId;
}
return true;
}
示例4: TakeAction
public override bool TakeAction()
{
var cacheSet = new PersonalCacheStruct<UserQueue>();
List<UserQueue> userQueueArray = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.JingJiTiaoZhan);
if (userQueueArray.Count > 0)
{
UserQueue userQueue = userQueueArray[0];
int queueColdTime = userQueue.DoRefresh();
queueColdTime = queueColdTime < 0 ? 0 : queueColdTime;
if (ops == 1)
{
this.ErrorCode = ops;
this.ErrorInfo = GetPrice().ToString();
return false;
}
else if (ops == 2)
{
if (ContextUser.GoldNum >= GetPrice())
{
this.ErrorCode = ops;
ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GetPrice(), int.MaxValue);
//ContextUser.Update();
cacheSet.Delete(userQueue);
}
else
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
return false;
}
}
else
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
return false;
}
}
return true;
}
示例5: DoSuccess
protected override bool DoSuccess(int userId)
{
var cacheSet = new PersonalCacheStruct<GameUser>();
var roleCache = new PersonalCacheStruct<UserRole>();
var roleList = roleCache.FindAll(Uid);
GameUser gameUser = cacheSet.FindKey(Uid);
if (gameUser == null || roleList.Count == 0)
{
//通知客户跳转到创建角色接口
GuideId = 1005;
return true;
}
if (gameUser.CurrRoleId == 0)
{
gameUser.CurrRoleId = roleList[0].RoleId;
}
var notifyUsers = new List<GameUser>();
notifyUsers.Add(gameUser);
ActionFactory.SendAsyncAction(notifyUsers, (int)ActionType.World, null, null);
return true;
}
示例6: TakeAction
public override bool TakeAction()
{
var cacheSet = new PersonalCacheStruct<UserPlant>();
UserPlant plant = cacheSet.FindKey(ContextUser.UserID);
var landCacheSet = new PersonalCacheStruct<UserLand>();
List<UserLand> landArray = landCacheSet.FindAll(ContextUser.UserID);
if (plant == null)
{
UserPlant uPlant = new UserPlant()
{
UserID = ContextUser.UserID,
LandNum = 1,
DewNum = ConfigEnvSet.GetInt("UserQueue.ShengShuiMaxNum"),
PayDewTime = 0,
};
cacheSet.Add(uPlant);
}
if (landArray.Count == 0)
{
UserLand userLand = new UserLand()
{
UserID = ContextUser.UserID,
PlantType = PlantType.Experience,
LandPositon = 1,
IsRedLand = 2,
IsBlackLand = 2,
IsGain = 2
};
landCacheSet.Add(userLand);
}
if (new PersonalCacheStruct<UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Zhongzhijingqianshu) == null)
{
isShow = 2;
}
else
{
isShow = 1;
}
userPlant = new PersonalCacheStruct<UserPlant>().FindKey(ContextUser.UserID);
userLandArray = new PersonalCacheStruct<UserLand>().FindAll(ContextUser.UserID);
//圣水恢复
var queueCacheSet = new PersonalCacheStruct<UserQueue>();
List<UserQueue> ShengShuiQueueArray = queueCacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.ShengShuiHuiFu);
if (ShengShuiQueueArray.Count > 0)
{
UserQueue shengShuiQueue = ShengShuiQueueArray[0];
if (userPlant != null)
{
int shengshuiMaxNum = ConfigEnvSet.GetInt("UserQueue.ShengShuiMaxNum");
int restorationDate = ConfigEnvSet.GetInt("UserQueue.ShengShuiRestorationDate"); //三小时
int restorationNum = ConfigEnvSet.GetInt("UserQueue.ShengShuiRestorationNum"); //恢复1点
int timeCount = (int)(DateTime.Now - shengShuiQueue.Timing).TotalSeconds / restorationDate;
if (userPlant.DewNum < shengshuiMaxNum && timeCount > 0)
{
userPlant.DewNum = MathUtils.Addition(userPlant.DewNum, (timeCount * restorationNum), shengshuiMaxNum);
//userPlant.Update();
shengShuiQueue.Timing = DateTime.Now;
//shengShuiQueue.Update();
}
}
}
else
{
UserQueue queue = new UserQueue()
{
QueueID = Guid.NewGuid().ToString(),
UserID = ContextUser.UserID,
QueueType = QueueType.ShengShuiHuiFu,
QueueName = QueueType.ShengShuiHuiFu.ToString(),
Timing = DateTime.Now,
ColdTime = 0,
TotalColdTime = 0,
IsSuspend = false,
StrengNum = 0
};
queueCacheSet.Add(queue);
}
return true;
}
示例7: TakeAction
public override bool TakeAction()
{
ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(medicineID);
if (itemInfo == null)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
return false;
}
if (ops == 1)
{
ErrorCode = 1;
ErrorInfo = string.Format(LanguageManager.GetLang().St11415_ClearMedicine, itemInfo.ItemName, itemInfo.MedicineLv, itemInfo.EffectNum);
return false;
}
UserGeneral general = new PersonalCacheStruct<UserGeneral>().FindKey(ContextUser.UserID, generalID);
if (general == null)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St10006_DoesNotExistTheGeneral;
return false;
}
var cacheSet = new PersonalCacheStruct<GeneralMedicine>();
List<GeneralMedicine> generalMedicineArray = cacheSet.FindAll(ContextUser.UserID, g => g.MedicineID.Equals(medicineID) && g.GeneralID == generalID);
generalMedicineArray.QuickSort((x, y) =>
{
if (x == null && y == null) return 0;
if (x != null && y == null) return 1;
if (x == null) return -1;
return x.BaseNum.CompareTo(y.BaseNum);
});
if (generalMedicineArray.Count <= 0)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
return false;
}
if (UserHelper.IsBeiBaoFull(ContextUser))
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1415_GridNumNotEnough;
return false;
}
//UserItem[] userItemArray = UserItem.FindAll(UserItem.Index_UserID, u => (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu) && u.ItemID == itemID, ContextUser.UserID);
var package = UserItemPackage.Get(Uid);
List<UserItemInfo> userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemID == itemID);
//药剂摘除道不足
int Num = itemInfo.MedicineLv;
if (userItemArray.Count <= 0 || UserItemMedicineNum(userItemArray) < Num)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
return false;
}
UserItemHelper.UseUserItem(ContextUser.UserID, itemID, Num);
if (RandomUtils.GetRandom() <= itemInfo.EffectNum)
{
short propertyNum = MedicinePropertyNum(ContextUser.UserID, medicineID, generalID);
switch (itemInfo.MedicineType)
{
case 1:
general.PowerNum = MathUtils.Subtraction(general.PowerNum, propertyNum);
break;
case 2:
general.SoulNum = MathUtils.Subtraction(general.SoulNum, propertyNum);
break;
case 3:
general.IntellectNum = MathUtils.Subtraction(general.IntellectNum, propertyNum);
break;
default:
general.PowerNum = general.PowerNum; ;
break;
}
//general.Update();
cacheSet.Delete(generalMedicineArray[0]);
ErrorCode = 2;
UserItemHelper.AddUserItem(ContextUser.UserID, medicineID, 1);
}
else
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St11415_Clearfail;
return false;
}
return true;
}
示例8: TakeAction
public override bool TakeAction()
{
List<UserQueue> queueList = new PersonalCacheStruct<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);
if (queueList.Count > 0)
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St4007_Saodanging;
return false;
}
var itemList = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao);
if (itemList.Count >= ContextUser.GridNum)
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St4007_BeiBaoTimeOut;
return false;
}
List<PlotNPCInfo> npcList = new ShareCacheStruct<PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
//战斗次数
int plotNpcNum = npcList.Count;
int energyNum = 0;
int battleNum;
if (ops == 1)
{
//用尽精力,玩家可扫荡轮数
energyNum = ContextUser.EnergyNum > 200 ? 200 : ContextUser.EnergyNum.ToInt();
int userTurnsNum = (int)Math.Floor((double)energyNum / PlotInfo.BattleEnergyNum);
battleNum = userTurnsNum * plotNpcNum;
coldTime = battleNum * PlotInfo.BattleSpeedNum;
}
else if (ops == 2)
{
//30分钟
coldTime = Time_30;
battleNum = PlotHelper.GetBattleNum(Time_30);
energyNum = PlotHelper.GetTurnsNum(plotNpcNum, battleNum) * PlotInfo.BattleEnergyNum;
}
else if (ops == 3)
{
//60分钟
coldTime = Time_60;
battleNum = PlotHelper.GetBattleNum(Time_60);
energyNum = PlotHelper.GetTurnsNum(plotNpcNum, battleNum) * PlotInfo.BattleEnergyNum;
}
else
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
return false;
}
if (ContextUser.EnergyNum == 0 || ContextUser.EnergyNum < energyNum)
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St_EnergyNotEnough;
return false;
}
//清除扫荡池
var sweepCacheSet = new PersonalCacheStruct<UserSweepPool>();
List<UserSweepPool> sweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID);
foreach (UserSweepPool sweepPool in sweepPoolList)
{
if (sweepPool != null)
{
sweepCacheSet.Delete(sweepPool);
}
}
if (coldTime > 0)
{
//在开始战斗时扣一次玩家精力,无战斗离开返还
ContextUser.ResetSweepPool(plotID);
//开始扫荡暂不扣精力
//ContextUser.RemoveEnergyNum(PlotInfo.BattleEnergyNum);
ContextUser.UserStatus = UserStatus.SaoDang;
//ContextUser.Update();
//放入队列中
UserQueue userQueue = new UserQueue()
{
QueueID = Guid.NewGuid().ToString(),
UserID = ContextUser.UserID,
QueueType = QueueType.SaoDang,
QueueName = QueueType.SaoDang.ToString(),
TotalColdTime = coldTime,
Timing = DateTime.Now,
ColdTime = coldTime,
IsSuspend = false
};
new PersonalCacheStruct<UserQueue>().Add(userQueue);
}
return true;
}
示例9: RemovePack
/// <summary>
/// //删除不是本周,本月已领取的数据
/// </summary>
/// <param name="userID"></param>
public static void RemovePack(string userID)
{
var cacheSet = new PersonalCacheStruct<PackageReceive>();
List<PackageReceive> packageReceiveArray = cacheSet.FindAll(userID, u => u.PacksType == 3 || u.PacksType == 4);
foreach (PackageReceive packageReceive in packageReceiveArray)
{
if (!PaymentService.IsCurrentWeek(packageReceive.ReceiveDate) && packageReceive.PacksType == 3)
{
cacheSet.Delete(packageReceive);
}
if (packageReceive.ReceiveDate.Month != DateTime.Now.Month && packageReceive.PacksType == 4)
{
cacheSet.Delete(packageReceive);
}
}
}
示例10: GetAbility
/// <summary>
/// 佣兵属性集合
/// </summary>
/// <param name="userID"></param>
/// <param name="generalID"></param>
/// <returns></returns>
public static List<GeneralProperty> GetAbility(string userID, int generalID,UserGeneral userGeneral)
{
List<GeneralProperty> gPropertyList = new List<GeneralProperty>();
var cacheSetUserEmbattle = new PersonalCacheStruct<UserEmbattle>();
GeneralProperty generalProperty = new GeneralProperty();
var userMagic = new PersonalCacheStruct<UserMagic>().Find(userID, s => s.IsEnabled);
CombatGeneral combatGeneral = new CombatGeneral()
{
UserID = userID,
GeneralID = generalID,
ExtraAttack = new CombatProperty(),
ExtraDefense = new CombatProperty(),
LifeNum = userGeneral.LifeNum,
LifeMaxNum = userGeneral.LifeMaxNum
};
var userEmbattleList = cacheSetUserEmbattle.FindAll(userID,
s =>
s.MagicID == (userMagic != null ? userMagic.MagicID : 0));
UserEmbattleQueue.embattleList = userEmbattleList;
UserEmbattleQueue.KarmaAddition(userID, combatGeneral);
userGeneral.TLifeNum = combatGeneral.LifeNum;
userGeneral.TLifeMaxNun = combatGeneral.LifeMaxNum;
//int LifeReply = 0; // 生命回复
//物理攻击
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiGongJi);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue*combatGeneral.ExtraAttack.AdditionWuliNum);
gPropertyList.Add(generalProperty);
//物理防御
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiFangYu);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionWuliNum);
gPropertyList.Add(generalProperty);
//魂技攻击
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiGongJi);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionHunjiNum);
gPropertyList.Add(generalProperty);
//魂技防御
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiFangYu);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionHunjiNum);
gPropertyList.Add(generalProperty);
//魔法攻击
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaGongJi);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionMofaNum);
gPropertyList.Add(generalProperty);
//魔法防御
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaFangYu);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionMofaNum);
gPropertyList.Add(generalProperty);
//暴击
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BaoJi));
//命中
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.MingZhong));
//破击
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.PoJi));
//韧性
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.RenXing));
//闪避
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.ShanBi));
//格挡
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.GeDang));
//必杀
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BiSha));
//先攻
gPropertyList.Add(new GeneralProperty() { AbilityType = AbilityType.FirstStrike, AbilityValue = (decimal)TotalPriorityNum(userID, generalID) });
return gPropertyList;
}
示例11: RemoveCharge
/// <summary>
/// 删除累计充值礼包多个,只余一个
/// </summary>
/// <param name="userID"></param>
/// <param name="packID"></param>
/// <returns></returns>
public static void RemoveCharge(string userID, int packID)
{
List<PackageReceive> packageReceiveArray = new PersonalCacheStruct<PackageReceive>().FindAll(userID, m => m.PacksID == packID);
if (packageReceiveArray.Count > 1)
{
var packCacheSet = new PersonalCacheStruct<PackageReceive>();
packageReceiveArray = packCacheSet.FindAll(userID, u => u.IsReceive && u.PacksID == packID);
if (packageReceiveArray.Count > 0)
{
packageReceiveArray = packCacheSet.FindAll(userID, u => !u.IsReceive && u.PacksID == packID);
foreach (PackageReceive packageReceive in packageReceiveArray)
{
packCacheSet.Delete(packageReceive);
}
}
else
{
packageReceiveArray = packCacheSet.FindAll(userID, u => !u.IsReceive && u.PacksID == packID);
for (int i = 1; i <= packageReceiveArray.Count - 1; i++)
{
packCacheSet.Delete(packageReceiveArray[i]);
}
}
}
}
示例12: TakeAction
public override bool TakeAction()
{
equMaxNum = ConfigEnvSet.GetInt("UserQueue.EquStrengMaxNum");
_magicMaxNum = ConfigEnvSet.GetInt("UserQueue.MagicStrengMaxNum");
equCount = ContextUser.QueueNum;
List<UserLand> landArray = new PersonalCacheStruct<UserLand>().FindAll(ContextUser.UserID, u => u.IsGain == 1 || u.DoRefresh() > 0);
currPlantNum = landArray.Count;
UserPlant plant = new PersonalCacheStruct<UserPlant>().FindKey(ContextUser.UserID);
if (plant != null)
{
maxPlantNum = plant.LandNum;
}
else
{
maxPlantNum = 0;
}
UserExpedition expedition = new PersonalCacheStruct<UserExpedition>().FindKey(ContextUser.UserID);
if (expedition != null && DateTime.Now.Date == expedition.InsertDate.Date)
{
currExploreNum = expedition.ExpeditionNum;
}
else
{
currExploreNum = 0;
}
UserFunction function = new PersonalCacheStruct<UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Meiritanxian);
if (function != null)
{
maxExploreNum = 10;
}
else
{
maxExploreNum = 0;
}
var cacheSet = new PersonalCacheStruct<UserQueue>();
List<UserQueue> uQueueArray = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.EquipmentStrong);
if (uQueueArray.Count > 3)
{
for (int i = 0; i < uQueueArray.Count - 3; i++)
{
cacheSet.Delete(uQueueArray[i]);
}
}
queueArray = new PersonalCacheStruct<UserQueue>().FindAll(ContextUser.UserID, u => u.QueueType == QueueType.EquipmentStrong || u.QueueType == QueueType.MagicStrong || u.QueueType == QueueType.TianXianStrong);
queueArray.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);
});
equOpenCount = EquStrongQueue(ContextUser.UserID);
return true;
}
示例13: TakeAction
public override bool TakeAction()
{
//刷新副本奖励
if (!PlotHelper.RefleshPrize(ContextUser.UserID, plotID))
{
//this.ErrorCode = LanguageManager.GetLang().ErrorCode;
//this.ErrorInfo = LanguageManager.GetLang().St4007_SaodangOver;
}
var sweepCacheSet = new PersonalCacheStruct<UserSweepPool>();
var tempSweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID, m => m.IsSend == false);
tempSweepPoolList.QuickSort((x, y) =>
{
if (x == null && y == null) return 0;
if (x != null && y == null) return 1;
if (x == null) return -1;
int result = 0;
x.UserID = x.UserID == null ? "" : x.UserID;
y.UserID = y.UserID == null ? "" : y.UserID;
result = x.UserID.CompareTo(y.UserID);
if (result == 0)
{
if (x.TurnsNum < y.TurnsNum)
{
return -1;
}
else if (x.TurnsNum > y.TurnsNum)
{
return 1;
}
else
{
if (x.BattleNum < y.BattleNum)
{
return -1;
}
else if (x.BattleNum > y.BattleNum)
{
return 1;
}
}
}
return result;
});
userEmbattleList = new PersonalCacheStruct<UserEmbattle>().FindAll(ContextUser.UserID, m => m.GeneralID > 0 && m.MagicID == ContextUser.UseMagicID);
foreach (UserSweepPool userSweepPool in tempSweepPoolList)
{
if (userSweepPool != null)
{
sweepCacheSet.Delete(userSweepPool);
}
}
var tempList = new List<UserSweepPool>(tempSweepPoolList);
int pageSize = 12;
int index = 0;
if (tempList.Count > pageSize)
{
index = tempList.Count - pageSize;
}
else
{
pageSize = tempList.Count;
}
if (tempList.Count > 0)
{
userSweepPoolList = tempList.GetRange(index, pageSize);
}
return true;
}
示例14: TakeAction
public override bool TakeAction()
{
string publicUserID = ContextUser.UserID;
if (!string.IsNullOrEmpty(toUserID))
{
publicUserID = toUserID;
}
UserMagic userMagic = new PersonalCacheStruct<UserMagic>().Find(publicUserID, s => s.IsEnabled);
var cacheSetUserEmbattle = new PersonalCacheStruct<UserEmbattle>();
var cacheGeneral = new PersonalCacheStruct<UserGeneral>();
var userGeneralList = new List<UserGeneral>();
switch (generalType)
{
case GeneralType.YongBing:
userGeneralList = cacheGeneral.FindAll(publicUserID, u => u.GeneralType != GeneralType.Soul && u.GeneralStatus == GeneralStatus.DuiWuZhong);
break;
case GeneralType.Soul:
userGeneralList = cacheGeneral.FindAll(publicUserID, u => u.GeneralType == generalType && u.AtmanNum > 0 && u.GeneralStatus == GeneralStatus.DuiWuZhong);
break;
case GeneralType.Battle:
userGeneralList = cacheGeneral.FindAll(publicUserID, u => u.GeneralType != GeneralType.Soul && u.GeneralStatus == GeneralStatus.DuiWuZhong);
break;
}
var all = cacheGeneral.FindAll(publicUserID, false);
if (all.Count > 0)
{
}
foreach (var userGeneral in userGeneralList)
{
switch (generalType)
{
case GeneralType.YongBing:
if (
cacheSetUserEmbattle.Find(publicUserID, s => s.MagicID == userMagic.MagicID && s.GeneralID == userGeneral.GeneralID) !=
null)
{
userGeneral.IsBattle = true;
}
else
{
userGeneral.IsBattle = false;
}
userGeneralArray.Add(userGeneral);
break;
case GeneralType.Soul:
userGeneralArray.Add(userGeneral);
break;
case GeneralType.Battle:
if (
cacheSetUserEmbattle.Find(publicUserID, s => s.MagicID == userMagic.MagicID && s.GeneralID == userGeneral.GeneralID) !=
null)
{
userGeneral.IsBattle = true;
userGeneralArray.Add(userGeneral);
}
break;
}
}
// 佣兵排序
GeneralSortHelper.GeneralSort(ContextUser.UserID, userGeneralArray);
return true;
}
示例15: TakeAction
public override bool TakeAction()
{
List<PlotNPCInfo> plotNPCInfoList = new ShareCacheStruct<PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
npcCount = (short)plotNPCInfoList.Count;
var cacheSet = new PersonalCacheStruct<UserQueue>();
List<UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);
if (userQueueList.Count > 0)
{
UserQueue userQueue = userQueueList[0];
coldTime = userQueue.DoRefresh();
if (coldTime == 0)
{
cacheSet.Delete(userQueue);
ContextUser.ResetSweepPool(0);
ContextUser.UserStatus = UserStatus.Normal;
//ContextUser.Update();
}
int tempNum = PlotHelper.GetBattleNum(userQueue.GetTiming()) + 1;
if (npcCount > 0)
{
turnsNum = PlotHelper.GetTurnsNum(npcCount, tempNum);
timesNum = PlotHelper.GetTimesNum(npcCount, tempNum);
}
//PlotHelper.CheckSweepCount(npcCount, userQueue.GetTiming(), out turnsNum, out battleNum);
//if (battleNum >= npcCount)
//{
// turnsNum = turnsNum + 1;
//}
//else
//{
// battleNum = battleNum + 1;
//}
}
userItemCount = (short)UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao).Count;
plotInfo = new ShareCacheStruct<PlotInfo>().FindKey(plotID);
if (plotInfo == null)
{
return false;
}
foreach (PlotNPCInfo npcInfo in plotNPCInfoList)
{
if (npcInfo == null)
{
continue;
}
List<PlotEmbattleInfo> embattleInfoList = new ShareCacheStruct<PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == npcInfo.PlotNpcID);
foreach (PlotEmbattleInfo embattleInfo in embattleInfoList)
{
if (monsterDict.ContainsKey(embattleInfo.MonsterID))
{
if (monsterNumDict.ContainsKey(embattleInfo.MonsterID))
{
monsterNumDict[embattleInfo.MonsterID] = monsterNumDict[embattleInfo.MonsterID] + 1;
}
}
else
{
MonsterInfo monsterInfo = new ShareCacheStruct<MonsterInfo>().FindKey(embattleInfo.MonsterID);
if (monsterInfo != null)
{
monsterDict.Add(embattleInfo.MonsterID, monsterInfo);
monsterNumDict.Add(embattleInfo.MonsterID, 1);
}
}
}
}
return true;
}