Esempio n. 1
0
 /// <summary>
 /// 增加实体Key
 /// </summary>
 /// <param name="indexValue"></param>
 internal void Add(string indexValue)
 {
     if (!_indexHashSet.Contains(indexValue))
     {
         _indexHashSet.Add(indexValue);
     }
 }
Esempio n. 2
0
 public static void AddExprerience(GameUser user, int experience)
 {
     string userID = user.UserID;
     var userEmbattleList = new GameDataCacheSet<UserEmbattle>().FindAll(userID, m => m.MagicID == user.UseMagicID);
     THashSet<int> generalHash = new THashSet<int>();
     foreach (UserEmbattle userEmbattle in userEmbattleList)
     {
         //wuzf 8-18 修复多个相同佣兵阵形数据
         if (generalHash.Contains(userEmbattle.GeneralID))
         {
             userEmbattle.GeneralID = 0;
             //userEmbattle.Update();
             continue;
         }
         else
         {
             generalHash.Add(userEmbattle.GeneralID);
         }
         //UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(userID, userEmbattle.GeneralID);
         //if (userGeneral != null)
         //{
         //    userGeneral.CurrExperience = MathUtils.Addition(userGeneral.CurrExperience, experience);
         //}
     }
     //UserHelper.UserGeneralExp(user.UserID, experience);
 }
Esempio n. 3
0
        public void THashSet_Equals_Primitive_Test()
        {
            const int value = 1;

            var hashSet = new THashSet <int> {
                value
            };

            Assert.IsTrue(hashSet.Contains(value));

            hashSet.Remove(value);

            Assert.IsTrue(hashSet.Count == 0);

            hashSet.Add(value);

            Assert.IsTrue(hashSet.Contains(value));

            hashSet.Clear();

            Assert.IsTrue(hashSet.Count == 0);

            var newArr = new int[1];

            hashSet.Add(value);
            hashSet.CopyTo(newArr, 0);

            Assert.IsTrue(newArr.Contains(value));

            var en = hashSet.GetEnumerator();

            en.MoveNext();

            Assert.IsTrue((int)en.Current == value);

            using (var ien = ((IEnumerable <int>)hashSet).GetEnumerator())
            {
                ien.MoveNext();

                Assert.IsTrue(ien.Current == value);
            }
        }