InitStyles() private static method

private static InitStyles ( ) : void
return void
Exemplo n.º 1
0
        public void TimeRuler(Rect position, float frameRate, bool labels, bool useEntireHeight, float alpha)
        {
            Color color = GUI.color;

            GUI.BeginGroup(position);
            if (Event.current.type != EventType.Repaint)
            {
                GUI.EndGroup();
            }
            else
            {
                TimeArea.InitStyles();
                HandleUtility.ApplyWireMaterial();
                if (Application.platform == RuntimePlatform.WindowsEditor)
                {
                    GL.Begin(7);
                }
                else
                {
                    GL.Begin(1);
                }
                Color backgroundColor = GUI.backgroundColor;
                this.SetTickMarkerRanges();
                this.hTicks.SetTickStrengths(3f, 80f, true);
                Color textColor = TimeArea.styles.TimelineTick.normal.textColor;
                textColor.a = 0.75f * alpha;
                for (int level = 0; level < this.hTicks.tickLevels; ++level)
                {
                    float   b            = this.hTicks.GetStrengthOfLevel(level) * 0.9f;
                    float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(level, true);
                    for (int index = 0; index < ticksAtLevel.Length; ++index)
                    {
                        if ((double)ticksAtLevel[index] >= (double)this.hRangeMin && (double)ticksAtLevel[index] <= (double)this.hRangeMax)
                        {
                            int   num1 = Mathf.RoundToInt(ticksAtLevel[index] * frameRate);
                            float num2 = !useEntireHeight ? (float)((double)position.height * (double)Mathf.Min(1f, b) * 0.699999988079071) : position.height;
                            TimeArea.DrawVerticalLineFast(this.FrameToPixel((float)num1, frameRate, position), (float)((double)position.height - (double)num2 + 0.5), position.height - 0.5f, new Color(1f, 1f, 1f, b / 0.5f) * textColor);
                        }
                    }
                }
                GL.End();
                if (labels)
                {
                    float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(this.hTicks.GetLevelWithMinSeparation(40f), false);
                    for (int index = 0; index < ticksAtLevel.Length; ++index)
                    {
                        if ((double)ticksAtLevel[index] >= (double)this.hRangeMin && (double)ticksAtLevel[index] <= (double)this.hRangeMax)
                        {
                            int frame = Mathf.RoundToInt(ticksAtLevel[index] * frameRate);
                            GUI.Label(new Rect(Mathf.Floor(this.FrameToPixel((float)frame, frameRate, position)) + 3f, -3f, 40f, 20f), this.FormatFrame(frame, frameRate), TimeArea.styles.TimelineTick);
                        }
                    }
                }
                GUI.EndGroup();
                GUI.backgroundColor = backgroundColor;
                GUI.color           = color;
            }
        }
Exemplo n.º 2
0
 public void DrawMajorTicks(Rect position, float frameRate)
 {
     GUI.BeginGroup(position);
     if (Event.current.type != EventType.Repaint)
     {
         GUI.EndGroup();
     }
     else
     {
         TimeArea.InitStyles();
         HandleUtility.ApplyWireMaterial();
         this.SetTickMarkerRanges();
         this.hTicks.SetTickStrengths(3f, 80f, true);
         Color textColor = TimeArea.timeAreaStyles.timelineTick.normal.textColor;
         textColor.a = 0.1f;
         if (Application.platform == RuntimePlatform.WindowsEditor)
         {
             GL.Begin(7);
         }
         else
         {
             GL.Begin(1);
         }
         Rect shownArea = base.shownArea;
         for (int i = 0; i < this.hTicks.tickLevels; i++)
         {
             float num = this.hTicks.GetStrengthOfLevel(i) * 0.9f;
             if (num > 0.5f)
             {
                 float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(i, true);
                 for (int j = 0; j < ticksAtLevel.Length; j++)
                 {
                     if (ticksAtLevel[j] >= 0f)
                     {
                         int   num2 = Mathf.RoundToInt(ticksAtLevel[j] * frameRate);
                         float x    = this.FrameToPixel((float)num2, frameRate, position, shownArea);
                         TimeArea.DrawVerticalLineFast(x, 0f, position.height, textColor);
                     }
                 }
             }
         }
         GL.End();
         GUI.EndGroup();
     }
 }
Exemplo n.º 3
0
 public static void DrawPlayhead(float x, float yMin, float yMax, float thickness, float alpha)
 {
     if (Event.current.type == EventType.Repaint)
     {
         TimeArea.InitStyles();
         float num   = thickness * 0.5f;
         Color color = TimeArea.styles.playhead.normal.textColor.AlphaMultiplied(alpha);
         if (thickness > 1f)
         {
             Rect rect = Rect.MinMaxRect(x - num, yMin, x + num, yMax);
             EditorGUI.DrawRect(rect, color);
         }
         else
         {
             TimeArea.DrawVerticalLine(x, yMin, yMax, color);
         }
     }
 }
Exemplo n.º 4
0
        public void DrawMajorTicks(Rect position, float frameRate)
        {
            Color color = Handles.color;

            GUI.BeginGroup(position);
            if (Event.current.type != EventType.Repaint)
            {
                GUI.EndGroup();
            }
            else
            {
                TimeArea.InitStyles();
                this.SetTickMarkerRanges();
                this.hTicks.SetTickStrengths(3f, 80f, true);
                Color textColor = TimeArea.styles.timelineTick.normal.textColor;
                textColor.a   = 0.1f;
                Handles.color = textColor;
                Rect shownArea = base.shownArea;
                for (int i = 0; i < this.hTicks.tickLevels; i++)
                {
                    float num = this.hTicks.GetStrengthOfLevel(i) * 0.9f;
                    if (num > 0.5f)
                    {
                        float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(i, true);
                        for (int j = 0; j < ticksAtLevel.Length; j++)
                        {
                            if (ticksAtLevel[j] >= 0f)
                            {
                                int   num2 = Mathf.RoundToInt(ticksAtLevel[j] * frameRate);
                                float x    = this.FrameToPixel((float)num2, frameRate, position, shownArea);
                                Handles.DrawLine(new Vector3(x, 0f, 0f), new Vector3(x, position.height, 0f));
                            }
                        }
                    }
                }
                GUI.EndGroup();
                Handles.color = color;
            }
        }
Exemplo n.º 5
0
        public void DrawMajorTicks(Rect position, float frameRate)
        {
            Color color = Handles.color;

            GUI.BeginGroup(position);
            if (Event.current.type != EventType.Repaint)
            {
                GUI.EndGroup();
            }
            else
            {
                TimeArea.InitStyles();
                this.SetTickMarkerRanges();
                this.hTicks.SetTickStrengths(3f, 80f, true);
                Color textColor = TimeArea.styles.TimelineTick.normal.textColor;
                textColor.a   = 0.1f;
                Handles.color = textColor;
                for (int level = 0; level < this.hTicks.tickLevels; ++level)
                {
                    if ((double)(this.hTicks.GetStrengthOfLevel(level) * 0.9f) > 0.5)
                    {
                        float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(level, true);
                        for (int index = 0; index < ticksAtLevel.Length; ++index)
                        {
                            if ((double)ticksAtLevel[index] >= 0.0)
                            {
                                float pixel = this.FrameToPixel((float)Mathf.RoundToInt(ticksAtLevel[index] * frameRate), frameRate, position);
                                Handles.DrawLine(new Vector3(pixel, 0.0f, 0.0f), new Vector3(pixel, position.height, 0.0f));
                            }
                        }
                    }
                }
                GUI.EndGroup();
                Handles.color = color;
            }
        }
Exemplo n.º 6
0
        public void TimeRuler(Rect position, float frameRate, bool labels, bool useEntireHeight, float alpha, TimeArea.TimeFormat timeFormat)
        {
            Color color = GUI.color;

            GUI.BeginGroup(position);
            TimeArea.InitStyles();
            HandleUtility.ApplyWireMaterial();
            Color backgroundColor = GUI.backgroundColor;

            this.SetTickMarkerRanges();
            this.hTicks.SetTickStrengths(3f, 80f, true);
            Color textColor = TimeArea.styles.timelineTick.normal.textColor;

            textColor.a = 0.75f * alpha;
            if (Event.current.type == EventType.Repaint)
            {
                if (Application.platform == RuntimePlatform.WindowsEditor)
                {
                    GL.Begin(7);
                }
                else
                {
                    GL.Begin(1);
                }
                Rect shownArea = base.shownArea;
                for (int i = 0; i < this.hTicks.tickLevels; i++)
                {
                    float   num          = this.hTicks.GetStrengthOfLevel(i) * 0.9f;
                    float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(i, true);
                    for (int j = 0; j < ticksAtLevel.Length; j++)
                    {
                        if (ticksAtLevel[j] >= base.hRangeMin && ticksAtLevel[j] <= base.hRangeMax)
                        {
                            int   num2 = Mathf.RoundToInt(ticksAtLevel[j] * frameRate);
                            float num3 = (!useEntireHeight) ? (position.height * Mathf.Min(1f, num) * 0.7f) : position.height;
                            float x    = this.FrameToPixel((float)num2, frameRate, position, shownArea);
                            TimeArea.DrawVerticalLineFast(x, position.height - num3 + 0.5f, position.height - 0.5f, new Color(1f, 1f, 1f, num / 0.5f) * textColor);
                        }
                    }
                }
                GL.End();
            }
            if (labels)
            {
                int     levelWithMinSeparation = this.hTicks.GetLevelWithMinSeparation(40f);
                float[] ticksAtLevel2          = this.hTicks.GetTicksAtLevel(levelWithMinSeparation, false);
                for (int k = 0; k < ticksAtLevel2.Length; k++)
                {
                    if (ticksAtLevel2[k] >= base.hRangeMin && ticksAtLevel2[k] <= base.hRangeMax)
                    {
                        int    num4 = Mathf.RoundToInt(ticksAtLevel2[k] * frameRate);
                        float  num5 = Mathf.Floor(this.FrameToPixel((float)num4, frameRate, position));
                        string text = this.FormatTime(ticksAtLevel2[k], frameRate, timeFormat);
                        GUI.Label(new Rect(num5 + 3f, -3f, 40f, 20f), text, TimeArea.styles.timelineTick);
                    }
                }
            }
            GUI.EndGroup();
            GUI.backgroundColor = backgroundColor;
            GUI.color           = color;
        }
Exemplo n.º 7
0
        public void TimeRuler(Rect position, float frameRate)
        {
            Color color = GUI.color;

            GUI.BeginGroup(position);
            if (Event.current.type != EventType.Repaint)
            {
                GUI.EndGroup();
                return;
            }
            TimeArea.InitStyles();
            HandleUtility.ApplyWireMaterial();
            GL.Begin(1);
            Color backgroundColor = GUI.backgroundColor;

            this.SetTickMarkerRanges();
            this.hTicks.SetTickStrengths(3f, 80f, true);
            Color textColor = TimeArea.styles.TimelineTick.normal.textColor;

            textColor.a = 0.75f;
            for (int i = 0; i < this.hTicks.tickLevels; i++)
            {
                float   num          = this.hTicks.GetStrengthOfLevel(i) * 0.9f;
                float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(i, true);
                for (int j = 0; j < ticksAtLevel.Length; j++)
                {
                    if (ticksAtLevel[j] >= base.hRangeMin && ticksAtLevel[j] <= base.hRangeMax)
                    {
                        int   num2 = Mathf.RoundToInt(ticksAtLevel[j] * frameRate);
                        float num3 = position.height * Mathf.Min(1f, num) * 0.7f;
                        float num4 = this.FrameToPixel((float)num2, frameRate, position);
                        GL.Color(new Color(1f, 1f, 1f, num / 0.5f) * textColor);
                        GL.Vertex(new Vector3(num4, position.height - num3 + 0.5f, 0f));
                        GL.Vertex(new Vector3(num4, position.height - 0.5f, 0f));
                        if (num > 0.5f)
                        {
                            GL.Color(new Color(1f, 1f, 1f, num / 0.5f - 1f) * textColor);
                            GL.Vertex(new Vector3(num4 + 1f, position.height - num3 + 0.5f, 0f));
                            GL.Vertex(new Vector3(num4 + 1f, position.height - 0.5f, 0f));
                        }
                    }
                }
            }
            GL.End();
            int levelWithMinSeparation = this.hTicks.GetLevelWithMinSeparation(40f);

            float[] ticksAtLevel2 = this.hTicks.GetTicksAtLevel(levelWithMinSeparation, false);
            for (int k = 0; k < ticksAtLevel2.Length; k++)
            {
                if (ticksAtLevel2[k] >= base.hRangeMin && ticksAtLevel2[k] <= base.hRangeMax)
                {
                    int    num5 = Mathf.RoundToInt(ticksAtLevel2[k] * frameRate);
                    float  num6 = Mathf.Floor(this.FrameToPixel((float)num5, frameRate, base.rect));
                    string text = this.FormatFrame(num5, frameRate);
                    GUI.Label(new Rect(num6 + 3f, -3f, 40f, 20f), text, TimeArea.styles.TimelineTick);
                }
            }
            GUI.EndGroup();
            GUI.backgroundColor = backgroundColor;
            GUI.color           = color;
        }