public static void FindSpriteNamesInAllScene()
    {
        ListDictionary<string, string> spriteNames = new ListDictionary<string, string>();

        string[] scenes = (from scene in EditorBuildSettings.scenes where scene.enabled select scene.path).ToArray();
        foreach (string scene in scenes)
        {
            EditorApplication.OpenScene(scene);

            Transform[] allTrnasforms = GameObject.FindObjectsOfType<Transform>();
            foreach (Transform transform in allTrnasforms)
            {
                UISprite sprite = transform.GetComponent<UISprite>();
                if (sprite != null && !spriteNames.ContainsValue(scene, sprite.spriteName))
                    spriteNames.Add(scene, sprite.spriteName);
            }
        }

        string log = string.Empty;
        foreach (string scene in scenes)
        {
            if (!spriteNames.ContainsKey(scene))
                continue;

            log += string.Format("Scene : {0}\n", scene);

            string spriteNameInScene = string.Empty;
            foreach (string spriteName in spriteNames[scene])
                spriteNameInScene += string.Format("{0}\n", spriteName);

            log += string.Format("{0}\n\n", spriteNameInScene);
        }

        Debug.LogWarning(log);
    }
示例#2
0
        public void CanAskContainsValueInAnyList()
        {
            object obj = new object();

            list.Add("foo", new object());
            list.Add("bar", new object());
            list.Add("baz", obj);

            bool contains = list.ContainsValue(obj);

            Assert.IsTrue(contains);
        }
示例#3
0
        public void ShouldReturnFalseWhenDictionaryDoesNotContainRequestedValue()
        {
            ListDictionary <string, int> dict = new ListDictionary <string, int>();

            dict.Add("a", 1);
            dict.Add("a", 1);
            dict.Add("a", 2);
            dict.Add("b", 3);
            dict.Add("b", 5);
            dict.Add("b", 8);

            Assert.IsFalse(dict.ContainsValue(13));
        }
示例#4
0
        public void ShouldReturnTrueWhenDictionaryContainsRequestedValue()
        {
            ListDictionary <string, int> dict = new ListDictionary <string, int>();

            dict.Add("a", 1);
            dict.Add("a", 1);
            dict.Add("a", 2);
            dict.Add("b", 3);
            dict.Add("b", 5);
            dict.Add("b", 8);

            Assert.IsTrue(dict.ContainsValue(3));
        }