Esempio n. 1
0
        protected override void OnGUI(int id)
        {
            GUILayout.Label("-Rotation");
            using (new HorizontalCenteredScope())
            {
                var originalColour = GUI.backgroundColor;
                GUI.backgroundColor = backgroundRed;
                if (GUILayout.Button(EUI.GetTextureContent("iconX90"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.x += 90;
                }
                if (GUILayout.Button(EUI.GetTextureContent("iconX180"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.x += 180;
                }

                GUI.backgroundColor = backgroundGreen;
                if (GUILayout.Button(EUI.GetTextureContent("iconY90"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.y += 90;
                }
                if (GUILayout.Button(EUI.GetTextureContent("iconY180"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.y += 180;
                }


                GUI.backgroundColor = backgroundBlue;
                if (GUILayout.Button(EUI.GetTextureContent("iconZ90"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.z += 90;
                }
                if (GUILayout.Button(EUI.GetTextureContent("iconZ180"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.z += 180;
                }

                GUI.backgroundColor = originalColour;
            }

            GUILayout.Label("-Position");
            m_positionSelectedSnapping = GUILayout.SelectionGrid(m_positionSelectedSnapping, m_positionOptions, m_positionOptions.Length, EditorStyles.miniButton);
            if (m_positionSelectedSnapping < m_positionOptionValues.Length && m_positionSelectedSnapping > 0)
            {
                m_positionSnapValue = m_positionOptionValues[m_positionSelectedSnapping];
            }
            else
            {
                m_positionSnapValue = EditorGUILayout.FloatField("Custom Value", m_positionSnapValue);
            }

            using (new HorizontalCenteredScope())
            {
                var originalColour = GUI.backgroundColor;
                GUI.backgroundColor = backgroundRed;;

                if (GUILayout.Button(EUI.GetTextContent("+X"), GUILayout.Width(50)))
                {
                    m_positionOffset.x += m_positionSnapValue;
                }

                if (GUILayout.Button(EUI.GetTextContent("-X"), GUILayout.Width(50)))
                {
                    m_positionOffset.x -= m_positionSnapValue;
                }

                GUI.backgroundColor = backgroundGreen;
                if (GUILayout.Button(EUI.GetTextContent("+Y"), GUILayout.Width(50)))
                {
                    m_positionOffset.y += m_positionSnapValue;
                }
                if (GUILayout.Button(EUI.GetTextContent("-Y"), GUILayout.Width(50)))
                {
                    m_positionOffset.y -= m_positionSnapValue;
                }

                GUI.backgroundColor = backgroundBlue;
                if (GUILayout.Button(EUI.GetTextContent("+Z"), GUILayout.Width(50)))
                {
                    m_positionOffset.z += m_positionSnapValue;
                }
                if (GUILayout.Button(EUI.GetTextContent("-Z"), GUILayout.Width(50)))
                {
                    m_positionOffset.z -= m_positionSnapValue;
                }

                GUI.backgroundColor = originalColour;
            }

            GUILayout.Label("-Scale");
            m_scaleSelectedSnapping = GUILayout.SelectionGrid(m_scaleSelectedSnapping, m_scaleOptions, m_scaleOptions.Length, EditorStyles.miniButton);
            if (m_scaleSelectedSnapping < m_scaleOptionValues.Length && m_scaleSelectedSnapping > 0)
            {
                m_scaleSnapValue = m_scaleOptionValues[m_scaleSelectedSnapping];
            }
            else
            {
                m_scaleSnapValue = EditorGUILayout.FloatField("Custom Value", m_scaleSnapValue);
            }

            using (new HorizontalCenteredScope())
            {
                var originalColour = GUI.backgroundColor;
                GUI.backgroundColor = backgroundRed;;

                if (GUILayout.Button(EUI.GetTextContent("X"), GUILayout.Width(103)))
                {
                    m_scaleOffset.x = m_scaleSnapValue;
                }

                GUI.backgroundColor = backgroundGreen;
                if (GUILayout.Button(EUI.GetTextContent("Y"), GUILayout.Width(103)))
                {
                    m_scaleOffset.y = m_scaleSnapValue;
                }

                GUI.backgroundColor = backgroundBlue;
                if (GUILayout.Button(EUI.GetTextContent("Z"), GUILayout.Width(103)))
                {
                    m_scaleOffset.z = m_scaleSnapValue;
                }

                GUI.backgroundColor = originalColour;
            }

            // 设置笔刷
            m_selectorTools.selectGrid.positionOffset = m_positionOffset;
            m_selectorTools.selectGrid.angleOffset    = m_angleOffset;
            m_selectorTools.selectGrid.scaleOffset    = m_scaleOffset;

            m_selectorTools.selectGrid.Refresh();
        }
Esempio n. 2
0
        protected override void OnGUI(int id)
        {
            GUILayout.Label("-Rotation");
            using (new HorizontalCenteredScope())
            {
                var originalColour = GUI.backgroundColor;
                GUI.backgroundColor = backgroundRed;
                if (GUILayout.Button(EUI.GetTextureContent("iconX90"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.x += 90;
                }
                if (GUILayout.Button(EUI.GetTextureContent("iconX180"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.x += 180;
                }

                GUI.backgroundColor = backgroundGreen;
                if (GUILayout.Button(EUI.GetTextureContent("iconY90"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.y += 90;
                }
                if (GUILayout.Button(EUI.GetTextureContent("iconY180"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.y += 180;
                }


                GUI.backgroundColor = backgroundBlue;
                if (GUILayout.Button(EUI.GetTextureContent("iconZ90"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.z += 90;
                }
                if (GUILayout.Button(EUI.GetTextureContent("iconZ180"), GUILayout.Width(50), GUILayout.Height(50)))
                {
                    m_angleOffset.z += 180;
                }

                GUI.backgroundColor = originalColour;
            }

            GUILayout.Label("-Position");
            selectedSnapping = GUILayout.SelectionGrid(selectedSnapping, Options, Options.Length, EditorStyles.miniButton);
            if (selectedSnapping < OptionValues.Length && selectedSnapping > 0)
            {
                snapValue = OptionValues[selectedSnapping];
            }
            else
            {
                snapValue = EditorGUILayout.FloatField("Custom Value", snapValue);
            }

            using (new HorizontalCenteredScope())
            {
                var originalColour = GUI.backgroundColor;
                GUI.backgroundColor = backgroundRed;;

                if (GUILayout.Button(EUI.GetTextContent("+X"), GUILayout.Width(50)))
                {
                    m_positionOffset.x += snapValue;
                }

                if (GUILayout.Button(EUI.GetTextContent("-X"), GUILayout.Width(50)))
                {
                    m_positionOffset.x -= snapValue;
                }

                GUI.backgroundColor = backgroundGreen;
                if (GUILayout.Button(EUI.GetTextContent("+Y"), GUILayout.Width(50)))
                {
                    m_positionOffset.y += snapValue;
                }
                if (GUILayout.Button(EUI.GetTextContent("-Y"), GUILayout.Width(50)))
                {
                    m_positionOffset.y -= snapValue;
                }

                GUI.backgroundColor = backgroundBlue;
                if (GUILayout.Button(EUI.GetTextContent("+Z"), GUILayout.Width(50)))
                {
                    m_positionOffset.z += snapValue;
                }
                if (GUILayout.Button(EUI.GetTextContent("-Z"), GUILayout.Width(50)))
                {
                    m_positionOffset.z -= snapValue;
                }

                GUI.backgroundColor = originalColour;
            }

            // 设置笔刷
            m_brushTools.positionOffset = m_positionOffset;
            m_brushTools.angleOffset    = m_angleOffset;
        }