Example #1
0
        /// <summary>
        ///     This method creates a animation of Fade In and Fade Out.
        ///     It consists in three fases:
        ///         - Firstly the image will start with Alpha = 0, gradually Fading In (gaining opacity)
        ///			- Then, the image will remain on screen
        ///         - Finally, it will Fade Out
        /// </summary>
        /// <param name="img"> The Image used on the Fade Cycle </param>
        /// <param name="fadeSpeed"> The speed which the image will Fade In, be on screen and then Fade Out </param>
        public IEnumerator CycleFade(UnityEngine.UI.Image img, FadeSpeed fadeSpeed)
        {
            yield return(StartCoroutine(FadeImageCoroutine(img, false, fadeSpeed)));

            yield return(new WaitForSeconds((int)fadeSpeed / (baseSpeedDivider / 2)));

            yield return(StartCoroutine(FadeImageCoroutine(img, true, fadeSpeed)));
        }
Example #2
0
    /// <summary>
    /// Sets up the notification and displays it
    /// </summary>
    /// <param name="text">The text of the n otification</param>
    /// <param name="textColor">thhe colour</param>
    /// <param name="timeToRemove">Time that the notificaion will live</param>
    /// <param name="speed">speed that the notification will fade away</param>
    public void DisplayNotification(string text, Color textColor, float timeToRemove, FadeSpeed speed = FadeSpeed.Normal)
    {
        //Set the time
        m_timeToRemove       = timeToRemove;
        m_timeStartedDisplay = Time.time;

        //Set the text variables
        m_text.text  = text;
        m_text.color = textColor;
        m_fadeSpeed  = speed;
        m_text.gameObject.SetActive(true);
        m_settetUp = true;
    }
Example #3
0
        public static string GetDescriptiveName(this FadeSpeed speed)
        {
            switch (speed)
            {
            case FadeSpeed.Slow:
                return(Resources.FADE_SPEED_SLOW);

            case FadeSpeed.Fast:
                return(Resources.FADE_SPEED_FAST);

            case FadeSpeed.SuperFast:
                return(Resources.FADE_SPEED_SUPER_FAST);

            default:
            // ReSharper disable once RedundantCaseLabel
            case FadeSpeed.Normal:
                return(Resources.FADE_SPEED_NORMAL);
            }
        }
Example #4
0
        public static double GetFadeSpeedSeconds(this FadeSpeed speed)
        {
            switch (speed)
            {
            case FadeSpeed.Slow:
                return(2.0);

            case FadeSpeed.Fast:
                return(0.75);

            case FadeSpeed.SuperFast:
                return(0.2);

            default:
            // ReSharper disable once RedundantCaseLabel
            case FadeSpeed.Normal:
                return(1.0);
            }
        }
Example #5
0
        /// <summary>
        ///     Fades the given image in or out.
        /// </summary>
        /// <param name="img"> The image to fade </param>
        /// <param name="shouldFadeOut"> Whether the image should fade in or out </param>
        /// <param name="speedMultiplier"> The speed which the image will fade </param>
        public IEnumerator FadeImageCoroutine(UnityEngine.UI.Image img, bool shouldFadeOut, FadeSpeed fadeSpeed)
        {
            this.fadeSpeed = fadeSpeed;

            // Fade the image out (turns into transparent)
            if (shouldFadeOut)
            {
                for (float i = 1; i >= 0; i -= GetProcessedDeltaTime())
                {
                    img.color = new Color(1, 1, 1, i);
                    yield return(null);
                }
            }
            // Fade the image out (turns into opaque)
            else
            {
                for (float i = 0; i <= 1; i += GetProcessedDeltaTime())
                {
                    img.color = new Color(1, 1, 1, i);
                    yield return(null);
                }
            }
        }
Example #6
0
 /// <summary>
 /// Fade out the given screen.
 /// </summary>
 /// <param name="color">The color to fade out with.</param>
 /// <param name="speed">The speed to fade out at.</param>
 public static void FadeOut(Color color, FadeSpeed speed)
 {
     nextFade = color;
     fadeSpeed = (byte) speed;
 }
Example #7
0
 public static void FadeIn(FadeSpeed speed)
 {
     nextFade = Color.Transparent;
     fadeSpeed = (byte) speed;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            m_nImageViewTime = (int)nud_Seconds.Value;
            m_nFadeSpeed = (FadeSpeed)cbx_FadeSpeed.SelectedIndex;
            m_nTransitionMode = (TransitionMode)cbx_TransitionMode.SelectedIndex;
            m_sSaveLocation = txtb_SaveLocation.Text;

            base.OnFormClosed(e);
        }
        /// <summary>
        /// Gets a floating point value that represents the current FadeSpeed parameter.
        /// </summary>
        /// <param name="nFadeSpeed">Specifies the FadeSpeed enum value to convert.</param>
        /// <returns></returns>
        private float GetFadeSpeed(FadeSpeed nFadeSpeed)
        {
            switch (nFadeSpeed)
            {
                case FadeSpeed.Normal:
                    return 0.005F;
                case FadeSpeed.Fast:
                    return 0.01F;
                case FadeSpeed.Slow:
                    return 0.002F;
            }

            return 0.01F;
        }
Example #10
0
        private string CreateAttributes()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(String.Format("body=[{0}]", Body));
            sb.Append(String.Format(" header=[{0}]", Header == String.Empty ? "&nbsp;" : Header));

            if (FixedRelX != null)
            {
                sb.Append(String.Format(" fixedrelx=[{0}]", FixedRelX));
            }

            if (FixedRelY != null)
            {
                sb.Append(String.Format(" fixedrely=[{0}]", FixedRelY));
            }

            if (FixedAbsX != null)
            {
                sb.Append(String.Format(" fixedabsx=[{0}]", FixedAbsX));
            }

            if (FixedAbsY != null)
            {
                sb.Append(String.Format(" fixedabsy=[{0}]", FixedAbsY));
            }

            sb.Append(String.Format(" windowlock=[{0}]", WindowLock ? "on" : "off"));

            if (CssBody != String.Empty)
            {
                sb.Append(String.Format(" cssbody=[{0}]", CssBody));
            }

            if (CssHeader != String.Empty)
            {
                sb.Append(String.Format(" cssheader=[{0}]", CssHeader));
            }

            if (OffsetX != 10)
            {
                sb.Append(String.Format(" offsetx=[{0}]", OffsetX));
            }

            if (OffsetY != 10)
            {
                sb.Append(String.Format(" offsety=[{0}]", OffsetY));
            }

            sb.Append(String.Format(" doubleclickstop=[{0}]", DoubleClickStop ? "on" : "off"));
            sb.Append(String.Format(" singleclickstop=[{0}]", SingleClickStop ? "on" : "off"));
            sb.Append(String.Format(" requireclick=[{0}]", RequireClick ? "on" : "off"));
            sb.Append(String.Format(" hideselects=[{0}]", HideSelects ? "on" : "off"));
            sb.Append(String.Format(" fade=[{0}]", Fade ? "on" : "off"));

            if (FadeSpeed != (decimal)0.04)
            {
                sb.Append(String.Format(" fadespeed=[{0}]", FadeSpeed.ToString().Replace(",", ".")));
            }

            if (Delay != 0)
            {
                sb.Append(String.Format(" delay=[{0}]", Delay));
            }

            return(sb.ToString());
        }