示例#1
0
文件: Field.cs 项目: kimollG/anthill
 private void RemoveDead()
 {
     Ants.RemoveAll(x => x.Hp <= 0);
     Pests.RemoveAll(x => x.Hp <= 0);
     Foods.RemoveAll(x => x.Hp <= 0);
     OpenFoods.RemoveAll(x => x.Hp <= 0);
 }
示例#2
0
 public UserProfile UpdateFoods(List <long> foodIds)
 {
     if (!foodIds.IsNullOrZero())
     {
         if (Foods.IsNullOrZero())
         {
             Foods = new List <UserFood>();
         }
         Foods.RemoveAll(p => !foodIds.Contains(p.Id));
         var _foods = Foods;
         foodIds.ForEach(item =>
         {
             try
             {
                 var result = _foods.Where(p => p.Id == item).FirstOrDefault();
                 if (result.IsNull())
                 {
                     Foods.Add(new UserFood().Create(item, Id));
                 }
             }
             catch (Exception e)
             {
                 throw e;
             }
         });
     }
     else
     {
         Foods.Clear();
     }
     return(this);
 }