public void Show(string message, string contentKey, int timeout, int speed) { this.message = message; if (contentKey != null) { this.icon = Content.GetTexture2D(contentKey).Texture; } else { this.icon = null; } this.slideUp = SlideTypes.Up; this.timeout = timeout; this.speed = speed; }
public override void Update(GameTime gameTime) { #region Slide Shelf if (slideUp == SlideTypes.Up) { if (this.Position.Y != GameData.ScreenSize.Height - Texture.Height) { this.Position = new Vector2(this.Position.X, this.Position.Y - speed); } else { slideUp = SlideTypes.Done; upTime = DateTime.Now; } } else if (slideUp == SlideTypes.Down) { if (this.Position.Y != GameData.ScreenSize.Height) { this.Position = new Vector2(this.Position.X, this.Position.Y + speed); } else { slideUp = SlideTypes.Done; OnMessageFinished(); } } #endregion TimeSpan diff = DateTime.Now - upTime; if (diff.Seconds >= timeout && slideUp == SlideTypes.Done) { this.slideUp = SlideTypes.Down; } base.Update(gameTime); }