コード例 #1
0
        protected virtual void  OnEnable()
        {
            this.autoPublish = NGEditorPrefs.GetBool(SubmissionWindow.AutoPublishKeyPref, this.autoPublish);

            EditorApplication.delayCall += () =>
            {
                this.comments = NGEditorPrefs.GetString(SubmissionWindow.AutoPublishKeyPref + this.assetName, this.comments);
                this.Repaint();
            };
        }
コード例 #2
0
            public void     Draw(Rect r, float viewYMin, float viewYMax)
            {
                float x    = r.x;
                float xMax = r.xMax;

                r.height = Constants.SingleLineHeight;
                r.width  = r.height;

                if (r.yMax > viewYMin)
                {
                    EditorGUI.showMixedValue = this.HasMixedRefs();
                    EditorGUI.BeginChangeCheck();
                    EditorGUI.ToggleLeft(r, string.Empty, this.referenced);
                    if (EditorGUI.EndChangeCheck() == true)
                    {
                        if (this.referenced == true)
                        {
                            this.Unreference();
                        }
                        else
                        {
                            this.Reference();
                        }
                    }
                    r.x += r.width + r.width;

                    EditorGUI.showMixedValue = false;

                    GUI.DrawTexture(r, Folder.folderIcon);
                    r.x    += r.width;
                    r.xMax  = xMax;
                    r.xMin -= r.height + r.height;

                    EditorGUI.BeginChangeCheck();
                    EditorGUI.Foldout(r, this.Open, "     " + this.name, true);
                    if (EditorGUI.EndChangeCheck() == true)
                    {
                        this.Open = !this.open;

                        if (Event.current.alt == true)
                        {
                            Queue <Folder> queue = new Queue <Folder>(128);

                            queue.Enqueue(this);

                            while (queue.Count > 0)
                            {
                                Folder current = queue.Dequeue();

                                for (int i = 0; i < current.folders.Count; i++)
                                {
                                    queue.Enqueue(current.folders[i]);
                                }

                                current.open   = this.open;
                                current.height = -1F;
                                EditorPrefs.SetBool(EmbedAssetsBrowserWindow.Folder.EnableFolderPrefKey + current.GetHierarchyPath(), this.open);
                            }
                        }
                    }
                }
                else
                {
                    r.xMax = xMax;
                }

                if (this.open == true)
                {
                    r.x  = x + 16F;
                    r.y += r.height;

                    for (int i = 0; i < this.folders.Count; i++)
                    {
                        if (this.folders[i].folders.Count == 0 && this.folders[i].files.Count == 0)
                        {
                            continue;
                        }

                        r.height = this.folders[i].GetHeight();
                        this.folders[i].Draw(r, viewYMin, viewYMax);
                        r.y += r.height;
                    }

                    if (r.yMin > viewYMax)
                    {
                        return;
                    }

                    r.height = Constants.SingleLineHeight;

                    for (int i = 0; i < this.files.Count; i++)
                    {
                        if (r.yMax > viewYMin)
                        {
                            EditorGUI.BeginChangeCheck();

                            Texture2D icon = Utility.GetIcon(AssetDatabase.LoadMainAssetAtPath(this.files[i].path));
                            if (icon == null)
                            {
                                icon = InternalEditorUtility.GetIconForFile(this.files[i].path);
                            }
                            r.width = r.height;
                            r.x    += r.width;
                            GUI.DrawTexture(r, icon);
                            r.x -= r.width;

                            EditorGUI.BeginDisabledGroup(!this.files[i].isValid);
                            {
                                r.xMax = xMax;
                                this.files[i].referenced = EditorGUI.ToggleLeft(r, "     " + this.files[i].name, this.files[i].referenced);
                                if (EditorGUI.EndChangeCheck() == true)
                                {
                                    EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath <Object>(this.files[i].path));

                                    if (this.files[i].referenced == false || EmbedAssetsBrowserWindow.CheckEmbeddableFile(this.files[i]) == true)
                                    {
                                        this.Update();
                                    }
                                    else
                                    {
                                        if (NGEditorPrefs.GetBool(Folder.AlertNullAssetPrefKey) == false &&
                                            EditorUtility.DisplayDialog(Constants.PackageTitle, "Asset at \"" + this.files[i].path + "\" contains null assets.\nFix them and reference again.", "OK", "Don't show again") == false)
                                        {
                                            NGEditorPrefs.SetBool(Folder.AlertNullAssetPrefKey, true);
                                        }

                                        this.files[i].referenced = false;
                                    }
                                }
                            }
                            EditorGUI.EndDisabledGroup();
                        }

                        r.y += r.height;

                        if (r.yMin > viewYMax)
                        {
                            return;
                        }
                    }
                }
            }
コード例 #3
0
ファイル: ClassTypeDrawer.cs プロジェクト: Hengle/clapotis
 public ClassTypeDrawer(string path, string label, Type type) : base(path, label, type)
 {
     this.isExpanded = NGEditorPrefs.GetBool(path, this.isExpanded);
 }
コード例 #4
0
 public override void    Load(string path)
 {
     this.value = (bool)NGEditorPrefs.GetBool(path);
 }
コード例 #5
0
 public ScreenshotModuleEditor() : base(ScreenshotModule.ModuleID, ScreenshotModule.Priority, ScreenshotModule.Name)
 {
     this.useJPG         = NGEditorPrefs.GetBool(ScreenshotModuleEditor.UseJPGKeyPref, this.useJPG, true);
     this.useCompression = NGEditorPrefs.GetBool(ScreenshotModuleEditor.UseCompressionKeyPref, this.useCompression, true);
     this.scaleMode      = (ScaleMode)NGEditorPrefs.GetInt(ScreenshotModuleEditor.ScaleModeKeyPref, (int)this.scaleMode, true);
 }