Exemplo n.º 1
0
 public static void AnimateMessage(SwrveMessageFormat format)
 {
     if (Animator != null)
     {
         Animator.AnimateMessage(format);
     }
 }
        public void DrawMessage(int screenWidth, int screenHeight)
        {
            int centerx = (int)(Screen.width / 2) + format.Message.Position.X;
            int centery = (int)(Screen.height / 2) + format.Message.Position.Y;

            if (animator != null)
            {
                animator.AnimateMessage(format);
            }

            if (renderBackgroundColor)
            {
                Color backgroundColor = format.BackgroundColor.Value;
                backgroundColor.a  = backgroundColor.a * format.Message.BackgroundAlpha;
                GUI.color          = backgroundColor;
                WholeScreen.width  = screenWidth;
                WholeScreen.height = screenHeight;
                GUI.DrawTexture(WholeScreen, Texture2D.whiteTexture, ScaleMode.StretchToFill, true, 0.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;

            for (int ii = 0; ii < widgetViews.Length; ii++)
            {
                widgetViews[ii].Render(scale, centerx, centery, rotatedFormat, animator);
            }

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