本文整理汇总了C#中ShareCacheStruct.CheckCareer方法的典型用法代码示例。如果您正苦于以下问题:C# ShareCacheStruct.CheckCareer方法的具体用法?C# ShareCacheStruct.CheckCareer怎么用?C# ShareCacheStruct.CheckCareer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShareCacheStruct
的用法示例。
在下文中一共展示了ShareCacheStruct.CheckCareer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNoviceActivities
/// <summary>
/// 新手礼包
/// </summary>
/// <param name="user"></param>
/// <param name="item"></param>
/// <param name="noviceActivities"></param>
/// <returns></returns>
public static bool GetNoviceActivities(GameUser user, UserItemInfo item, NoviceActivities noviceActivities)
{
List<NoviceReward> noviceArray = noviceActivities.Reward.ToList();
var package = UserItemPackage.Get(user.UserID);
var userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus == ItemStatus.BeiBao);
int subPackNum = MathUtils.Subtraction(user.GridNum, MathUtils.Subtraction(userItemArray.Count, 5, 0), 0);
if (noviceArray.Count > subPackNum)
{
return false;
}
bool isupdate = false;
foreach (NoviceReward reward in noviceArray)
{
if (reward.Type == 1)
{
isupdate = true;
user.EnergyNum = MathUtils.Addition(user.EnergyNum, (short)reward.Num, short.MaxValue);
}
if (reward.Type == 2)
{
isupdate = true;
user.GameCoin = MathUtils.Addition(user.GameCoin, reward.Num, int.MaxValue);
}
else if (reward.Type == 3)
{
ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(reward.Reward);
UserGeneral userGeneral = UserGeneral.GetMainGeneral(user.UserID);
if (itemInfo.ItemType == ItemType.ZhuangBei && !itemInfo.CheckCareer(userGeneral.CareerID))
{
continue;
}
UserItemHelper.AddUserItem(user.UserID, itemInfo.ItemID, reward.Num);
}
else if (reward.Type == 4)
{
//晶石
isupdate = true;
user.GiftGold = MathUtils.Addition(user.GiftGold, reward.Num, int.MaxValue);
}
}
UserItemHelper.UseUserItem(user.UserID, item.ItemID, 1);
if (isupdate)
{
//user.Update();
}
if (item.ItemID == 5000 || item.ItemID == 5001 ||
item.ItemID == 5002 || item.ItemID == 5003)
{
int itemID = MathUtils.Addition(item.ItemID, 1, int.MaxValue);
UserItemHelper.AddUserItem(user.UserID, itemID, 1);
}
return true;
}