private static void OpenGettingStarted()
        {
            var assetPath = "Assets/" + SirenixAssetPaths.SirenixPluginPath + "Getting Started With Odin.asset";
            var asset     = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object));

            OdinEditorWindow.InspectObject(asset).position = GUIHelper.GetEditorWindowRect().AlignCenter(632, 743);
        }
Ejemplo n.º 2
0
    public override void OnHeaderGUI()
    {
        if (node == null)
        {
            node = target as NormNode;
        }

        if (node.sourceNorm != null)
        {
            GUILayout.Label(node.sourceNorm.GetType().ToString(), NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
        }
        else
        {
            inspectStuff.Show();
            OdinEditorWindow.InspectObject(inspectStuff, node);
            //window.Repaint();
        }

        if (node == null)
        {
            node = target as NormNode;
        }

        if (node.context == null)
        {
            node.initNode();
            window.Repaint();
        }
    }
    private static void Open()
    {
        OdinEditorWindow _window = GetWindow <BiliBiliiMessageBackEditorWindow>();

        _window.titleContent = new GUIContent("弹幕回复工具");
        _window.position     = GUIHelper.GetEditorWindowRect().AlignCenter(400, 150);
    }
Ejemplo n.º 4
0
    public override void OnHeaderGUI()
    {
        if (node == null)
        {
            node = target as ActNode;
        }

        if (node.sourceAction != null)
        {
            GUILayout.Label(node.sourceAction.name.ToString(), NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
        }
        else
        {
            inspectStuff.Show();
            OdinEditorWindow.InspectObject(inspectStuff, node);
            //window.Repaint();
        }

        if (node == null)
        {
            node = target as ActNode;
        }

        if (node.nodeInFilter == null || node.nodeOutFilter == null)
        {
            node.initNode();
            window.Repaint();
        }
    }
Ejemplo n.º 5
0
 private void InDropDownAutoHeight()
 {
     someObject.menu.AddItem(new GUIContent("dddd"), false, () => Debug.Log("!!!SDSAD") );
     
     var btnRect = GUIHelper.GetCurrentLayoutRect();
     OdinEditorWindow.InspectObjectInDropDown(this.someObject, btnRect, btnRect.width);
 }
            private void OpenObject()
            {
                var obj = this.UnityObject;

                if (obj == null)
                {
                    obj = AssetDatabase.LoadAssetAtPath(this.StringValue, typeof(UnityEngine.Object));
                }

                EditorGUIUtility.PingObject(obj);
                if (obj as ScriptableObject)
                {
                    var window = OdinEditorWindow.InspectObject(obj);
                    window.position = GUIHelper.GetEditorWindowRect().AlignCenter(windowSize.x, windowSize.y);
                }
                else
                {
                    UnityEditorEventUtility.DelayAction(() =>
                    {
                        AssetDatabase.OpenAsset(obj);
                        if (obj as SceneAsset)
                        {
                            UnityEditorEventUtility.DelayAction(() =>
                            {
                                GameObject.FindObjectsOfType <Transform>()
                                .Where(x => x.parent == null && x.childCount > 0)
                                .OrderByDescending(x => x.GetSiblingIndex())
                                .Select(x => x.transform.GetChild(0).gameObject)
                                .ForEach(x => EditorGUIUtility.PingObject(x));
                            });
                        }
                    });
                }
            }
Ejemplo n.º 7
0
    public override void OnHeaderGUI()
    {
        if (node == null)
        {
            node = target as GoalNode;
        }
        if (node.sourceGoal != null)
        {
            GUILayout.Label(node.sourceGoal.GetType().ToString(), NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
        }
        else
        {
            inspectStuff.Show();
            OdinEditorWindow.InspectObject(inspectStuff, node);
        }

        if (node == null)
        {
            node = target as GoalNode;
        }

        if (node.filter == null)
        {
            node.initNode();
            window.Repaint();
        }
        // Debug.Log("in the heeeead");
    }
            private SectionResource DrawResource(SectionResource value, GUIContent label)
            {
                if (GUILayout.Button(value.ButtonName))
                {
                    OdinEditorWindow.InspectObjectInDropDown(value, GUIHelper.GetCurrentLayoutRect(), 370);
                }

                return(value);
            }
Ejemplo n.º 9
0
        private void OtherStuffYouCanDo()
        {
            var window = OdinEditorWindow.InspectObject(this.someObject);

            window.position = GUIHelper.GetEditorWindowRect().AlignCenter(270, 200);
            window.titleContent = new GUIContent("Custom title", EditorIcons.RulerRect.Active);
            window.OnClose += () => Debug.Log("Window Closed");
            window.OnBeginGUI += () => GUILayout.Label("-----------");
            window.OnEndGUI += () => GUILayout.Label("-----------");
        }
Ejemplo n.º 10
0
        public override void DrawCommandGUI()
        {
            serializedObject.Update();

            SetGame t = target as SetGame;

            if (GUILayout.Button("Configure"))
            {
                OdinEditorWindow.InspectObject(t);
            }
            serializedObject.ApplyModifiedProperties();
        }
            private void OpenEditorWindow()
            {
                var type = AssemblyUtilities.GetTypeByCachedFullName(this.StringValue);

                if (type != null)
                {
                    if (type.InheritsFrom <UnityEditor.EditorWindow>())
                    {
                        var window = EditorWindow.GetWindow(type);
                        window.position = GUIHelper.GetEditorWindowRect().AlignCenter(windowSize.x, windowSize.y);
                    }
                    else
                    {
                        var window = OdinEditorWindow.InspectObject(Activator.CreateInstance(type));
                        window.position = GUIHelper.GetEditorWindowRect().AlignCenter(windowSize.x, windowSize.y);
                    }
                }
                else if (File.Exists(this.StringValue))
                {
                    var obj    = AssetDatabase.LoadAssetAtPath(this.StringValue, typeof(UnityEngine.Object));
                    var window = OdinEditorWindow.InspectObject(obj);
                    window.position = GUIHelper.GetEditorWindowRect().AlignCenter(windowSize.x, windowSize.y);
                }
            }
Ejemplo n.º 12
0
    private void DrawModels()
    {
        if (!Application.isPlaying)
        {
            EditorGUILayout.LabelField("Enter Play Mode to view Models.");
            return;
        }

        if (Selection.activeObject == null)
        {
            EditorGUILayout.LabelField("Select a RichMVCContext Root GameObject");
            return;
        }

        GameObject rootGameObject = Selection.activeObject as GameObject;

        if (rootGameObject == null)
        {
            EditorGUILayout.LabelField("Select a RichMVCContext Root GameObject");
            return;
        }

        _inspectedRoot = rootGameObject.GetComponent <RichMVCContextRoot>();
        if (_inspectedRoot == null)
        {
            EditorGUILayout.LabelField("Select a RichMVCContext Root GameObject");
            return;
        }

        SirenixEditorFields.UnityObjectField("Inspecting", _inspectedRoot, typeof(RichMVCContextRoot), true);
        SirenixEditorGUI.DrawThickHorizontalSeperator(5f, 5f, 5f);

        CrossContext context = _inspectedRoot.context as CrossContext;

        EditorGUILayout.Toggle("Context Found", context != null);
        if (context == null)
        {
            return;
        }

        FieldInfo fieldInfo = typeof(CrossContextInjectionBinder).BaseType.GetField("bindings", BindingFlags.Instance | BindingFlags.NonPublic);

        EditorGUILayout.Toggle("Bindings Found", fieldInfo != null);
        if (fieldInfo == null)
        {
            return;
        }

        InjectionBinder injectionBinder = context.injectionBinder as CrossContextInjectionBinder;

        EditorGUILayout.Toggle("InjectionBinder Casted", injectionBinder != null);
        if (injectionBinder == null)
        {
            return;
        }

        SirenixEditorGUI.DrawThickHorizontalSeperator(5f, 5f, 5f);
        SirenixEditorGUI.Title("Bindings", "", TextAlignment.Center, false);
        SirenixEditorGUI.BeginBox();

        object bindings = fieldInfo.GetValue(injectionBinder);
        Dictionary <object, Dictionary <object, IBinding> > bindingDictionaries = (Dictionary <object, Dictionary <object, IBinding> >)bindings;

        if (bindingDictionaries == null)
        {
            return;
        }

        foreach (object mainKey in bindingDictionaries.Keys)
        {
            string typeName;
            if (!(mainKey is Type))
            {
                continue;
            }

            Type mainKeyType = mainKey as Type;

            if (_ignoredTypeList.Contains(mainKeyType))
            {
                continue;
            }

            IBinding binding = injectionBinder.GetBinding(mainKeyType);

            if (binding == null)
            {
                continue;
            }
            SirenixEditorGUI.BeginBox();

            typeName = mainKey.ToString();
            SirenixEditorGUI.Title(mainKeyType.Name, "", TextAlignment.Center, false);

            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            object instance = injectionBinder.GetInstance(mainKeyType);
            if (GUILayout.Button("Inspect", GUILayout.Height(20), GUILayout.Width(80)))
            {
                OdinEditorWindow.InspectObject(instance);
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();

            SirenixEditorGUI.EndBox();
            SirenixEditorGUI.DrawHorizontalLineSeperator(2f, 2f, 2f);
        }
        SirenixEditorGUI.EndBox();
    }
Ejemplo n.º 13
0
 private void InCenter()
 {
     var window = OdinEditorWindow.InspectObject(this.someObject);
     window.position = GUIHelper.GetEditorWindowRect().AlignCenter(270, 200);
 }
Ejemplo n.º 14
0
 private void InDropDown()
 {
     var btnRect = GUIHelper.GetCurrentLayoutRect();
     OdinEditorWindow.InspectObjectInDropDown(this.someObject, btnRect, new Vector2(btnRect.width, 100));
 }
Ejemplo n.º 15
0
 private void InspectObject()
 {
     OdinEditorWindow.InspectObject(this.someObject);
 }
Ejemplo n.º 16
0
    private static void ShowWindow()
    {
        IBLTest window = OdinEditorWindow.GetWindow <IBLTest>();

        window.Show();
    }
        protected override void DrawPropertyLayout(GUIContent label)
        {
            if (!(this.ValueEntry.ValueState == PropertyValueState.NullReference || this.ValueEntry.ValueState == PropertyValueState.ReferenceValueConflict))
            {
                this.CallNextDrawer(label);
                return;
            }

            if (Event.current.type == EventType.Layout)
            {
                this.isBroken = false;
                var count = this.ValueEntry.ValueCount;
                for (int i = 0; i < count; i++)
                {
                    var component = this.ValueEntry.Values[i];

                    if (ComponentIsBroken(component, ref this.realWrapperInstance))
                    {
                        this.isBroken = true;
                        break;
                    }
                }

                if (this.isBroken && autoFix)
                {
                    this.isBroken = false;

                    for (int i = 0; i < this.ValueEntry.ValueCount; i++)
                    {
                        T fixedComponent = null;
                        if (ComponentIsBroken(this.ValueEntry.Values[i], ref fixedComponent) && fixedComponent)
                        {
                            (this.ValueEntry as IValueEntryActualValueSetter <T>).SetActualValue(i, fixedComponent);
                        }
                    }

                    this.ValueEntry.Update();
                }
            }

            if (!this.isBroken)
            {
                this.CallNextDrawer(label);
                return;
            }

            var rect        = EditorGUILayout.GetControlRect(label != null);
            var btnRect     = rect.AlignRight(20);
            var controlRect = rect.SetXMax(btnRect.xMin - 5);

            object newInstance = null;

            EditorGUI.BeginChangeCheck();
            {
                if (this.ValueEntry.BaseValueType.IsInterface)
                {
                    newInstance = SirenixEditorFields.PolymorphicObjectField(controlRect,
                                                                             label,
                                                                             this.realWrapperInstance,
                                                                             this.ValueEntry.BaseValueType,
                                                                             this.allowSceneViewObjects);
                }
                else
                {
                    newInstance = SirenixEditorFields.UnityObjectField(
                        controlRect,
                        label,
                        this.realWrapperInstance,
                        this.ValueEntry.BaseValueType,
                        this.allowSceneViewObjects) as Component;
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.ValueEntry.WeakSmartValue = newInstance;
            }

            if (GUI.Button(btnRect, " ", EditorStyles.miniButton))
            {
                var popup = new FixBrokenUnityObjectWrapperPopup(this.ValueEntry);
                OdinEditorWindow.InspectObjectInDropDown(popup, 300);
            }

            if (Event.current.type == EventType.Repaint)
            {
                GUI.DrawTexture(btnRect, EditorIcons.ConsoleWarnicon, ScaleMode.ScaleToFit);
            }
        }
        private void OnInspectorGUI()
        {
            var title    = new GUIStyle(SirenixGUIStyles.SectionHeaderCentered);
            var subTitle = new GUIStyle(SirenixGUIStyles.SectionHeader);

            title.fontSize    = this.TitleFontSize;
            subTitle.fontSize = this.SubTitleFontSize;

            GUIHelper.RequestRepaint();
            // Draw dark BG
            EditorGUI.DrawRect(GUIHelper.GetCurrentLayoutRect().Expand(5, 5, 4, 20), SirenixGUIStyles.DarkEditorBackground);

            // Draw title
            GUILayout.BeginVertical(new GUIStyle()
            {
                padding = new RectOffset(20, 20, 20, 20)
            });
            if (this.Title != null)
            {
                GUILayout.Label(new GUIContent(this.Title, this.Icon), title);
            }
            GUILayout.EndVertical();

            var padding = new GUIStyle()
            {
                padding = new RectOffset(20, 20, 20, 20)
            };

            foreach (var item in this.Examples)
            {
                if (item.VerticalResources)
                {
                    GUILayout.BeginVertical(padding);
                }
                else
                {
                    GUILayout.BeginHorizontal(padding);
                }
                {
                    // bg
                    EditorGUI.DrawRect(GUIHelper.GetCurrentLayoutRect().Padding(-10, -10, 5, 5), SirenixGUIStyles.BoxBackgroundColor);

                    // Draw texts
                    GUILayout.BeginVertical();
                    {
                        GUILayout.Label(item.Title, subTitle);
                        GUILayout.Label(item.SubTitle, SirenixGUIStyles.MultiLineLabel);
                    }
                    GUILayout.EndVertical();

                    // Draw buttons
                    if (item.VerticalResources)
                    {
                        GUILayout.Space(10);
                        GUILayout.BeginHorizontal();
                    }
                    else
                    {
                        GUILayout.BeginVertical(item.VerticalResources ? GUILayoutOptions.ExpandWidth() : GUILayoutOptions.Width(this.BtnWidth));
                    }
                    {
                        for (int i = 0; i < item.Resources.Count; i++)
                        {
                            if (i != 0 && item.VerticalResources)
                            {
                                GUILayout.FlexibleSpace();
                            }
                            item.Resources[i].Draw();
                        }
                    }
                    if (item.VerticalResources)
                    {
                        GUILayout.EndHorizontal();
                    }
                    else
                    {
                        GUILayout.EndVertical();
                    }
                }
                if (item.VerticalResources)
                {
                    GUILayout.EndVertical();
                }
                else
                {
                    GUILayout.EndHorizontal();
                }
            }

            if (!(GUIHelper.CurrentWindow as OdinEditorWindow))
            {
                GUIHelper.PushColor(Color.green);
                if (GUILayout.Button("Open this in a new window", GUILayoutOptions.Height(30)))
                {
                    OdinEditorWindow.InspectObject(this).position = GUIHelper.GetEditorWindowRect().AlignCenter(570, 700);
                    Selection.objects = new UnityEngine.Object[0];
                }
                GUIHelper.PopColor();
            }

            GUILayout.FlexibleSpace();
        }
 private void OpenEditor()
 {
     OdinEditorWindow.InspectObject(this);
 }
Ejemplo n.º 20
0
        private void InDropDownAutoHeight()
        {
            var btnRect = GUIHelper.GetCurrentLayoutRect();

            OdinEditorWindow.InspectObjectInDropDown(this.someObject, btnRect, btnRect.width);
        }