/// <summary> /// 随机一个技能 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static AbilityInfo GetRandomAbility(string userID) { AbilityInfo changeAbility = new AbilityInfo(); int abilityStyle = 1; var abilityInfoList = new ShareCacheStruct <AbilityInfo>().FindAll(m => m.AbilityStyle == abilityStyle); if (abilityInfoList.Count > 0) { UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.SkillInfo.Count > 0) { foreach (SkillInfo info in userTrump.SkillInfo) { AbilityInfo abilityInfo = new ShareCacheStruct <AbilityInfo>().FindKey(info.AbilityID); if (abilityInfo != null) { abilityInfoList.Remove(abilityInfo); } } } int randomNum = RandomUtils.GetRandom(0, abilityInfoList.Count); changeAbility = abilityInfoList[randomNum]; } return(changeAbility); }
/// <summary> /// 随机一个技能 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static AbilityInfo GetRandomAbility(string userID) { AbilityInfo changeAbility = new AbilityInfo(); int abilityStyle = 1; var abilityInfoList = new ShareCacheStruct<AbilityInfo>().FindAll(m => m.AbilityStyle == abilityStyle); if (abilityInfoList.Count > 0) { UserTrump userTrump = new PersonalCacheStruct<UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID); if (userTrump != null && userTrump.SkillInfo.Count > 0) { foreach (SkillInfo info in userTrump.SkillInfo) { AbilityInfo abilityInfo = new ShareCacheStruct<AbilityInfo>().FindKey(info.AbilityID); if (abilityInfo != null) { abilityInfoList.Remove(abilityInfo); } } } int randomNum = RandomUtils.GetRandom(0, abilityInfoList.Count); changeAbility = abilityInfoList[randomNum]; } return changeAbility; }