本文整理汇总了C#中GameDataCacheSet.GetDailyItem方法的典型用法代码示例。如果您正苦于以下问题:C# GameDataCacheSet.GetDailyItem方法的具体用法?C# GameDataCacheSet.GetDailyItem怎么用?C# GameDataCacheSet.GetDailyItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameDataCacheSet
的用法示例。
在下文中一共展示了GameDataCacheSet.GetDailyItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TakeAction
//.........这里部分代码省略.........
else if (ops == 5)
{
if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.DailyRenWuZhiJieWanCheng))
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion;
return false;
}
this.ErrorInfo = string.Format(LanguageManager.GetLang().St3005_CompletedUseGold, completedUseGold);
return false;
}
else if (ops == 6)
{
if (ContextUser.GoldNum < completedUseGold)
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
return false;
}
List<UserTask> taskArray = new GameDataCacheSet<UserTask>().FindAll(ContextUser.UserID, u => u.TaskState == TaskState.Taked && u.TaskType == TaskType.Daily);
if (taskArray.Count > 0)
{
UserTask userTask = taskArray[0];
DailyTaskInfo dtaskInfo = new ConfigCacheSet<DailyTaskInfo>().FindKey(taskArray[0].TaskID);
//交付任务
//奖励
int userExp = ContextUser.ExpNum;
int expNum = userTask.GetDailyExpNum(userLv);
ContextUser.ExpNum = MathUtils.Addition(ContextUser.ExpNum, expNum, int.MaxValue);
//ContextUser.Update();
var userItem = userTask.GetDailyItem(userLv);
if (userItem != null)
{
UserItemHelper.AddUserItem(ContextUser.UserID, userItem.ItemID, userItem.Num);
}
userTask.TaskState = TaskState.Close;
userTask.CompleteNum = MathUtils.Addition(userTask.CompleteNum, 1, int.MaxValue);
//userTask.Update();
//奖励日志
UserTaskLog taskLog = new UserTaskLog()
{
LogID = System.Guid.NewGuid().ToString(),
TaskID = userTask.TaskID,
UserID = userTask.UserID,
TaskType = userTask.TaskType,
TaskState = userTask.TaskState,
TaskPrize = string.Format("ExpNum:{0},item:{1}={2};User expnum:{3}", expNum,
userItem != null ? userItem.ItemID : 0,
userItem != null ? userItem.Num : 0,
userExp
),
CreateDate = DateTime.Now
};
var sender = DataSyncManager.GetDataSender();
sender.Send(taskLog);
//刷新任务
userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask);
ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, completedUseGold, int.MaxValue);
//ContextUser.Update();
}
}