Exemple #1
0
 public virtual void UI2Data(SWBaseInfo info, bool dorecord = true)
 {
     if (dorecord)
     {
         repaintDirty = true;
     }
 }
Exemple #2
0
 public void Init(SWNodeEffector e)
 {
     info          = ScriptableObject.CreateInstance <SWBaseInfo> ();
     info.effector = e;
     info.window   = this;
     SetLayerMask(info.effector);
 }
        public override void OnGUITool(SWBaseInfo info, bool isSelected)
        {
            center = info.imageRect.center + offset;
            base.OnGUITool(info, isSelected);
            rect = SWCommon.GetRect(center + ArrowOff, new Vector2(boxSize, boxSize));


            mat.SetFloat("r", -SWCommon.Vector2Angle(ArrowOff));
            if (ArrowOff.magnitude > 8f)
            {
                Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectArrow), mat);
            }
            Graphics.DrawTexture(SWCommon.GetRect(center, new Vector2(centerSize, centerSize)),
                                 SWEditorUI.Texture(SWUITex.effectCenter), mat);



            mat.SetFloat("r", 0f);
            mat.SetTexture("_MainTex", SWEditorUI.Texture(SWUITex.effectLine));
            SWDraw.DrawLine(center, rect.center, Color.white, lineWidth, mat);

            float dis = ArrowOff.magnitude;

            dis = dis - 3;
            dis = Mathf.Clamp(dis, 0, float.MaxValue);
            Vector2 v = center + ArrowOff.normalized * dis;

            v         = center;
            GUI.color = Color.black;
            GUI.Label(SWCommon.GetRect(v, new Vector2(15, 15)), title);
            GUI.color = Color.white;
        }
Exemple #4
0
        public override void UI2Data(SWBaseInfo info, bool dorecord = true)
        {
            base.UI2Data(info, dorecord);
            if (dorecord)
            {
                SWUndo.Record(this);
                ArrowOff = info.mousePosRotated - info.imageRect.center;

                if (Event.current.shift)
                {
                    if (Mathf.Abs(ArrowOff.x) > Mathf.Abs(ArrowOff.y))
                    {
                        ArrowOff = new Vector2(ArrowOff.x, 0);
                    }
                    else
                    {
                        ArrowOff = new Vector2(0, ArrowOff.y);
                    }
                }
            }

            info.effector.data.effectData.t_speed = new Vector2(ArrowOff.x * factor, -ArrowOff.y * factor);
            Matrix4x4 m = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(new Vector3(0, 0, -info.angle)), Vector3.one);

            info.effector.data.effectData.t_speed = m.MultiplyVector(info.effector.data.effectData.t_speed);
        }
Exemple #5
0
        public override void UI2Data(SWBaseInfo info, bool dorecord = true)
        {
            base.UI2Data(info, dorecord);
            if (dorecord)
            {
                SWUndo.Record(info);
                var vFrom = info.mousePosLast - info.imageRect.center;
                var vTo   = info.mousePos - info.imageRect.center;

                var   q = Quaternion.FromToRotation(vFrom, vTo);
                float v = q.eulerAngles.z;
                if (v > 180)
                {
                    v -= 360;
                }
                info.angle += v;

                //Debug.Log (string.Format ("last pos:{0} pos:{1} ro:{2} angle:{3}", info.mousePosRotatedLast,info.mousePosRotated,v, info.angle));
                if (OpTool_Move.Instance != null)
                {
                    Matrix4x4 m = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(new Vector3(0, 0, -v)), Vector3.one);
                    OpTool_Move.Instance.ArrowOff = m.MultiplyVector(OpTool_Move.Instance.ArrowOff);
                }
            }
            info.effector.data.effectData.r_angle = -info.angle * Mathf.Deg2Rad;
        }
Exemple #6
0
        public override void OnGUITool(SWBaseInfo info, bool isSelected)
        {
            base.OnGUITool(info, isSelected);
            float roundRad = Mathf.Max(info.imageRect.size.x, info.imageRect.size.y) * 0.6f;

            startPos = info.imageRect.center + new Vector2(0, -roundRad + 5);
            rect     = SWCommon.GetRect(startPos + offset, new Vector2(boxSize, boxSize));

            //bg circle
            var c = mat.GetColor("_Color");

            mat.SetColor("_Color", new Color32(128, 128, 128, 255));
            Rect roundRect = SWCommon.GetRect(info.imageRect.center, new Vector2(roundRad * 2, roundRad * 2));

            Graphics.DrawTexture(roundRect, SWEditorUI.Texture(SWUITex.effectRound), mat);
            mat.SetColor("_Color", c);



            mat.SetFloat("r", -SWCommon.Vector2Angle(offset));
            if (offset.magnitude > 8f)
            {
                Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectArrow), mat);
            }
            Graphics.DrawTexture(SWCommon.GetRect(startPos, new Vector2(centerSize, centerSize)),
                                 SWEditorUI.Texture(SWUITex.effectCenter), mat);


            mat.SetFloat("r", 0f);
            mat.SetTexture("_MainTex", SWEditorUI.Texture(SWUITex.effectLine));
            SWDraw.DrawLine(startPos, startPos + offset, Color.white, lineWidth, mat);
        }
Exemple #7
0
        public override void OnGUITool(SWBaseInfo info, bool isSelected)
        {
            base.OnGUITool(info, isSelected);
            var item = GUI.matrix;

            rect = SWCommon.GetRect(info.imageRect.center, new Vector2(centerSize, centerSize));
            Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectPos), mat);
        }
Exemple #8
0
        public virtual void OnGUITool(SWBaseInfo info, bool isSelected)
        {
            var color = isSelected ? Color.green:Color.white;

            mat.SetColor("_Color", color);
            info.window.Set_Material(mat, Vector2.zero, 0, Vector2.one);
            UI2Data(info, false);
        }
Exemple #9
0
        public override void OnGUITool(SWBaseInfo info, bool isSelected)
        {
            base.OnGUITool(info, isSelected);
            roundRad = Mathf.Max(info.imageRect.size.x, info.imageRect.size.y) * 0.6f;
            rect     = SWCommon.GetRect(info.imageRect.center + new Vector2(-roundRad, 0), new Vector2(boxSize, boxSize));
            Rect roundRect = SWCommon.GetRect(info.imageRect.center, new Vector2(roundRad * 2.04f, roundRad * 2.04f));

            Graphics.DrawTexture(roundRect, SWEditorUI.Texture(SWUITex.effectRound), mat);
        }
Exemple #10
0
 public override void Data2UI(SWBaseInfo info, bool dorecord = true)
 {
     base.Data2UI(info);
     if (dorecord)
     {
         SWUndo.Record(info);
     }
     info.angle = -info.effector.data.effectData.r_angle * Mathf.Rad2Deg;
 }
Exemple #11
0
 public override void Data2UI(SWBaseInfo info, bool dorecord = true)
 {
     base.Data2UI(info);
     if (dorecord)
     {
         SWUndo.Record(this);
     }
     offset = new Vector2(0, -info.effector.data.effectData.s_speed.x / factor);
 }
Exemple #12
0
 public override void Data2UI(SWBaseInfo info, bool dorecord = true)
 {
     base.Data2UI(info);
     if (dorecord)
     {
         SWUndo.Record(this);
     }
     factor   = 1f / info.baseRect.size.x * Mathf.PI * 2;
     offset.x = -info.effector.data.effectData.r_speed / factor;
 }
Exemple #13
0
 public override void UI2Data(SWBaseInfo info, bool dorecord = true)
 {
     base.UI2Data(info, dorecord);
     if (dorecord)
     {
         SWUndo.Record(this);
         Vector2 Move = info.mousePosRotated - info.mousePosRotatedLast;
         offset += new Vector2(Move.x, 0);
     }
     info.effector.data.effectData.r_speed = -offset.x * factor;
 }
Exemple #14
0
 public override void UI2Data(SWBaseInfo info, bool dorecord = true)
 {
     base.UI2Data(info, dorecord);
     if (dorecord)
     {
         SWUndo.Record(info);
         Vector2 Move = info.mousePosRotated - info.mousePosRotatedLast;
         info.imageRect = info.imageRect.ScaleSizeBy(new Vector2(1f, 1 - Move.y / info.imageRect.height));
     }
     info.effector.data.effectData.s_scale =
         new Vector2(info.imageRect.size.x / info.baseRect.size.x, info.imageRect.size.y / info.baseRect.size.y);
 }
Exemple #15
0
        public override void OnGUITool(SWBaseInfo info, bool isSelected)
        {
            base.OnGUITool(info, isSelected);
            rect = SWCommon.GetRect(info.imageRect.center + new Vector2(0, -info.imageRect.height * 0.5f), new Vector2(boxSize, boxSize));

            mat.SetFloat("r", Mathf.PI * 0.5f);
            Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectArrow), mat);

            mat.SetFloat("r", 0);
            mat.SetTexture("_MainTex", SWEditorUI.Texture(SWUITex.effectLine));
            SWDraw.DrawLine(info.imageRect.center, rect.center, Color.white, lineWidth, mat);
        }
Exemple #16
0
        public override void Data2UI(SWBaseInfo info, bool dorecord = true)
        {
            base.Data2UI(info);
            if (dorecord)
            {
                SWUndo.Record(info);
            }
            var center = info.imageRect.center;

            info.imageRect.size = new Vector2(info.effector.data.effectData.s_scale.x * info.baseRect.size.x,
                                              info.effector.data.effectData.s_scale.y * info.baseRect.size.y);
            info.imageRect.center = center;
        }
Exemple #17
0
        public override void Data2UI(SWBaseInfo info, bool dorecord = true)
        {
            base.Data2UI(info);
            if (dorecord)
            {
                SWUndo.Record(this);
            }
            factor   = 1f / info.baseRect.size.x;
            ArrowOff = new Vector2(info.effector.data.effectData.t_speed.x / factor, -info.effector.data.effectData.t_speed.y / factor);
            Matrix4x4 m2 = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(new Vector3(0, 0, -info.angle)), Vector3.one);

            ArrowOff = m2.MultiplyVector(ArrowOff);
        }
Exemple #18
0
        public override void Data2UI(SWBaseInfo info, bool dorecord = true)
        {
            base.Data2UI(info);
            if (dorecord)
            {
                SWUndo.Record(info);
            }
            var v = new Vector2(info.effector.data.effectData.t_startMove.x * info.baseRect.size.x, info.effector.data.effectData.t_startMove.y * info.baseRect.size.y);

            v = new Vector2(v.x, -v.y);
            var BL_Base = info.baseRect.center;

            info.imageRect.center = v + BL_Base;
        }
Exemple #19
0
        public void Init(SWNodeEffector e)
        {
            info          = ScriptableObject.CreateInstance <SWBaseInfo> ();
            info.effector = e;
            info.window   = this;
            SetLayerMask(info.effector);

            ePopup_texShowChn = new SWEnumPopup(new string[] { "All", "R", "G", "B", "A" }, (int)texShowChannel, null,
                                                delegate(int index)
            {
                SWUndo.Record(this);
                texShowChannel = (SWTexShowChannel)index;
                TexShowChnEnumSet();
            }
                                                );
        }
Exemple #20
0
        public override void UI2Data(SWBaseInfo info, bool dorecord = true)
        {
            base.UI2Data(info, dorecord);
            if (dorecord)
            {
                SWUndo.Record(info);
                info.imageRect.center += info.movement;
                info.imageRect.center  = info.movement;
            }


            var BL_Base = info.baseRect.center;
            var BL_Img  = info.imageRect.center;
            var v       = BL_Img - BL_Base;

            v = new Vector2(v.x, -v.y);
            info.effector.data.effectData.t_startMove = new Vector2(v.x / info.baseRect.size.x, v.y / info.baseRect.size.y);
        }
Exemple #21
0
        public override void OnGUITool(SWBaseInfo info, bool isSelected)
        {
            Instance = this;
            base.OnGUITool(info, isSelected);
            rect = SWCommon.GetRect(info.imageRect.center + ArrowOff, new Vector2(boxSize, boxSize));



            mat.SetFloat("r", -SWCommon.Vector2Angle(ArrowOff));
            if (ArrowOff.magnitude > 8f)
            {
                Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectArrow), mat);
            }
            Graphics.DrawTexture(SWCommon.GetRect(info.imageRect.center, new Vector2(centerSize, centerSize)),
                                 SWEditorUI.Texture(SWUITex.effectCenter), mat);

            mat.SetFloat("r", 0f);
            mat.SetTexture("_MainTex", SWEditorUI.Texture(SWUITex.effectLine));
            SWDraw.DrawLine(info.imageRect.center, rect.center, Color.white, lineWidth, mat);
        }
Exemple #22
0
 public virtual void Init(SWBaseInfo info)
 {
     Data2UI(info, false);
 }
 protected virtual Vector2 FromValue(SWBaseInfo info)
 {
     return(Vector2.zero);
 }
 public override void Init(SWBaseInfo info)
 {
     base.Init(info);
     offset = new Vector2(0f, 20f);
     title  = "A";
 }
Exemple #25
0
 public override void Init(SWBaseInfo info)
 {
     factor = 1f / info.baseRect.size.x;
     base.Init(info);
 }
 protected override void SetValue(SWBaseInfo info, Vector2 v)
 {
     base.SetValue(info, v);
     info.effector.data.effectDataUV.amountA = v;
 }
 protected override Vector2 FromValue(SWBaseInfo info)
 {
     return(info.effector.data.effectDataUV.amountA);
 }
Exemple #28
0
 public override void Init(SWBaseInfo info)
 {
     base.Init(info);
 }
Exemple #29
0
 public virtual void Data2UI(SWBaseInfo info, bool dorecord = true)
 {
 }
 protected virtual void SetValue(SWBaseInfo info, Vector2 v)
 {
 }