internal CcNode(Tree tree, BGCc cc) : base(tree)
                {
                    Cc         = cc;
                    descriptor = cc.Descriptor;

                    var editor = UnityEditor.Editor.CreateEditor(cc);

                    if (!(editor is BGCcEditor))
                    {
                        throw new BGCc.CcException("Unable to init an Editor for " + cc.GetType() + ": editor does not extend from BGCcEditor.");
                    }

                    ccEditor = (BGCcEditor)editor;
                    ccEditor.ChangedParent += ChangedParent;
//                    UnityEditor.Editor.CreateCachedEditor(cc, null, ref ccEditor);

                    onSceneGuiMethod = ccEditor.GetType().GetMethod("OnSceneGUI", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

                    enabledTexture    = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGTickYes123);
                    disabledTexture   = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGTickNo123);
                    helpTexture       = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGHelp123);
                    deleteTexture     = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGDelete123);
                    addTexture        = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGAdd123);
                    changeNameTexture = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGCcEditName123);

                    parentType = cc.GetParentClass();
                }
Beispiel #2
0
 public CcData(Type type, bool single, BGCc.CcDescriptor ccDescriptor)
     : this(type, single, ccDescriptor.Name)
 {
     Description = ccDescriptor.Description;
     if (!String.IsNullOrEmpty(ccDescriptor.Image))
     {
         Icon = BGEditorUtility.LoadCcTexture2D(ccDescriptor.Image) ?? noImage;
     }
 }
Beispiel #3
0
 public CcData(Type type, bool single, BGCc.CcDescriptor ccDescriptor)
     : this(type, single, ccDescriptor.Name)
 {
     Description = ccDescriptor.Description;
     if (!string.IsNullOrEmpty(ccDescriptor.Icon))
     {
         var texture = BGPrivateField.Get <BGEditorIcon>(typeof(BGBinaryResources), ccDescriptor.Icon);
         if (texture != null)
         {
             Icon = texture;
         }
     }
     else if (!string.IsNullOrEmpty(ccDescriptor.Image))
     {
         Icon = BGEditorUtility.LoadCcTexture2D(ccDescriptor.Image);
     }
 }
                internal CcNode(Tree tree, BGCc cc) : base(tree)
                {
                    Cc         = cc;
                    descriptor = cc.Descriptor;

                    var editor = UnityEditor.Editor.CreateEditor(cc);

                    if (!(editor is BGCcEditor))
                    {
                        throw new BGCc.CcException("Unable to init an Editor for " + cc.GetType() + ": editor does not extend from BGCcEditor.");
                    }

                    ccEditor = (BGCcEditor)editor;
                    ccEditor.ChangedParent += ChangedParent;
//                    UnityEditor.Editor.CreateCachedEditor(cc, null, ref ccEditor);

                    onSceneGuiMethod = ccEditor.GetType().GetMethod("OnSceneGUI", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

                    parentType = cc.GetParentClass();
                }