本文整理汇总了C#中GameDataCacheSet.FindKey方法的典型用法代码示例。如果您正苦于以下问题:C# GameDataCacheSet.FindKey方法的具体用法?C# GameDataCacheSet.FindKey怎么用?C# GameDataCacheSet.FindKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameDataCacheSet
的用法示例。
在下文中一共展示了GameDataCacheSet.FindKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneralStatus
/// <summary>
/// 佣兵状态
/// </summary>
public GeneralStatus GeneralStatus(string userID)
{
var cacheSet = new GameDataCacheSet<UserGeneral>();
if (cacheSet.FindKey(userID, _item.GeneralID) != null)
{
return _item.IsNotUsed ? Model.GeneralStatus.YinCang : cacheSet.FindKey(userID, _item.GeneralID).GeneralStatus;
}
return Model.GeneralStatus.YinCang;
}
示例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 GameDataCacheSet<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: HeroRefreshNum
/// <summary>
/// 增加刷新次数
/// </summary>
/// <param name="userID"></param>
/// <param name="cityID"></param>
/// <returns></returns>
public static void HeroRefreshNum(string userID, int cityID)
{
var cacheSet = new GameDataCacheSet<UserDailyRestrain>();
UserDailyRestrain dailyRestrain = cacheSet.FindKey(userID);
if (dailyRestrain != null)
{
DailyUserExtend userExtend = new DailyUserExtend();
List<HeroPlot> heroList = new List<HeroPlot>();
if (dailyRestrain.UserExtend != null)
{
userExtend = dailyRestrain.UserExtend;
if (dailyRestrain.UserExtend.HeroPlot.Count > 0)
{
heroList = dailyRestrain.UserExtend.HeroPlot;
}
}
HeroPlot plot = heroList.Find(m => m.CityID.Equals(cityID));
if (plot != null)
{
plot.HeroNum = MathUtils.Addition(plot.HeroNum, 1);
}
else
{
heroList.Add(new HeroPlot() { CityID = cityID, HeroNum = 1, HeroList = new List<FunPlot>() });
}
userExtend.HeroPlot = heroList;
dailyRestrain.UserExtend = userExtend;
}
cacheSet.Update();
}
示例4: ProcessCmd
protected override void ProcessCmd(string[] args)
{
int magicID = args.Length > 0 ? args[0].Trim().ToInt() : 0;
short magicLv = args.Length > 1 ? args[1].Trim().ToShort() : (short)1;
var cacheSet = new GameDataCacheSet<UserMagic>();
var userMagic = cacheSet.FindKey(UserID, magicID);
MagicInfo magic = new ConfigCacheSet<MagicInfo>().FindKey(magicID);
if (magic == null)
{
return;
}
if (userMagic == null)
{
userMagic = new UserMagic()
{
UserID = UserID,
MagicID = magicID,
MagicLv = magicLv,
IsEnabled = false,
MagicType = magic.MagicType,
};
cacheSet.Add(userMagic);
}
else
{
userMagic.MagicLv = magicLv;
}
}
示例5: TakeAction
public override bool TakeAction()
{
int useGold = ConfigEnvSet.GetInt("TrumpZodiac.ChangeZodiacUseGold");
if (ops == 1)
{
ErrorCode = ops;
ErrorInfo = string.Format(LanguageManager.GetLang().St1471_ChangeZodiac, useGold);
return false;
}
else if (ops == 2)
{
if (ContextUser.GoldNum < useGold)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
return false;
}
var cacheSet = new GameDataCacheSet<UserTrump>();
UserTrump userTrump = cacheSet.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
if (userTrump != null)
{
userTrump.Zodiac = TrumpHelper.GetZodiacType(userTrump.Zodiac);
ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue);
}
ErrorCode = ops;
}
return true;
}
示例6: TakeAction
public override bool TakeAction()
{
var cacheSet = new GameDataCacheSet<GameUser>();
GameUser user = cacheSet.FindKey(_useridreq);
if (null != user)
{
if ((user.UserName != _username)
|| (user.UserType != _usertype))
{
return false;
}
/*更新客户端上报的存档信息*/
user.ClientArchive = _clientarchive;
cacheSet.Add(user);
cacheSet.Update();
return true;
}
else
{
return false;
}
}
示例7: Process
private void Process(string userID, int generalID, int experience)
{
var cacheSet = new GameDataCacheSet<UserGeneral>();
var usergeneral = cacheSet.FindKey(userID, generalID);
if(usergeneral!=null)
{
usergeneral.CurrExperience = MathUtils.Addition(usergeneral.CurrExperience, experience);
}
}
示例8: TakeAction
public override bool TakeAction()
{
int upitemNum = 0;
var cacheSet = new GameDataCacheSet<UserTrump>();
UserTrump userTrump = cacheSet.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
if (userTrump == null)
{
return false;
}
WashConsumeInfo consumeInfo = TrumpHelper.GetWashConsumeInfo(userTrump.MatureNum);
if (consumeInfo == null)
{
return false;
}
upitemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, consumeInfo.ItemID);
if (ops == 1)
{
string success = ((double)consumeInfo.SuccessNum * 100).ToString();
ErrorCode = ops;
ErrorInfo = string.Format(LanguageManager.GetLang().St1458_UseBackDaysOrb, consumeInfo.ItemNum, consumeInfo.MatureNum, success);
return false;
}
else if (ops == 2)
{
ErrorCode = ops;
if (upitemNum < consumeInfo.ItemNum)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1458_BackDaysOrbNotEnough;
return false;
}
int maxMatrueNum = ConfigEnvSet.GetInt("Trump.MaxMatrueNum");
if (userTrump.MatureNum >= maxMatrueNum)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1458_MaxMatrueNumFull;
return false;
}
UserItemHelper.UseUserItem(ContextUser.UserID, consumeInfo.ItemID, consumeInfo.ItemNum);
if (RandomUtils.IsHit(consumeInfo.SuccessNum))
{
userTrump.MatureNum = MathUtils.Addition(userTrump.MatureNum, consumeInfo.MatureNum.ToShort(), maxMatrueNum.ToShort());
ErrorInfo = LanguageManager.GetLang().St1458_XiLianSuccess;
var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
if (usergeneral != null)
{
usergeneral.RefreshMaxLife();
}
}
else
{
ErrorInfo = LanguageManager.GetLang().St1458_XiLianFail;
}
}
return true;
}
示例9: GetUserFunction
/// <summary>
/// 已开启的功能
/// </summary>
/// <param name="userID"></param>
/// <param name="funEnum"></param>
/// <returns></returns>
private static UserFunction GetUserFunction(string userID, FunctionEnum funEnum)
{
var cacheSet = new GameDataCacheSet<UserFunction>();
UserFunction function1 = cacheSet.FindKey(userID, funEnum);
if (function1 != null)
{
return function1;
}
return null;
}
示例10: Get
/// <summary>
/// 背包
/// </summary>
/// <returns></returns>
public UserItemPackage Get()
{
var cacheSet = new GameDataCacheSet<UserItemPackage>();
var data = cacheSet.FindKey(_user.UserId.ToString());
if (data != null)
{
return data;
}
TraceLog.WriteError(string.Format("User:{0} item package is null.", _user.UserId));
return null;
}
示例11: GetTask
/// <summary>
/// 玩家任务
/// </summary>
/// <returns></returns>
public static UserTask GetTask(string userID)
{
var cacheSet = new GameDataCacheSet<UserTask>();
var data = cacheSet.FindKey(userID);
if (data != null)
{
return data;
}
TraceLog.WriteError(string.Format("User:{0} Task package is null.", userID));
return null;
}
示例12: AddBack
/// <summary>
/// 初始化背包
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public static void AddBack(GameUser user)
{
var cacheSet = new GameDataCacheSet<UserPack>();
var cacheSetBackPack = new ConfigCacheSet<BackpackConfigInfo>();
var userPack = cacheSet.FindKey(user.UserID);
if (userPack == null)
{
userPack = new UserPack();
userPack.UserID = user.UserID.ToInt();
userPack.CreateDate = DateTime.Now;
var backpackConfig = cacheSetBackPack.FindKey(BackpackType.ZhuangBei);
if (backpackConfig != null)
{
var packType = new PackType();
packType.BackpackType = BackpackType.ZhuangBei;
packType.OpenNum = 0;
packType.Position = backpackConfig.DefaultNum;
}
backpackConfig = cacheSetBackPack.FindKey(BackpackType.YongBing);
if (backpackConfig != null)
{
var packType = new PackType();
packType.BackpackType = BackpackType.YongBing;
packType.OpenNum = 0;
packType.Position = backpackConfig.DefaultNum;
}
backpackConfig = cacheSetBackPack.FindKey(BackpackType.HunJi);
if (backpackConfig != null)
{
var packType = new PackType();
packType.BackpackType = BackpackType.HunJi;
packType.OpenNum = 0;
packType.Position = backpackConfig.DefaultNum;
}
backpackConfig = cacheSetBackPack.FindKey(BackpackType.BeiBao);
if (backpackConfig != null)
{
var packType = new PackType();
packType.BackpackType = BackpackType.BeiBao;
packType.OpenNum = 0;
packType.Position = backpackConfig.DefaultNum;
user.GridNum = MathUtils.Addition(user.GridNum, backpackConfig.DefaultNum);
}
}
}
示例13: CheckLoadUser
public static GameUser CheckLoadUser(string userId)
{
var cacheSet = new GameDataCacheSet<GameUser>();
GameUser gameUser = cacheSet.FindKey(userId);
if (gameUser == null)
{
//bool isAuto = true;
//bool ignoreError = true;
//int periodTime = GameEnvironment.CacheUserPeriod;
//todo 注释掉,由底层自动加载
//GameLoadManager.Add(new GameUserDataLoader<GameUser>(isAuto, "UserID", userId.ToInt(), 1, periodTime), ignoreError);
//GameLoadManager.Add(new GameUserDataLoader<UserGeneral>(isAuto, "UserID", userId.ToInt(), LoadMaxCount, periodTime), ignoreError);
}
return gameUser;
}
示例14: Get
public static UserPlotPackage Get(string userId)
{
if (string.IsNullOrEmpty(userId))
{
throw new ArgumentNullException("UserID为空");
}
var cacheSet = new GameDataCacheSet<UserPlotPackage>();
var data = cacheSet.FindKey(userId);
if (data != null)
{
return data;
}
BaseLog log = new BaseLog();
log.SaveLog(new NullReferenceException(string.Format("User:{0} UserPlot package is null.", userId)));
return null;
}
示例15: Process
private void Process(string userID, int fun)
{
FunctionEnum funEnum = fun.ToEnum<FunctionEnum>();
var cacheSet = new GameDataCacheSet<UserFunction>();
UserFunction userFunction = cacheSet.FindKey(UserID, funEnum);
if (userFunction == null)
{
userFunction = new UserFunction()
{
UserID = userID,
FunEnum = funEnum,
CreateDate = DateTime.Now
};
cacheSet.Add(userFunction, GameEnvironment.CacheUserPeriod);
}
}