Exemplo n.º 1
0
        // 曲線を描画する
        private void DrawCurve(UITween tTarget, float tCheckFactor, UITween.ProcessType tProcessType, UITween.EaseType tEaseType, AnimationCurve tAnimationCurve)
        {
            Rect tRect = GUILayoutUtility.GetRect(Screen.width - 160, 102f);

            float x = 0;

            x = (tRect.width - 102f) * 0.5f;
            if (x < 0)
            {
                x = 0;
            }
            tRect.x     = x;
            tRect.width = 102f;

            EditorGUI.DrawRect(new Rect(tRect.x + 0, tRect.y + 0, tRect.width - 0, tRect.height - 0), new Color(1.0f, 1.0f, 1.0f, 1.0f));
            EditorGUI.DrawRect(new Rect(tRect.x + 1, tRect.y + 1, tRect.width - 2, tRect.height - 2), new Color(0.2f, 0.2f, 0.2f, 1.0f));

            DrawLine(0, 25, 99, 25, 0xFF7F7F7F, tRect.x + 1.0f, tRect.y + 1.0f);
            DrawLine(0, 74, 99, 74, 0xFF7F7F7F, tRect.x + 1.0f, tRect.y + 1.0f);
            DrawLine(50, 99, 50, 0, 0xFF4F4F4F, tRect.x + 1.0f, tRect.y + 1.0f);
            DrawLine(0, 49, 99, 49, 0xFF4F4F4F, tRect.x + 1.0f, tRect.y + 1.0f);

            int px = 0, py = 0;
            int ox = 0, oy = 0;

            for (px = 0; px < 100; px++)
            {
                py = ( int )UITween.GetValue(0, 50, ( float )px * 0.01f, tProcessType, tEaseType, tAnimationCurve);

                if (px == 0)
                {
                    ox = px;
                    oy = py;
                }
                else
                {
                    DrawLine(ox, ((74 - oy) / 1) + 0, px, ((74 - py) / 1) + 0, 0xFF00FF00, tRect.x + 1.0f, tRect.y + 1.0f);

                    ox = px;
                    oy = py;
                }
            }

            px = ( int )((100.0f * tCheckFactor) + 0.5f);
            DrawLine(px, 99, px, 0, 0xFFFF0000, tRect.x + 1.0f, tRect.y + 1.0f);
        }