예제 #1
0
        private void DrawFirstToolbar()
        {
            //选项
            GUILayout.Space(1);
            Rect rect = GUILayoutUtility.GetRect(0f, ToolbarHeight, SirenixGUIStyles.ToolbarBackground);

            rect = rect.SetHeight(ToolbarHeight);
            var  opptionWidth = SirenixGUIStyles.LeftAlignedCenteredLabel.CalcSize(this.m_optionGui).x * 2f;
            Rect leftRect     = rect.AlignLeft(opptionWidth);

            OdinSelector <int> .DrawSelectorDropdown(leftRect, this.m_optionGui, this.SelectType, btnStyle);

            //搜索
            Rect filterRect = rect.AlignRight(opptionWidth * 2);
            Rect searchRect = rect.SetXMax(filterRect.xMin).SetXMin(opptionWidth);

            searchRect            = searchRect.HorizontalPadding(5f).AlignMiddle(16);
            this.m_sSearchKeyName = SirenixEditorGUI.SearchField(searchRect, this.m_sSearchKeyName);
            //数据类型过滤
            EditorGUI.BeginChangeCheck();
            this.m_eDataFilterType = EnumSelector <EPlayerPrefsType> .DrawEnumField(filterRect, null, new GUIContent("Type Filter"), this.m_eDataFilterType, CaomaoPlayerPrefsWindow.btnStyle);

            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetInt("CaomaoPlayerPrefsWindow.m_eDataFilterType", (int)this.m_eDataFilterType);
            }
        }
예제 #2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        EditorGUILayout.Space();

        var sortingLayerIsEqual = true;
        var sortingOrderIsEqual = true;

        foreach (var meshRenderer in meshRenderers)
        {
            if (meshRenderer.sortingLayerID != firstMeshRenderer.sortingLayerID)
            {
                sortingLayerIsEqual = false;
            }
            if (meshRenderer.sortingOrder != firstMeshRenderer.sortingOrder)
            {
                sortingOrderIsEqual = false;
            }
        }

        // Sorting Layer
        EditorGUI.showMixedValue = !sortingLayerIsEqual;

        var results = OdinSelector <ValueDropdownItem <int> > .DrawSelectorDropdown(
            new GUIContent("Sorting Layer"),
            firstMeshRenderer.sortingLayerName,
            DoSelector
            );

        if (results != null)
        {
            var newSortingLayerId = results.First().Value;

            Undo.RecordObjects(meshRenderers, "Change sorting layer");
            foreach (var meshRenderer in meshRenderers)
            {
                meshRenderer.sortingLayerID = newSortingLayerId;
            }
        }


        // Sorting Order
        EditorGUI.BeginChangeCheck();

        EditorGUI.showMixedValue = !sortingOrderIsEqual;
        var newSortingOrder = EditorGUILayout.IntField("Order in Layer", firstMeshRenderer.sortingOrder);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObjects(meshRenderers, "Change sorting order");
            foreach (var meshRenderer in meshRenderers)
            {
                meshRenderer.sortingOrder = newSortingOrder;
            }
        }
    }
예제 #3
0
    protected override void DrawPropertyLayout(GUIContent label)
    {
        if (this.eventPathResolver.HasError)
        {
            this.eventPathResolver.DrawError();
        }
        else
        {
            GUILayout.BeginHorizontal();

            var width = 15f;
            if (label != null)
            {
                width += GUIHelper.BetterLabelWidth;
            }

            var results = OdinSelector <string> .DrawSelectorDropdown(label ?? GUIContent.none, GUIContent.none,
                                                                      CreateSelector, GUIStyle.none, GUILayoutOptions.Width(width));

            if (results != null)
            {
                ValueEntry.SmartValue = results.First();
            }

            if (Event.current.type == EventType.Repaint)
            {
                var position = GUILayoutUtility.GetLastRect().AlignRight(15f);
                position.y += 4f;
                SirenixGUIStyles.PaneOptions.Draw(position, GUIContent.none, 0);
            }

            GUILayout.BeginVertical();
            CallNextDrawer(null);
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();
        }
    }