Ejemplo n.º 1
0
        // private static T[] GetAllInstances<T>() where T : ScriptableObject
        // {
        //     var assets = AssetDatabase.FindAssets("t:" + typeof(T).Name);
        //     var resultAssets = new T[assets.Length];
        //     for (var i = 0; i < assets.Length; i++)
        //     {
        //         var path = AssetDatabase.GUIDToAssetPath(assets[i]);
        //         resultAssets[i] = AssetDatabase.LoadAssetAtPath<T>(path);
        //     }
        //
        //     return resultAssets;
        // }

        #endregion

        #region Render

        private void OnEnable()
        {
            if (_currentWindow == null)
            {
                var type = Type.GetType("UnityEditor.ProjectBrowser,UnityEditor.dll");
                _currentWindow = GetWindow <OpenLoaderWindow>(type);
            }

            if (_settings == null)
            {
                _settings = OpenLoaderSettings.Load();
                _currentWindow.CurrentAccount = _settings.SavedAccounts.Count > 0 ? _settings.SavedAccounts[0] : null;

                _accounts = _settings.savedAccounts;
            }

            if (_icon != null || _currentWindow == null)
            {
                return;
            }
            _icon = EditorGUIUtility.Load(
                $"Assets/Editor/OpenLoader/OpenLoaderIcon{(EditorGUIUtility.isProSkin ? "_d" : "")}.png"
                ) as Texture2D;
            _currentWindow.titleContent = new GUIContent
            {
                text  = "OpenLoader",
                image = _icon
            };
        }
 public OpenLoaderAccountsPopup(OpenLoaderWindow view, float width, List <OpenLoaderAccount> savedAccounts,
                                OpenLoaderAccount currentAccount, int accountsLimit)
 {
     _width          = width;
     _view           = view;
     _savedAccounts  = savedAccounts;
     _currentAccount = currentAccount;
     _accountsLimit  = accountsLimit;
 }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.ObjectField(_loaderView, typeof(GameObject), new GUIContent("Loader View"));
            EditorGUILayout.ObjectField(_eventSystem, typeof(EventSystem), new GUIContent("Event System"));
            EditorGUILayout.PropertyField(_useAssetDatabase, new GUIContent("Use Asset Database"));
            EditorGUILayout.PropertyField(_debug, new GUIContent("Debug Messages"));

            GUILayout.Space(10);

            if (GUILayout.Button("OpenLoader Settings"))
            {
                OpenLoaderWindow.ShowWindow();
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 4
0
        public static void ShowWindow()
        {
            if (_icon == null)
            {
                _icon = EditorGUIUtility.Load(
                    $"Assets/Editor/OpenLoader/OpenLoaderIcon{(EditorGUIUtility.isProSkin ? "_d" : "")}.png"
                    ) as Texture2D;
            }

            if (_currentWindow == null)
            {
                var type = Type.GetType("UnityEditor.ProjectBrowser,UnityEditor.dll");
                _currentWindow = GetWindow <OpenLoaderWindow>(type);
                _currentWindow.titleContent = new GUIContent
                {
                    text  = "OpenLoader",
                    image = _icon
                };

                if (_settings == null)
                {
                    _settings = OpenLoaderSettings.Load();
                    _currentWindow.CurrentAccount = _settings.SavedAccounts.Count > 0
                        ? _settings.SavedAccounts[0]
                        : null;
                }

                _currentWindow.Show();
                // _currentWindow.maximized = true;
            }
            else
            {
                if (_settings == null)
                {
                    _settings = OpenLoaderSettings.Load();
                    _currentWindow.CurrentAccount = _settings.SavedAccounts.Count > 0
                        ? _settings.SavedAccounts[0]
                        : null;
                }

                _currentWindow.Show();
                // _currentWindow.maximized = true;
            }
        }