本文整理汇总了C#中GameDataCacheSet.Update方法的典型用法代码示例。如果您正苦于以下问题:C# GameDataCacheSet.Update方法的具体用法?C# GameDataCacheSet.Update怎么用?C# GameDataCacheSet.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameDataCacheSet
的用法示例。
在下文中一共展示了GameDataCacheSet.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: ChangeUserHead
/// <summary>
/// 修改头像
/// </summary>
/// <param name="headIcon"></param>
public bool ChangeUserHead(string headIcon)
{
if (_user == null) return false;
_user.HeadIcon = headIcon;
var cacheSet = new GameDataCacheSet<GameUser>();
cacheSet.Update();
return true;
}
示例3: CreateGameuser
/// <summary>
/// 创建用户
/// </summary>
public GameUser CreateGameuser()
{
GameUser newuser = new GameUser(_buserinfo.UserId);
newuser.UserName = _userinfo.UserName;
newuser.UserType = _userinfo.UserType;
newuser.ClientOS = _userinfo.ClientOS;
newuser.ClientVersion = _userinfo.ClientVersion;
newuser.UserMagic = _userinfo.UserMagic;
newuser.UserBirthday = _userinfo.UserBirthday;
var cacheSet = new GameDataCacheSet<GameUser>();
cacheSet.Add(newuser);
cacheSet.Update();
return _userinfo;
}
示例4: TakeAction
public override bool TakeAction()
{
if (!UserHelper.IsOpenFunction(ContextUser.UserID, FunctionEnum.Trump))
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St_NoFun;
return false;
}
if (UserHelper.IsOpenFunction(ContextUser.UserID, FunctionEnum.TrumpPractice))
{
return false;
}
if (!TrumpHelper.IsTrumpPractice(ContextUser.UserID))
{
return false;
}
var cacheTrump = new GameDataCacheSet<UserTrump>();
UserTrump userTrump = cacheTrump.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
if (userTrump == null)
{
TrumpInfo trumpInfo = new ConfigCacheSet<TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, 1);
if (trumpInfo == null)
{
return false;
}
StoryTaskInfo[] storyTaskArray = new ConfigCacheSet<StoryTaskInfo>().FindAll(m => m.TaskType == TaskType.Trump).ToArray();
foreach (StoryTaskInfo taskInfo in storyTaskArray)
{
UserItemHelper.UseUserItem(ContextUser.UserID, taskInfo.TargetItemID, taskInfo.TargetItemNum);
}
userTrump = new UserTrump(ContextUser.UserID, TrumpInfo.CurrTrumpID);
userTrump.TrumpLv = 1;
userTrump.WorshipLv = 1;
userTrump.LiftNum = trumpInfo.MaxLift;
userTrump.Experience = 0;
userTrump.MatureNum = trumpInfo.BeseMature;
userTrump.Zodiac = TrumpHelper.GetZodiacType(ZodiacType.NoZodiac);
//userTrump.SkillInfo = new List<SkillInfo>();
//userTrump.PropertyInfo = new List<GeneralProperty>();
cacheTrump.Add(userTrump);
cacheTrump.Update();
}
var cacheSet = new GameDataCacheSet<UserFunction>();
UserFunction userFunction = cacheSet.FindKey(ContextUser.UserID, FunctionEnum.TrumpPractice);
if (userFunction == null)
{
UserFunction function = new UserFunction()
{
FunEnum = FunctionEnum.TrumpPractice,
UserID = ContextUser.UserID,
CreateDate = DateTime.Now,
};
cacheSet.Add(function);
cacheSet.Update();
}
var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
if (userTrump.LiftNum > 0 && usergeneral != null)
{
usergeneral.RefreshMaxLife();
}
return true;
}
示例5: CreateRole
private GameUser CreateRole()
{
GameUser user = new GameUser(UserId);
user.SessionID = Sid;
user.Pid = Pid;
user.HeadIcon = HeadID;
user.RetailId = RetailID;
user.NickName = UserName;
user.RealName = "";
user.Hobby = "";
user.Profession = "";
user.Sex = Sex.ToBool();
user.UserLv = (short)ConfigEnvSet.GetInt("User.Level", 1);
user.GiftGold = ConfigEnvSet.GetInt("User.GiftGold", 100);
user.GameCoin = ConfigEnvSet.GetInt("User.GameCoin", 1000);
user.VipLv = ConfigEnvSet.GetInt("User.VipLv");
user.UserStatus = UserStatus.Normal;
user.MsgState = true;
user.MobileType = MobileType;
user.ScreenX = ScreenX;
user.ScreenY = ScreenY;
user.ClientAppVersion = ReqAppVersion;
user.LoginDate = DateTime.Now;
user.CreateDate = DateTime.Now;
user.TitleId = 1001;
user.Property.GameId = GameID;
user.Property.ServerId = ServerID;
user.Birthday = new DateTime(1970, 1, 1);
var cacheSet = new GameDataCacheSet<GameUser>();
cacheSet.Add(user);
cacheSet.Update();
//增加初始背包、玩家任务表、玩家成就表
var itemCacheSet = new GameDataCacheSet<UserItemPackage>();
itemCacheSet.Add(new UserItemPackage(UserId));
itemCacheSet.Update();
var taskCacheSet = new GameDataCacheSet<UserTask>();
taskCacheSet.Add(new UserTask(UserId));
taskCacheSet.Update();
var achieveCacheSet = new GameDataCacheSet<UserAchieve>();
achieveCacheSet.Add(new UserAchieve(UserId));
achieveCacheSet.Update();
UserDailyRestrain restrain = new UserDailyRestrain(UserId);
restrain.RefreshDate = DateTime.Now.AddDays(-1);
var restrainCacheSet = new GameDataCacheSet<UserDailyRestrain>();
restrainCacheSet.Add(restrain);
restrainCacheSet.Update();
return user;
}
示例6: HeroDailyRestrain
/// <summary>
/// 英雄副本副本增加挑战次数
/// </summary>
/// <param name="userID"></param>
/// <param name="plotID"></param>
/// <param name="_cityID"></param>
public static void HeroDailyRestrain(string userID, int plotID, int _cityID)
{
var cacheSet = new GameDataCacheSet<UserDailyRestrain>();
UserDailyRestrain userRestrain = cacheSet.FindKey(userID);
if (userRestrain != null)
{
DailyUserExtend userExtend = new DailyUserExtend();
List<HeroPlot> heroList = new List<HeroPlot>();
if (userRestrain.UserExtend != null)
{
userExtend = userRestrain.UserExtend;
if (userRestrain.UserExtend.HeroPlot.Count > 0)
{
heroList = userRestrain.UserExtend.HeroPlot;
}
}
HeroPlot plot = heroList.Find(m => m.CityID.Equals(_cityID));
if (plot != null)
{
plot.HeroList.Add(new FunPlot() { PlotID = plotID });
}
else
{
FunPlot funPlot = new FunPlot();
funPlot.PlotID = plotID;
List<FunPlot> funPlotsList = new List<FunPlot>();
funPlotsList.Add(funPlot);
heroList.Add(new HeroPlot() { CityID = _cityID, HeroNum = 0, HeroList = funPlotsList });
}
userExtend.HeroPlot = heroList;
userRestrain.UserExtend = userExtend;
cacheSet.Update();
}
}
示例7: 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();
}
示例8: TriggerFestivalConsume
/// <summary>
/// 累计消费活动
/// </summary>
public static void TriggerFestivalConsume(string userID, int consumeNum, FestivalType festivalType)
{
FestivalInfo fest = GetInfo(festivalType);
if (fest == null)
{
return;
}
var cacheSet = new GameDataCacheSet<UserConsume>();
UserConsume userConsume = cacheSet.FindKey(userID);
if (userConsume == null)
{
userConsume = new UserConsume();
userConsume.UserID = userID;
userConsume.GameCoin = 0;
userConsume.GoldNum = 0;
userConsume.EnergyNum = 0;
cacheSet.Add(userConsume);
cacheSet.Update();
userConsume = new GameDataCacheSet<UserConsume>().FindKey(userID);
}
//晶石
if (festivalType == FestivalType.SparConsumption)
{
if (userConsume.GoldDate < fest.StartDate)
{
userConsume.GoldDate = fest.StartDate;
userConsume.GoldNum = consumeNum;
}
else
{
userConsume.GoldNum = MathUtils.Addition(userConsume.GoldNum, consumeNum);
}
}
//金币
if (festivalType == FestivalType.GameCoin)
{
if (userConsume.CoinDate < fest.StartDate)
{
userConsume.CoinDate = fest.StartDate;
userConsume.GameCoin = consumeNum;
}
else
{
userConsume.GameCoin = MathUtils.Addition(userConsume.GameCoin, consumeNum);
}
}
//精力
if (festivalType == FestivalType.Energy)
{
if (userConsume.EnergyDate < fest.StartDate)
{
userConsume.EnergyDate = fest.StartDate;
userConsume.EnergyNum = consumeNum;
}
else
{
userConsume.EnergyNum = MathUtils.Addition(userConsume.EnergyNum, consumeNum);
}
}
FestivalInfo[] festivalInfosArray =
new ShareCacheStruct<FestivalInfo>().FindAll(m => m.FestivalType == festivalType).ToArray();
foreach (FestivalInfo festivalInfo in festivalInfosArray)
{
FestivalConsumeCount(festivalInfo, userID);
}
}
示例9: AddCardReward
public static void AddCardReward(string userID, string cardUserID, short userlv)
{
var cacheSet = new GameDataCacheSet<UserCardReward>();
UserCardReward cardReward = new UserCardReward();
cardReward.UserID = userID;
cardReward.CardUserID = cardUserID;
cardReward.UserLv = userlv;
cardReward.CreateDate = DateTime.Now;
cacheSet.Add(cardReward);
cacheSet.Update();
}
示例10: PayAccumulation
/// <summary>
/// 累计消费送礼
/// </summary>
public static void PayAccumulation(string userID, int consumeNum)
{
FestivalInfo fest = GetInfo(FestivalType.PayAccumulation);
if (fest == null)
{
return;
}
var cacheSet = new GameDataCacheSet<UserConsume>();
UserConsume userConsume = cacheSet.FindKey(userID);
if (userConsume == null)
{
userConsume = new UserConsume();
userConsume.UserID = userID;
userConsume.GameCoin = 0;
userConsume.GoldNum = 0;
userConsume.EnergyNum = 0;
cacheSet.Add(userConsume);
cacheSet.Update();
userConsume = new GameDataCacheSet<UserConsume>().FindKey(userID);
}
if (userConsume.GoldDate < fest.StartDate)
{
userConsume.GoldDate = fest.StartDate;
userConsume.GoldNum = consumeNum;
}
else
{
userConsume.GoldNum = MathUtils.Addition(userConsume.GoldNum, consumeNum);
}
var cacheSetRestrain = new GameDataCacheSet<FestivalRestrain>();
var festivalList = new ShareCacheStruct<FestivalInfo>().FindAll(s => s.FestivalType == FestivalType.PayAccumulation);
foreach (var info in festivalList)
{
if (!info.IsStop)
continue;
if (info.StartDate > DateTime.Now)
continue;
if (info.EndDate < DateTime.Now)
continue;
if (info.FestivalType == FestivalType.PayAccumulation)
{
FestivalRestrain fRest = cacheSetRestrain.FindKey(userID, info.FestivalID);
if (fRest != null && userConsume.GoldNum >= info.RestrainNum)
{
AppendFestivalRestrain(userID, fest.FestivalID, fest.RestrainNum);
}
}
}
}
示例11: IsExistGameUser
public override bool IsExistGameUser()
{
var cacheSet = new GameDataCacheSet<GameUser>();
GameUserRef userref = new GameUserRef(_userinfo);
/*首先检测是否是游客账号转正式账号*/
if (0 != _userinfo.UserId)
{
var guestusercache = cacheSet.FindKey(_userinfo.UserId.ToString());
if (null != guestusercache)
{
if (guestusercache.UserType == "guest")
{
guestusercache.UserType = _userinfo.UserType;
guestusercache.UserName = _userinfo.UserName;
cacheSet.Add(guestusercache);
cacheSet.Update();
/*更新索引表*/
userref.UpdateGameUser();
_buserinfo.IsValid = true;
return true;
}
}
}
/*直接通过直接访问数据库的方式查询用户*/
_buserinfo.UserId = userref.GetUserId();
if (0 == _buserinfo.UserId)
{
_buserinfo.UserId = userref.InsertGameUser();
if (0 == _buserinfo.UserId)
{
_buserinfo.IsValid = false;
return false;
}
}
else
{
/*客户端上送的用户信息是错的*/
if ((0 != _userinfo.UserId)
&& (_userinfo.UserId != _buserinfo.UserId))
{
_buserinfo.IsValid = false;
return false;
}
}
/*尝试刷新缓存,并且检测用户是否给的UserID是否正确*/
var usercache = new GameDataCacheSet<GameUser>().FindKey(_buserinfo.UserId.ToString());
if (null != usercache)
{
_buserinfo.IsValid = true;
return true;
}
/*插入新的用户*/
else
{
_buserinfo.IsValid = true;
return false;
}
}
示例12: EnableFunction
private void EnableFunction()
{
string[] funList = ConfigEnvSet.GetString("User.DefaultFunction").Split(new[] { ',' });
var cacheSet = new GameDataCacheSet<UserFunction>();
foreach (string fun in funList)
{
if (fun.TrimEnd().Length > 0)
{
UserFunction userFun = new UserFunction();
userFun.UserID = Uid;
userFun.FunEnum = fun.ToEnum<FunctionEnum>();
userFun.CreateDate = DateTime.Now;
cacheSet.Add(userFun);
cacheSet.Update();
}
}
}
示例13: CreateMagic
private void CreateMagic(GameUser userEntity)
{
UserMagic userMagic = new UserMagic
{
UserID = userEntity.UserID,
IsEnabled = true,
MagicID = new GameUser().UserMagicID,
MagicLv = 1,
MagicType = MagicType.MoFaZhen
};
var cacheUserMagic = new GameDataCacheSet<UserMagic>();
cacheUserMagic.Add(userMagic);
cacheUserMagic.Update();
//初始阵法
string[] gridRange = new ConfigCacheSet<MagicLvInfo>().FindKey(userMagic.MagicID, userMagic.MagicLv).GridRange.Split(new char[] { ',' });
if (gridRange.Length > 0)
{
string grid = gridRange[0];
UserEmbattle userEmbattle = new UserEmbattle
{
UserID = userEntity.UserID,
GeneralID = generalID,
MagicID = userMagic.MagicID,
Position = grid.ToShort()
};
var cacheEmbattle = new GameDataCacheSet<UserEmbattle>();
cacheEmbattle.Add(userEmbattle);
cacheEmbattle.Update();
}
}
示例14: CreateGeneral
private void CreateGeneral(CareerInfo careerInfo)
{
GeneralInfo general = new ConfigCacheSet<GeneralInfo>().FindKey(generalID);
List<UserGeneral> userGeneralArray = new GameDataCacheSet<UserGeneral>().FindAll(Uid);
if (userGeneralArray.Count > 0 || general == null)
{
return;
}
UserGeneral userGeneral = new UserGeneral();
userGeneral.UserID = Uid;
userGeneral.GeneralID = general.GeneralID;
userGeneral.GeneralName = general.GeneralName;
userGeneral.HeadID = general.HeadID;
userGeneral.PicturesID = general.PicturesID;
userGeneral.GeneralLv = (short)careerInfo.Lv;
userGeneral.GeneralType = GeneralType.YongHu;
userGeneral.CareerID = _careerID;
userGeneral.PowerNum = general.PowerNum;
userGeneral.SoulNum = general.SoulNum;
userGeneral.IntellectNum = general.IntellectNum;
userGeneral.TrainingPower = 0;
userGeneral.TrainingSoul = 0;
userGeneral.TrainingIntellect = 0;
userGeneral.AbilityID = general.AbilityID;
userGeneral.Momentum = 0;
userGeneral.Description = string.Empty;
userGeneral.HitProbability = ConfigEnvSet.GetDecimal("Combat.HitiNum");
userGeneral.GeneralStatus = GeneralStatus.DuiWuZhong;
userGeneral.CurrExperience = 0;
userGeneral.Experience1 = 0;
userGeneral.Experience2 = 0;
//userGeneral.LifeNum = MathUtils.Addition(general.LifeNum, careerInfo.LifeIncreaseNum * (MathUtils.Subtraction(careerInfo.Lv, (short)1, (short)0)), int.MaxValue);
userGeneral.RefreshMaxLife();
userGeneral.HeritageType = HeritageType.Normal;
userGeneral.AbilityNum = 3;
var cacheSet = new GameDataCacheSet<UserGeneral>();
cacheSet.Add(userGeneral);
cacheSet.Update();
UserAbilityHelper.AddUserAbility(general.AbilityID, Uid.ToInt(), generalID, 1);
}
示例15: CreateGameUser
private GameUser CreateGameUser(bool userSex)
{
GameUser userEntity = new GameUser
{
UserID = Uid,
CountryID = 0,
CityID = ConfigEnvSet.GetInt("user.UserMinCityID"),
PointX = (short)ConfigEnvSet.GetInt("User.CityPointX"),
PointY = (short)ConfigEnvSet.GetInt("User.CityPointY"),
SessionID = Sid,
NickName = UserName,
Sex = userSex,
UserLv = (short)ConfigEnvSet.GetInt("User.Level"),
ObtainNum = ConfigEnvSet.GetInt("User.ObtainNum"),
EnergyNum = new GameUser().EnergyMaxNum,
MercenariesID = string.Empty,
GiftGold = ConfigEnvSet.GetInt("User.GiftGold"),
PayGold = 0,
UseGold = 0,
ItemGold = 0,
GameCoin = ConfigEnvSet.GetInt("User.GameCoin"),
ExpNum = 0,
VipLv = ConfigEnvSet.GetInt("User.VipLv"),
UserStatus = UserStatus.Normal,
MsgState = true,
GridNum = new GameUser().GridMinNum,
WarehouseNum = new GameUser().WarehouseMinNum,
QueueNum = 0,
RetailID = RetailID,
Pid = Pid,
MobileType = MobileType,
ScreenX = ScreenX,
ScreenY = ScreenY,
ClientAppVersion = ReqAppVersion,
CreateDate = DateTime.Now,
UseMagicID = new GameUser().UserMagicID,
CrystalNum = new GameUser().CrystalMinNum,
UserLocation = Location.City,
UserExtend = new GameUserExtend(),
SweepPool = new SweepPoolInfo(),
GameId = GameID,
ServerId = ServerID,
LoginTime = DateTime.Now,
DailyLoginTime = DateTime.Now
};
var cacheSet = new GameDataCacheSet<GameUser>();
cacheSet.Add(userEntity);
cacheSet.Update();
//增加初始背包、灵件、水晶
new GameDataCacheSet<UserItemPackage>().Add(new UserItemPackage { UserID = userEntity.UserID });
new GameDataCacheSet<UserCrystalPackage>().Add(new UserCrystalPackage() { UserID = userEntity.UserID });
new GameDataCacheSet<UserSparePackage>().Add(new UserSparePackage() { UserID = userEntity.UserID });
//增加初始附魔符
new GameDataCacheSet<UserEnchant>().Add(new UserEnchant(userEntity.UserID));
//增加初始副本
new GameDataCacheSet<UserPlotPackage>().Add(new UserPlotPackage(userEntity.UserID));
// 增加初始集邮册
new GameDataCacheSet<UserAlbum>().Add(new UserAlbum(userEntity.UserID));
// 玩家圣吉塔
new GameDataCacheSet<UserShengJiTa>().Add(new UserShengJiTa(userEntity.UserID.ToInt()));
return userEntity;
}