Exemplo n.º 1
0
        protected void UI_Vector2(string name, ref Vector2 v, System.Action <SWBaseInfo, bool> act = null, bool before = false,
                                  float labelWidth = -1, bool isRightUp = false)
        {
            if (labelWidth < 0)
            {
                labelWidth = SWGlobalSettings.LabelWidth;
            }
            if (isRightUp)
            {
                GUILayout.BeginHorizontal();
            }
            var temp = SWEditorUI.Vector2Field(name, v);

            if (temp != v)
            {
                if (before)
                {
                    if (act != null)
                    {
                        act(info, true);
                    }
                }
                v = temp;
                if (!before)
                {
                    if (act != null)
                    {
                        act(info, true);
                    }
                }
            }
            //GUILayout.Space (SWGlobalSettings.UIGap);
            if (isRightUp)
            {
                GUILayout.EndHorizontal();
            }
        }
Exemplo n.º 2
0
        public override void DrawTop()
        {
            Rect llRect = new Rect(0, 0, 0, 0);

            base.DrawTop();
            if ((DrawRemapMode)slotBox_left.selection == DrawRemapMode.dir)
            {
                var tmp = SWEditorUI.Vector2Field("Drag:", rData.d.v);
                if (tmp != rData.d.v)
                {
                    SWUndo.Record(this);
                    rData.d.v = tmp;
                }
                Tooltip_Rec(SWTipsText.Remap_Drag, TopElementRect(0, 190));

                GUILayout.Space(al_spacingBig);
                GUILayout.Label("Deviation:", SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                llRect = GUILayoutUtility.GetLastRect();
                var tmpPixelBack = EditorGUILayout.IntSlider("", rData.d.pb, -20, 20,
                                                             GUILayout.Width(SWGlobalSettings.SliderWidth));
                if (tmpPixelBack != rData.d.pb)
                {
                    SWUndo.Record(this);
                    rData.d.pb = tmpPixelBack;
                }
                Tooltip_Rec(SWTipsText.Remap_Deviation, -llRect.width - 10, 0);


                GUILayout.Space(al_spacingBig);
                GUILayout.Label("Precise:",
                                SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                Tooltip_Rec(SWTipsText.Remap_Precise, 0, 25);
                var p = GUILayout.Toggle(rData.d.pre, "", GUILayout.Width(80));
                if (p != rData.d.pre)
                {
                    SWUndo.Record(node.lineInfo);
                    rData.d.pre = p;
                }
            }
            else
            {
                GUILayout.Label("Size:", SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                llRect = GUILayoutUtility.GetLastRect();
                var tmpBrushSize = EditorGUILayout.IntSlider("", brushSize, 1, 60,
                                                             GUILayout.Width(SWGlobalSettings.SliderWidth));
                if (tmpBrushSize != brushSize)
                {
                    SWUndo.Record(this);
                    brushSize = tmpBrushSize;
                }
                Tooltip_Rec(SWTipsText.Remap_Size, -llRect.width - 10, 0);

                GUILayout.Space(al_spacingBig);
                GUILayout.Label("Stitch:",
                                SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                Tooltip_Rec(SWTipsText.Remap_Stitch, 0, 25);
                var stitch = GUILayout.Toggle(rData.l.st, "", GUILayout.Width(80));
                if (stitch != rData.l.st)
                {
                    SWUndo.Record(node.lineInfo);
                    rData.l.st = stitch;
                }
            }


            Rect btRect = TopElementRect(position.width - 100, position.width - SWGlobalSettings.UIGap);

            ePopup_texRes.Show(btRect);
            Tooltip_Rec(SWTipsText.Remap_TexSize, btRect);
        }
        public override void DrawTop()
        {
            Rect llRect = new Rect(0, 0, 0, 0);

            base.DrawTop();
            if ((DrawRemapMode)slotBox_left.selection == DrawRemapMode.dir)
            {
                var tmp = SWEditorUI.Vector2Field("Drag:", remap);
                if (tmp != remap)
                {
                    SWUndo.Record(this);
                    remap = tmp;
                }
                Tooltip_Rec(SWTipsText.Remap_Drag, TopElementRect(0, 190));

                GUILayout.Space(al_spacingBig);
                GUILayout.Label("Deviation:", SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                llRect = GUILayoutUtility.GetLastRect();
                var tmpPixelBack = EditorGUILayout.IntSlider("", pixelBack, -20, 20,
                                                             GUILayout.Width(SWGlobalSettings.SliderWidth));
                if (tmpPixelBack != pixelBack)
                {
                    SWUndo.Record(this);
                    pixelBack = tmpPixelBack;
                }
                Tooltip_Rec(SWTipsText.Remap_Deviation, -llRect.width - 10, 0);


                GUILayout.Space(al_spacingBig);
                GUILayout.Label("Precise:",
                                SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                Tooltip_Rec(SWTipsText.Remap_Precise, 0, 25);
                var p = GUILayout.Toggle(precise, "");
                if (p != precise)
                {
                    SWUndo.Record(info);
                    precise = p;
                }
            }
            else
            {
                GUILayout.Label("Size:", SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                llRect = GUILayoutUtility.GetLastRect();
                var tmpBrushSize = EditorGUILayout.IntSlider("", brushSize, 1, 60,
                                                             GUILayout.Width(SWGlobalSettings.SliderWidth));
                if (tmpBrushSize != brushSize)
                {
                    SWUndo.Record(this);
                    brushSize = tmpBrushSize;
                }
                Tooltip_Rec(SWTipsText.Remap_Size, -llRect.width - 10, 0);

                GUILayout.Space(al_spacingBig);
                GUILayout.Label("Stitch:",
                                SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight));
                Tooltip_Rec(SWTipsText.Remap_Stitch, 0, 25);
                var stitch = GUILayout.Toggle(info.stitch, "");
                if (stitch != info.stitch)
                {
                    SWUndo.Record(info);
                    info.stitch = stitch;
                }
            }
        }