示例#1
0
        private static GUISkin CreateSkin()
        {
            var newSkin = Object.Instantiate(GUI.skin);

            Object.DontDestroyOnLoad(newSkin);

            // Load the custom skin from resources
            var texData = ResourceUtils.GetEmbeddedResource("guisharp-box.png");

            _boxBackground = UnityFeatureHelper.LoadTexture(texData);
            Object.DontDestroyOnLoad(_boxBackground);
            newSkin.box.onNormal.background = null;
            newSkin.box.normal.background   = _boxBackground;
            newSkin.box.normal.textColor    = Color.white;

            texData        = ResourceUtils.GetEmbeddedResource("guisharp-window.png");
            _winBackground = UnityFeatureHelper.LoadTexture(texData);
            Object.DontDestroyOnLoad(_winBackground);
            newSkin.window.onNormal.background = null;
            newSkin.window.normal.background   = _winBackground;
            newSkin.window.padding             = new RectOffset(6, 6, 22, 6);
            newSkin.window.border           = new RectOffset(10, 10, 20, 10);
            newSkin.window.normal.textColor = Color.white;

            newSkin.button.padding          = new RectOffset(4, 4, 3, 3);
            newSkin.button.normal.textColor = Color.white;

            newSkin.textField.normal.textColor = Color.white;

            newSkin.label.normal.textColor = Color.white;

            return(newSkin);
        }
        private static GUISkin CreateSkin()
        {
            // Reflection because unity 4.x refuses to instantiate if built with newer versions of UnityEngine
            var newSkin = typeof(Object).GetMethod("Instantiate", BindingFlags.Static | BindingFlags.Public, null, new [] { typeof(Object) }, null).Invoke(null, new object[] { GUI.skin }) as GUISkin;

            Object.DontDestroyOnLoad(newSkin);

            // Load the custom skin from resources
            var texData = ResourceUtils.GetEmbeddedResource("guisharp-box.png");

            _boxBackground = UnityFeatureHelper.LoadTexture(texData);
            Object.DontDestroyOnLoad(_boxBackground);
            newSkin.box.onNormal.background = null;
            newSkin.box.normal.background   = _boxBackground;
            newSkin.box.normal.textColor    = Color.white;

            texData        = ResourceUtils.GetEmbeddedResource("guisharp-window.png");
            _winBackground = UnityFeatureHelper.LoadTexture(texData);
            Object.DontDestroyOnLoad(_winBackground);
            newSkin.window.onNormal.background = null;
            newSkin.window.normal.background   = _winBackground;
            newSkin.window.padding             = new RectOffset(6, 6, 22, 6);
            newSkin.window.border           = new RectOffset(10, 10, 20, 10);
            newSkin.window.normal.textColor = Color.white;

            newSkin.button.padding          = new RectOffset(4, 4, 3, 3);
            newSkin.button.normal.textColor = Color.white;

            newSkin.textField.normal.textColor = Color.white;

            newSkin.label.normal.textColor = Color.white;

            return(newSkin);
        }
示例#3
0
        public void Refresh(bool full, Predicate <GameObject> objectFilter)
        {
            if (_searchResults != null)
            {
                return;
            }

            if (_cachedRootGameObjects == null || full)
            {
                _cachedRootGameObjects = FindAllRootGameObjects().OrderBy(x => x.name, StringComparer.InvariantCultureIgnoreCase).ToList();
                full = true;
            }
            else
            {
                _cachedRootGameObjects.RemoveAll(o => o == null);
            }

            if (UnityFeatureHelper.SupportsScenes && !full)
            {
                var newItems = UnityFeatureHelper.GetSceneGameObjects().Except(_cachedRootGameObjects).ToList();
                if (newItems.Count > 0)
                {
                    _cachedRootGameObjects.AddRange(newItems);
                    _cachedRootGameObjects.Sort((o1, o2) => string.Compare(o1.name, o2.name, StringComparison.InvariantCultureIgnoreCase));
                }
            }

            if (objectFilter != null)
            {
                _cachedRootGameObjects.RemoveAll(objectFilter);
            }
        }
示例#4
0
        private void DrawMiscSettings()
        {
            GUILayout.BeginHorizontal(GUI.skin.box);
            {
                if (RuntimeUnityEditorCore.INSTANCE.TreeViewer.SelectedTransform == null)
                {
                    GUI.enabled = false;
                }

                if (GUILayout.Button("Dump", GUILayout.ExpandWidth(false)))
                {
                    SceneDumper.DumpObjects(RuntimeUnityEditorCore.INSTANCE.TreeViewer.SelectedTransform?.gameObject);
                }

                GUI.enabled = true;

                if (GUILayout.Button("Log", GUILayout.ExpandWidth(false)))
                {
                    UnityFeatureHelper.OpenLog();
                }

                GUILayout.FlexibleSpace();

                GUILayout.Label("Time", GUILayout.ExpandWidth(false));

                if (GUILayout.Button(">", GUILayout.ExpandWidth(false)))
                {
                    Time.timeScale = 1;
                }
                if (GUILayout.Button("||", GUILayout.ExpandWidth(false)))
                {
                    Time.timeScale = 0;
                }

                if (float.TryParse(GUILayout.TextField(Time.timeScale.ToString("F2", CultureInfo.InvariantCulture), _setTimeBoxOptions), NumberStyles.Any, CultureInfo.InvariantCulture, out var newVal))
                {
                    Time.timeScale = newVal;
                }

                GUILayout.FlexibleSpace();

                RuntimeUnityEditorCore.INSTANCE.SettingsData.Wireframe = GUILayout.Toggle(RuntimeUnityEditorCore.INSTANCE.SettingsData.Wireframe, "Wireframe");
            }
            GUILayout.EndHorizontal();
        }
            public static bool Prefix(GameObjectSearcher __instance, bool full, Predicate <GameObject> objectFilter)
            {
                if (!disableSort.Value)
                {
                    return(true);
                }
                var _searchResults         = Traverse.Create(__instance).Field("_searchResults").GetValue <List <GameObject> >();
                var _cachedRootGameObjects = Traverse.Create(__instance).Field("_cachedRootGameObjects").GetValue <List <GameObject> >();

                if (_searchResults != null)
                {
                    return(false);
                }
                if (_cachedRootGameObjects == null || full)
                {
                    _cachedRootGameObjects = GameObjectSearcher.FindAllRootGameObjects().ToList();
                    full = true;
                }
                else
                {
                    _cachedRootGameObjects.RemoveAll((GameObject o) => o == null);
                }
                if (UnityFeatureHelper.SupportsScenes && !full)
                {
                    List <GameObject> list = UnityFeatureHelper.GetSceneGameObjects().Except(_cachedRootGameObjects).ToList <GameObject>();
                    if (list.Count > 0)
                    {
                        _cachedRootGameObjects.AddRange(list);
                    }
                }
                if (objectFilter != null)
                {
                    _cachedRootGameObjects.RemoveAll(objectFilter);
                }
                Traverse.Create(__instance).Field("_cachedRootGameObjects").SetValue(_cachedRootGameObjects);
                return(false);
            }