Exemple #1
0
        public void RefreshScreen()
        {
            var window = this;

            if (window.compiled == true)
            {
                var list = new List <WindowItem>();

                var _path = string.Format("{0}/Screens", window.compiledDirectory.Trim('/'));
                if (Directory.Exists(_path) == true)
                {
                    var files = UnityEditor.AssetDatabase.FindAssets("t:GameObject", new string[] { _path });
                    foreach (var file in files)
                    {
                        var path = UnityEditor.AssetDatabase.GUIDToAssetPath(file);
                        var go   = UnityEditor.AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
                        if (go != null)
                        {
                            var screen = go.GetComponent <WindowBase>();
                            if (screen != null)
                            {
                                var item = new WindowItem();
                                item.window = screen;
                                item.Validate();
                                list.Add(item);
                            }
                        }
                    }
                }

                window.SetScreens(list);
            }
            else
            {
                this.screens        = new WindowItem[0];
                this.runtimeScreens = new List <WindowItem>();
            }
        }