public void Render(float scale, int centerx, int centery, bool rotatedFormat, ISwrveMessageAnimator animator)
        {
            GUI.color = Color.white;
            if (image.Texture != null)
            {
                int textureWidth  = image.Texture.width;
                int textureHeight = image.Texture.height;

                float computedSize = scale * image.AnimationScale;
                Point centerPoint  = image.GetCenteredPosition(textureWidth, textureHeight, computedSize, scale);
                centerPoint.X    += centerx;
                centerPoint.Y    += centery;
                image.Rect.x      = centerPoint.X;
                image.Rect.y      = centerPoint.Y;
                image.Rect.width  = textureWidth * computedSize;
                image.Rect.height = textureHeight * computedSize;
                GUI.DrawTexture(image.Rect, image.Texture, ScaleMode.StretchToFill, true, 0.0f);
            }
            else
            {
                GUI.Box(image.Rect, image.File);
            }
        }
        public static void DrawMessage(SwrveMessageFormat format, int centerx, int centery)
        {
            if (Animator != null)
            {
                AnimateMessage(format);
            }
            if (format.BackgroundColor.HasValue && GetBlankTexture() != null)
            {
                Color value = format.BackgroundColor.Value;
                value.a           *= format.Message.BackgroundAlpha;
                GUI.color          = value;
                WholeScreen.width  = Screen.width;
                WholeScreen.height = Screen.height;
                GUI.DrawTexture(WholeScreen, blankTexture, ScaleMode.StretchToFill, alphaBlend: true, 10f);
                GUI.color = Color.white;
            }
            bool rotate = format.Rotate;

            if (rotate)
            {
                Vector2 pivotPoint = new Vector2(centerx, centery);
                GUIUtility.RotateAroundPivot(90f, pivotPoint);
            }
            float num = format.Scale * format.Message.AnimationScale;

            GUI.color = Color.white;
            Point centeredPosition;

            for (int i = 0; i < format.Images.Count; i++)
            {
                SwrveImage swrveImage = format.Images[i];
                if (swrveImage.Texture != null)
                {
                    float num2 = num * swrveImage.AnimationScale;
                    centeredPosition       = swrveImage.GetCenteredPosition(swrveImage.Texture.width, swrveImage.Texture.height, num2, num);
                    centeredPosition.X    += centerx;
                    centeredPosition.Y    += centery;
                    swrveImage.Rect.x      = centeredPosition.X;
                    swrveImage.Rect.y      = centeredPosition.Y;
                    swrveImage.Rect.width  = (float)swrveImage.Texture.width * num2;
                    swrveImage.Rect.height = (float)swrveImage.Texture.height * num2;
                    GUI.DrawTexture(swrveImage.Rect, swrveImage.Texture, ScaleMode.StretchToFill, alphaBlend: true, 10f);
                }
                else
                {
                    GUI.Box(swrveImage.Rect, swrveImage.File);
                }
            }
            for (int j = 0; j < format.Buttons.Count; j++)
            {
                SwrveButton swrveButton = format.Buttons[j];
                if (swrveButton.Texture != null)
                {
                    float num2 = num * swrveButton.AnimationScale;
                    centeredPosition        = swrveButton.GetCenteredPosition(swrveButton.Texture.width, swrveButton.Texture.height, num2, num);
                    swrveButton.Rect.x      = centeredPosition.X + centerx;
                    swrveButton.Rect.y      = centeredPosition.Y + centery;
                    swrveButton.Rect.width  = (float)swrveButton.Texture.width * num2;
                    swrveButton.Rect.height = (float)swrveButton.Texture.height * num2;
                    if (rotate)
                    {
                        Point center = swrveButton.GetCenter(swrveButton.Texture.width, swrveButton.Texture.height, num2);
                        swrveButton.PointerRect.x      = (float)centerx - (float)swrveButton.Position.Y * num + (float)center.Y;
                        swrveButton.PointerRect.y      = (float)centery + (float)swrveButton.Position.X * num + (float)center.X;
                        swrveButton.PointerRect.width  = swrveButton.Rect.height;
                        swrveButton.PointerRect.height = swrveButton.Rect.width;
                    }
                    else
                    {
                        swrveButton.PointerRect = swrveButton.Rect;
                    }
                    if (Animator != null)
                    {
                        Animator.AnimateButtonPressed(swrveButton);
                    }
                    else
                    {
                        GUI.color = (swrveButton.Pressed ? ButtonPressedColor : Color.white);
                    }
                    GUI.DrawTexture(swrveButton.Rect, swrveButton.Texture, ScaleMode.StretchToFill, alphaBlend: true, 10f);
                }
                else
                {
                    GUI.Box(swrveButton.Rect, swrveButton.Image);
                }
                GUI.color = Color.white;
            }
            if ((Animator == null && format.Closing) || (Animator != null && Animator.IsMessageDismissed(format)))
            {
                format.Dismissed = true;
                format.UnloadAssets();
            }
        }
        public static void DrawMessage(SwrveMessageFormat format, int centerx, int centery)
        {
            if (Animator != null)
            {
                AnimateMessage(format);
            }

            if (format.BackgroundColor.HasValue && GetBlankTexture() != null)
            {
                Color backgroundColor = format.BackgroundColor.Value;
                backgroundColor.a  = backgroundColor.a * format.Message.BackgroundAlpha;
                GUI.color          = backgroundColor;
                WholeScreen.width  = Screen.width;
                WholeScreen.height = Screen.height;
                GUI.DrawTexture(WholeScreen, blankTexture, ScaleMode.StretchToFill, true, 10.0f);
                GUI.color = Color.white;
            }

            bool rotatedFormat = format.Rotate;

            // Rotate the inner message if necessary
            if (rotatedFormat)
            {
                Vector2 pivotPoint = new Vector2(centerx, centery);
                GUIUtility.RotateAroundPivot(90, pivotPoint);
            }

            float scale = format.Scale * format.Message.AnimationScale;

            GUI.color = Color.white;
            // Draw images
            for (int ii = 0; ii < format.Images.Count; ii++)
            {
                SwrveImage image = format.Images[ii];
                if (image.Texture != null)
                {
                    float computedSize = scale * image.AnimationScale;
                    Point centerPoint  = image.GetCenteredPosition(image.Texture.width, image.Texture.height, computedSize, scale);
                    centerPoint.X    += centerx;
                    centerPoint.Y    += centery;
                    image.Rect.x      = centerPoint.X;
                    image.Rect.y      = centerPoint.Y;
                    image.Rect.width  = image.Texture.width * computedSize;
                    image.Rect.height = image.Texture.height * computedSize;

                    GUI.DrawTexture(image.Rect, image.Texture, ScaleMode.StretchToFill, true, 10.0f);
                }
                else
                {
                    GUI.Box(image.Rect, image.File);
                }
            }

            // Draw buttons
            for (int bi = 0; bi < format.Buttons.Count; bi++)
            {
                SwrveButton button = format.Buttons[bi];
                if (button.Texture != null)
                {
                    float computedSize = scale * button.AnimationScale;
                    Point centerPoint  = button.GetCenteredPosition(button.Texture.width, button.Texture.height, computedSize, scale);
                    button.Rect.x      = centerPoint.X + centerx;
                    button.Rect.y      = centerPoint.Y + centery;
                    button.Rect.width  = button.Texture.width * computedSize;
                    button.Rect.height = button.Texture.height * computedSize;

                    if (rotatedFormat)
                    {
                        // Rotate 90 degrees the hit area
                        Point widgetCenter = button.GetCenter(button.Texture.width, button.Texture.height, computedSize);
                        button.PointerRect.x      = centerx - (button.Position.Y * scale) + widgetCenter.Y;
                        button.PointerRect.y      = centery + (button.Position.X * scale) + widgetCenter.X;
                        button.PointerRect.width  = button.Rect.height;
                        button.PointerRect.height = button.Rect.width;
                    }
                    else
                    {
                        button.PointerRect = button.Rect;
                    }
                    if (Animator != null)
                    {
                        Animator.AnimateButtonPressed(button);
                    }
                    else
                    {
                        GUI.color = (button.Pressed) ? ButtonPressedColor : Color.white;
                    }
                    GUI.DrawTexture(button.Rect, button.Texture, ScaleMode.StretchToFill, true, 10.0f);
                }
                else
                {
                    GUI.Box(button.Rect, button.Image);
                }
                GUI.color = Color.white;
            }

            // Do closing logic
            if ((Animator == null && format.Closing) || (Animator != null && Animator.IsMessageDismissed(format)))
            {
                format.Dismissed = true;
                format.UnloadAssets();
            }
        }