Пример #1
0
    // ==========================================================================================================
    public void OnGUIGizmo()
    {
        Rect     baseRect = FXMakerLayout.GetMenuGizmoRect();
        Rect     boxRect;
        Rect     subRect;
        GUIStyle toolStyle = GUI.skin.GetStyle("GizmoToolbar");
        int      nColCount = 15;

        // -----------------------------------------------------------------------------------------------------------------------------------
        GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 7), new GUIContent(" ", " "));
//		m_nGizmoTypeIndex	= GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 5), m_nGizmoTypeIndex, GetGizmoContents(), 5, toolStyle);
        m_nGizmoTypeIndex = FXMakerLayout.TooltipSelectionGrid(baseRect, FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 5), m_nGizmoTypeIndex, GetGizmoContents(), 5, toolStyle);

        // -----------------------------------------------------------------------------------------------------------------------------------
        boxRect       = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 5, 2);
        subRect       = FXMakerLayout.GetOffsetRect(boxRect, 4, 0, -2, 0);
        m_bWorldSpace = GUI.Toggle(new Rect(subRect.x, subRect.y - 3, subRect.width, subRect.height - 5), m_bWorldSpace, FXMakerTooltip.GetHcEffectGizmo("World"));
        m_bFixedSide  = GUI.Toggle(new Rect(subRect.x, subRect.y + 10, subRect.width, subRect.height - 6), m_bFixedSide, FXMakerTooltip.GetHcEffectGizmo("Fixed-Z"));

        // -----------------------------------------------------------------------------------------------------------------------------------
        boxRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 7, 4);
        boxRect = FXMakerLayout.GetOffsetRect(boxRect, 2, 0, -2, 0);
        GUI.Box(boxRect, new GUIContent(" ", " "));
        subRect   = FXMakerLayout.GetOffsetRect(boxRect, 1, -3, -4, -8);
        m_bGridXY = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 0, 1), m_bGridXY, FXMakerTooltip.GetHcEffectGizmo("XY"));
        m_bGridXZ = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 1, 1), m_bGridXZ, FXMakerTooltip.GetHcEffectGizmo("XZ"));
        m_bGridYZ = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 2, 1), m_bGridYZ, FXMakerTooltip.GetHcEffectGizmo("YZ"));

        subRect       = FXMakerLayout.GetOffsetRect(boxRect, 1, 10, -4, 3);
        m_bBackground = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 1, 0, 1), m_bBackground, FXMakerTooltip.GetHcEffectGizmo("Background"));


        // -----------------------------------------------------------------------------------------------------------------------------------
        boxRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 11, 4);
        GUI.Box(boxRect, new GUIContent(" ", " "));
        subRect = FXMakerLayout.GetOffsetRect(boxRect, 0, 2, 0, -2);
        // Grayscale
        bool bGray = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 0, 1), m_bShowGameObjectOptionGray, FXMakerTooltip.GetHcEffectGizmo("Gray")));

        if (m_bShowGameObjectOptionGray != bGray)
        {
            m_bShowGameObjectOptionGray = bGray;
            UnityEditor.EditorPrefs.SetBool("FXMakerGizmo.m_bShowGameObjectOptionGray", m_bShowGameObjectOptionGray);
            FXMakerMain.inst.ResetCamera();
            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
        }
        // BoundsBox
        bool bBounds = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 1, 1), m_bShowGameObjectOptionBounds, FXMakerTooltip.GetHcEffectGizmo("Box")));

        if (m_bShowGameObjectOptionBounds != bBounds)
        {
            m_bShowGameObjectOptionBounds = bBounds;
            UnityEditor.EditorPrefs.SetBool("FXMakerGizmo.m_bShowGameObjectOptionBounds", m_bShowGameObjectOptionBounds);
            FXMakerHierarchy.inst.ChangeBoundsBoxWireframe(FXMakerHierarchy.inst.GetSelectedGameObject(), FXMakerMain.inst.GetOriginalEffectObject(), true, true);
        }
        // wireframe
        bool bWireframe = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 2, 1), m_bShowGameObjectOptionWireframe, FXMakerTooltip.GetHcEffectGizmo("Wire")));

        if (m_bShowGameObjectOptionWireframe != bWireframe)
        {
            m_bShowGameObjectOptionWireframe = bWireframe;
            UnityEditor.EditorPrefs.SetBool("FXMakerGizmo.m_bShowGameObjectOptionWireframe", m_bShowGameObjectOptionWireframe);
            FXMakerHierarchy.inst.ChangeBoundsBoxWireframe(FXMakerHierarchy.inst.GetSelectedGameObject(), FXMakerMain.inst.GetOriginalEffectObject(), true, true);
        }

        // -----------------------------------------------------------------------------------------------------------------------------------
        if (GUI.changed)
        {
            SetGizmoType(m_nGizmoTypeIndex);

            EditorPrefs.SetBool("FXMakerGizmo.m_bWorldSpace", m_bWorldSpace);
//			EditorPrefs.SetBool("FXMakerGizmo.m_bFixedSide", m_bFixedSide);
            EditorPrefs.SetBool("FXMakerGizmo.m_bGridXY", m_bGridXY);
            EditorPrefs.SetBool("FXMakerGizmo.m_bGridXZ", m_bGridXZ);
            EditorPrefs.SetBool("FXMakerGizmo.m_bGridYZ", m_bGridYZ);
            EditorPrefs.SetBool("FXMakerGizmo.m_bBackground", m_bBackground);

            UpdateGrid(true);
            FXMakerBackground.inst.UpdateBackground();
        }

//          DrawGuiGizmo();

        FXMakerMain.inst.SaveTooltip();
    }