Beispiel #1
0
 public void ClearMessage()
 {
     //startTime = null;
     currentMessage = null;
     if (messageElement != null)
     {
         messageElement.Caption = "";
     }
     if (iconOverlay != null && iconOverlay.IsVisible)
     {
         iconOverlay.Hide();
     }
     isDecreasingBgOpacity = false;
     isIncreasingBgOpacity = false;
     if (backgroundElement != null)
     {
         backgroundElement.Hide();
     }
 }
Beispiel #2
0
 /*
  * private Vector2 customIconPosition = Vector2.NEGATIVE_UNIT_X;
  *
  * public bool HasCustomIconPosition()
  * {
  *  return customIconPosition != Vector2.NEGATIVE_UNIT_X;
  * }
  */
 public IconedMessageEntry(MessageEntry entry, String icon) : this(entry.X, entry.Y, entry.Time, entry.Message, entry.CharHeight, entry.ColourTop, entry.ColourBottom, entry.Blinking, entry.Permanent, entry.NoBackground)
 {
     this.icon = icon;
 }
Beispiel #3
0
        public void UpdateControl(float timeSinceLastFrame)
        {
            if (currentMessage == null)
            {
                if (messageQueue.Count != 0)
                {
                    //   Console.WriteLine("Enqueuing");
                    currentMessage = messageQueue[0];
                    PrepareMessage();
                    messageQueue.RemoveAt(0);

                    if (currentMessage.NoBackground && messageElement != null && !messageElement.IsVisible)
                    {
                        ShowCurrentMessage();
                    }


                    if (instantBackground && messageElement != null && !messageElement.IsVisible)
                    {
                        currentBgOpacity = bgAnimationMaxOpacity;
                        SetBgOpacity(currentBgOpacity);
                        ShowCurrentMessage();
                    }

                    if (!currentMessage.NoBackground)
                    {
                        backgroundElement.Show();
                        isIncreasingBgOpacity = true;
                    }
                }
                else
                {
                }
            }
            else
            {
                if (!currentMessage.NoBackground)
                {
                    // BACKGROUND
                    if (isIncreasingBgOpacity)
                    {
                        if (currentBgOpacity < bgAnimationMaxOpacity)
                        {
                            SetBgOpacity(currentBgOpacity);
                            currentBgOpacity += timeSinceLastFrame / bgAnimationLength;
                            return;
                        }
                        else
                        {
                            isIncreasingBgOpacity = false;
                            currentBgOpacity      = bgAnimationMaxOpacity;

                            // pokaz
                            ShowCurrentMessage();
                            backgroundElement.Show();
                        }
                    }
                    else
                    if (isDecreasingBgOpacity)
                    {
                        if (currentBgOpacity > 0.0f)
                        {
                            SetBgOpacity(currentBgOpacity);
                            currentBgOpacity -= timeSinceLastFrame / bgAnimationLength;
                            return;
                        }
                        else
                        {
                            isDecreasingBgOpacity = false;
                            currentBgOpacity      = 0;
                            // ukryj
                            backgroundElement.Hide();
                            ClearMessage();
                            return;
                        }
                    }
                    else
                    {
                        UpdateMessage();
                    }
                }
                else
                {
                    // no background

                    // show
                    //  Console.WriteLine("Showing");
                    if (messageElement != null && !messageElement.IsVisible)
                    {
                        ShowCurrentMessage();
                    }
                    isDecreasingBgOpacity = false;
                    isIncreasingBgOpacity = false;
                }


                TimeSpan diff = DateTime.Now.Subtract(startTime);
                if (!currentMessage.Permanent && diff.TotalMilliseconds > currentMessage.Time)
                {
                    //     Console.WriteLine("Clearing");

                    isDecreasingBgOpacity = true;
                    if (messageElement != null)
                    {
                        messageElement.Hide();
                    }
                    if (iconOverlay != null && iconOverlay.IsVisible)
                    {
                        iconOverlay.Hide();
                    }
                    if (instantBackground)
                    {
                        backgroundElement.Hide();
                        ClearMessage();
                    }

                    if (currentMessage.NoBackground)
                    {
                        ClearMessage();
                        isDecreasingBgOpacity = false;
                        isIncreasingBgOpacity = false;
                    }
                }
            }
        }
Beispiel #4
0
 public void AppendMessage(MessageEntry messageEntry)
 {
     messageQueue.Add(messageEntry);
 }