コード例 #1
0
        public void StopEffectSound(string name, int type)
        {
            if (name != null && name.IndexOf('.') < 0)
            {
                name = string.Format("{0}.ogg", name);
            }

            var key = GetAudioClipPath(name, type);

            if (sounds.ContainsKey(key))
            {
                var sound = sounds[key] as AudioData;
                sound.Stop();
            }
        }
コード例 #2
0
        public static void TestReplace()
        {
            var cache = new LFUCache <string, int>(4, 0.5f);

            cache.Add("a", 1);
            cache.Add("b", 2);
            cache.Add("c", 3);

            int x = default;

            x = cache["a"];
            x = cache["a"];
            x = cache["b"];

            cache.Add("d", 4);

            cache.Add("e", 5);

            Assert.AreEqual(cache["a"], 1, "should get 1");
            Assert.AreEqual(cache["b"], 2, "should get 0");
            Assert.IsFalse(cache.ContainsKey("c"));
            Assert.IsFalse(cache.ContainsKey("d"));
            Assert.AreEqual(cache["e"], 5, "should get 5");
        }