FindObjectsOfTypeAll() public static method

public static FindObjectsOfTypeAll ( Type type ) : Object[]
type System.Type
return Object[]
 void CloseAllWindows()
 {
     foreach (var window in Resources.FindObjectsOfTypeAll <ContentWindow>())
     {
         if (window && null != window)
         {
             window.Close();
         }
     }
 }
        public IEnumerator ContentProvider_WhenGivenNullContent_Exits()
        {
            var content = new NullContent();

            LogAssert.Expect(LogType.Error, "SelectionUtilityTests.NullContent: Releasing content named 'Null' because it returned null value.");
            SelectionUtility.ShowInWindow(content);
            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            Assert.That(Resources.FindObjectsOfTypeAll <ContentWindow>().Any(), Is.False);
        }
        public IEnumerator ContentProvider_WhenContentThrows_Exits()
        {
            var content = new ExceptionContent();

            LogAssert.Expect(LogType.Error, "SelectionUtilityTests.ExceptionContent: Releasing content named 'Exception' because it threw an exception.");
            LogAssert.Expect(LogType.Exception, "Exception: Why are you doing this?");
            SelectionUtility.ShowInWindow(content);
            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            Assert.That(Resources.FindObjectsOfTypeAll <ContentWindow>().Any(), Is.False);
        }
        public IEnumerator ShowingContent_InInspectorWindow_CanControlLifecycle()
        {
            Selection.activeObject = null;
            yield return(null);

            var content = new LifecycleContent();

            content.Status = ContentStatus.ContentNotReady;
            SelectionUtility.ShowInInspector(content);
            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            var editor = Resources.FindObjectsOfTypeAll <InspectorContentEditor>().FirstOrDefault();

            Assert.That(editor && null != editor, Is.EqualTo(true));
            var element = editor.Target.Root.Q <Element <LifecycleContent> >();

            Assert.That(element, Is.Null);
            yield return(null);

            element = editor.Target.Root.Q <Element <LifecycleContent> >();
            Assert.That(element, Is.Null);

            content.Status = ContentStatus.ContentReady;

            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            element = editor.Target.Root.Q <Element <LifecycleContent> >();
            Assert.That(element, Is.Not.Null);

            content.Status = ContentStatus.ContentNotReady;
            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            element = editor.Target.Root.Q <Element <LifecycleContent> >();
            Assert.That(element, Is.Null);

            content.Status = ContentStatus.ContentUnavailable;
            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            Assert.That(editor && null != editor, Is.EqualTo(false));
        }
コード例 #5
0
    private System.Collections.IEnumerator setAllowChange()
    {
        foreach (UiText txt in Res.FindObjectsOfTypeAll <UiText>())
        {
            if (!txt.gameObject.activeSelf)
            {
                txt.gameObject.SetActive(true);
                System.Array.Resize(ref this.blink, this.blink.Length + 1);
                this.blink[this.blink.Length - 1] = txt;
            }
        }

        yield return(new UnityEngine.WaitForSeconds(1));

        this.allowChange = true;
    }
コード例 #6
0
        public static void HSceneSprite_SetLightInfo_CreateButtons(HSceneSprite __instance)
        {
            sprite = __instance;

            if (created)
            {
                return;
            }

            var UI = GameObject.Find("UI");

            if (UI == null)
            {
                return;
            }

            var back = UI.transform.Find("Light/back");

            if (back == null)
            {
                return;
            }

            var orig = UI.transform.Find("Light/SubLight");

            if (orig == null)
            {
                return;
            }

            toggles = new List <Toggle>();

            lights      = Resources.FindObjectsOfTypeAll <Light>();
            resolutions = new int[lights.Length];

            for (var i = 0; i < lights.Length; i++)
            {
                resolutions[i] = lights[i] != null ? lights[i].shadowCustomResolution : -1;
            }

            foreach (var light in lights)
            {
                var parent = light.transform;

                switch (parent.name)
                {
                case "Directional Light Key":
                    camLightTr = parent;
                    break;

                case "Directional Light Back":
                    backLight = light;
                    break;
                }
            }

            var text = orig.GetComponentInChildren <Text>();

            text.alignment = TextAnchor.MiddleLeft;

            // Make textbox wider and move to the right
            var textRect = text.gameObject.GetComponent <RectTransform>();
            var oldTeMin = textRect.offsetMin;
            var oldTeMax = textRect.offsetMax;

            textRect.offsetMin = new Vector2(128, oldTeMin.y);
            textRect.offsetMax = new Vector2(348, oldTeMax.y);
            textRect.sizeDelta = new Vector2(220, 30);

            var toggleComp = orig.GetComponentInChildren <Toggle>();

            // Move toggle to the left
            var toggleRect = toggleComp.gameObject.GetComponent <RectTransform>();
            var oldToMin   = toggleRect.offsetMin;
            var oldToMax   = toggleRect.offsetMax;

            toggleRect.offsetMin = new Vector2(98, oldToMin.y);
            toggleRect.offsetMax = new Vector2(128, oldToMax.y);
            toggleRect.sizeDelta = new Vector2(30, 30);

            foreach (var toggle in toggleInfo)
            {
                AddBtn(back, orig, toggle.name, toggle.resize, toggle.clickEvent);
            }

            var sub = UI.transform.Find("Light/SubLight");

            if (sub != null)
            {
                auxiliaryLightToggle = sub.GetComponentInChildren <Toggle>();
            }

            if (auxiliaryLightToggle != null)
            {
                auxiliaryLightToggle.isOn = auxiliaryLight.Value;
            }

            created = true;
        }
コード例 #7
0
 public static bool IsOpenedWith(IPackageVersion packageVersion)
 {
     return(Resources.FindObjectsOfTypeAll <ValidationSuiteReportWindow>().Any(window => window.m_PackageVersion == packageVersion));
 }
コード例 #8
0
 public static bool IsOpen()
 {
     return(Resources.FindObjectsOfTypeAll <ValidationSuiteReportWindow>().Any());
 }
コード例 #9
0
 public static Object[] FindObjectsOfTypeAll(Type type)
 {
     return(Resources.FindObjectsOfTypeAll(type));
 }
コード例 #10
0
ファイル: Object.cs プロジェクト: wensincai/Unity5.4
 public static UnityEngine.Object[] FindObjectsOfTypeAll(System.Type type)
 {
     return(Resources.FindObjectsOfTypeAll(type));
 }
コード例 #11
0
 public static T[] FindObjectsOfTypeAll <T>() where T : Object
 {
     return(Resources.ConvertObjects <T>(Resources.FindObjectsOfTypeAll(typeof(T))));
 }
コード例 #12
0
        public static void HSceneSprite_SetLightInfo_CreateButtons(HSceneSprite __instance)
        {
            sprite = __instance;

            created = Content != null;

            if (created)
            {
                for (var i = 0; i < toggleInfo.Count; i++)
                {
                    foreach (var b in btn.Where(b => b.Definition.Key == toggleInfo[i].name))
                    {
                        toggles[i].isOn = b.Value;
                    }
                }

                return;
            }

            oldParents = new GameObject[2];
            newParents = new GameObject[2];

            toggles?.Clear();

            toggles = new List <Toggle>();

            var UI = GameObject.Find("CommonSpace/HSceneUISet");

            var Btn      = UI.transform.Find("Canvas/CanvasGroup/Panel/CoordinatesCard/SortPanel/SortCategory/Name");
            var LightAdj = UI.transform.Find("Canvas/CanvasGroup/LightCategory/BG/LightAdjustment");

            // Lights
            camLightTrs = new Transform[2];
            backLights  = new List <Light>();
            auxLights   = new List <Light>();

            lights      = Resources.FindObjectsOfTypeAll <Light>();
            resolutions = new int[lights.Length];

            for (var i = 0; i < lights.Length; i++)
            {
                resolutions[i] = lights[i] != null ? lights[i].shadowCustomResolution : -1;
            }

            foreach (var light in lights)
            {
                var parent = light.transform;

                switch (parent.name)
                {
                case "Directional Light Key":
                    camLightTrs[0] = parent;
                    break;

                case "Cam Light":
                    camLightTrs[1] = parent;
                    break;

                case "Directional Light Back":
                case "Back Light":
                    backLights.Add(light);
                    break;

                case "Directional Light Fill":
                case "Directional Light Top":
                    auxLights.Add(light);
                    break;
                }
            }

            // Set up panel for new buttons and insert them
            Content = new GameObject("Content", typeof(RectTransform));
            Content.transform.SetParent(LightAdj, false);

            var vlg = Content.AddComponent <VerticalLayoutGroup>();

            vlg.childControlHeight    = false;
            vlg.childControlWidth     = false;
            vlg.childForceExpandWidth = false;
            vlg.enabled = false;

            LightAdj.Find("DirectionHorizontal").SetParent(Content.transform, false);
            LightAdj.Find("DirectionVertical").SetParent(Content.transform, false);
            LightAdj.Find("Power").SetParent(Content.transform, false);

            var ScrollView = new GameObject("ScrollView", typeof(RectTransform));

            ScrollView.transform.SetParent(LightAdj.transform, false);

            var svScrollRect = ScrollView.AddComponent <ScrollRect>();

            var ViewPort = new GameObject("ViewPort", typeof(RectTransform));

            ViewPort.transform.SetParent(ScrollView.transform, false);
            ViewPort.AddComponent <RectMask2D>();

            var vpRectTransform = ViewPort.GetComponent <RectTransform>();

            vpRectTransform.offsetMin = new Vector2(-80, -100);
            vpRectTransform.offsetMax = new Vector2(90, 70);
            vpRectTransform.sizeDelta = new Vector2(170, 170);

            Content.transform.SetParent(ViewPort.transform, false);

            var crt = Content.GetComponent <RectTransform>();

            crt.pivot = new Vector2(0.5f, 1);

            svScrollRect.content           = crt;
            svScrollRect.viewport          = vpRectTransform;
            svScrollRect.horizontal        = false;
            svScrollRect.scrollSensitivity = 40;

            crt.offsetMin = new Vector2(-85, 15);
            crt.offsetMax = new Vector2(85, 15);
            crt.sizeDelta = new Vector2(170, 0);

            foreach (var toggle in toggleInfo)
            {
                AddBtn(Content.transform, Btn, toggle.name, toggle.resize, toggle.clickEvent);
            }

            var csf = Content.AddComponent <ContentSizeFitter>();

            csf.verticalFit = ContentSizeFitter.FitMode.PreferredSize;

            vlg.enabled = true;

            created = true;
        }