示例#1
0
 /// <summary>
 /// 公会技能升级
 /// </summary>
 public static void UpGuildAbilityLv(string guildID, GuildAbility ability)
 {
     var memberArray = new ShareCacheStruct<GuildMember>().FindAll(m => m.GuildID == guildID);
     foreach (GuildMember member in memberArray)
     {
         GameUser user = new GameDataCacheSet<GameUser>().FindKey(member.UserID);
         if (user == null)
         {
             user = UserCacheGlobal.CheckLoadUser(member.UserID);
         }
         if (user != null && !string.IsNullOrEmpty(user.MercenariesID))
         {
             UserGuild guild = new ShareCacheStruct<UserGuild>().FindKey(user.MercenariesID);
             if (guild != null && guild.AbilityInfo.Count > 0)
             {
                 LoadGuildAbility(member.UserID);
                 if (user.PropertyInfo != null && user.PropertyInfo.Count > 0)
                 {
                     GuildAbility guildAbility = user.PropertyInfo.Find(m => m.Type == ability.Type);
                     if (guildAbility != null)
                     {
                         guildAbility.Num = ability.Num;
                     }
                     else
                     {
                         guildAbility = new GuildAbility();
                         guildAbility.Type = ability.Type;
                         guildAbility.Num = ability.Num;
                         user.PropertyInfo.Add(guildAbility);
                     }
                 }
             }
         }
     }
 }
示例#2
0
 /// <summary>
 /// 加载玩家公会技能加成
 /// </summary>
 public static void LoadGuildAbility(string userID)
 {
     GameUser user = new GameDataCacheSet<GameUser>().FindKey(userID);
     if (user == null)
     {
         UserCacheGlobal.LoadOffline(userID);
         user = new GameDataCacheSet<GameUser>().FindKey(userID);
     }
     if (!string.IsNullOrEmpty(user.MercenariesID))
     {
         UserGuild guild = new ShareCacheStruct<UserGuild>().FindKey(user.MercenariesID);
         if (guild != null && guild.AbilityInfo.Count > 0)
         {
             if (user.PropertyInfo.Count == 0)
             {
                 foreach (var guildAbility in guild.AbilityInfo)
                 {
                     GuildAbility ability = new GuildAbility();
                     ability.Type = guildAbility.Type;
                     ability.Num = guildAbility.Num;
                     user.PropertyInfo.Add(ability);
                 }
             }
         }
     }
 }