Example #1
0
        /// <summary>
        /// Show the notification.
        /// </summary>
        /// <param name="message">Message.</param>
        /// <param name="customHideDelay">Custom hide delay.</param>
        /// <param name="container">Container. Parent object for current notification.</param>
        /// <param name="showAnimation">Function used to run show animation.</param>
        /// <param name="hideAnimation">Function used to run hide animation.</param>
        /// <param name="slideUpOnHide">Start slide up animations after hide current notification.</param>
        /// <param name="sequenceType">Add notification to sequence and display in order according specified sequenceType.</param>
        /// <param name="sequenceDelay">Time between previous notification was hidden and next will be showed.</param>
        /// <param name="clearSequence">Clear notifications sequence and hide current notification.</param>
        public void Show(string message        = null,
                         float?customHideDelay = null,
                         Transform container   = null,
                         Func <Notify, IEnumerator> showAnimation = null,
                         Func <Notify, IEnumerator> hideAnimation = null,
                         bool?slideUpOnHide          = null,
                         NotifySequence sequenceType = NotifySequence.None,
                         float sequenceDelay         = 0.3f,
                         bool clearSequence          = false)
        {
            if (clearSequence)
            {
                NotifyManager.Clear();
            }

            SequenceDelay = sequenceDelay;

            oldShowAnimation = ShowAnimation;
            oldHideAnimation = HideAnimation;
            if ((message != null) && (text != null))
            {
                text.text = message;
            }

            if (container != null)
            {
                transform.SetParent(container, false);
            }

            if (customHideDelay != null)
            {
                HideDelay = (float)customHideDelay;
            }

            if (slideUpOnHide != null)
            {
                SlideUpOnHide = (bool)slideUpOnHide;
            }

            if (showAnimation != null)
            {
                ShowAnimation = showAnimation;
            }

            if (hideAnimation != null)
            {
                HideAnimation = hideAnimation;
            }

            if (sequenceType != NotifySequence.None)
            {
                NotifyManager.Add(this, sequenceType);
            }
            else
            {
                Display();
            }
        }
		/// <summary>
		/// Add the specified notification to sequence.
		/// </summary>
		/// <param name="notification">Notification.</param>
		/// <param name="type">Type.</param>
		public void Add(Notify notification, NotifySequence type)
		{
			if (type==NotifySequence.Last)
			{
				notifySequence.Add(notification);
			}
			else
			{
				notifySequence.Insert(0, notification);
			}
		}
 /// <summary>
 /// Add the specified notification to sequence.
 /// </summary>
 /// <param name="notification">Notification.</param>
 /// <param name="type">Type.</param>
 public virtual void Add(Notify notification, NotifySequence type)
 {
     if (type == NotifySequence.Last)
     {
         notifySequence.Add(notification);
     }
     else
     {
         notifySequence.Insert(0, notification);
     }
 }
Example #4
0
        public IEntity ShowNotify(string ui,
                                  string message        = null,
                                  float?customHideDelay = null,
                                  Transform container   = null,
                                  Func <Notify, IEnumerator> showAnimation = null,
                                  Func <Notify, IEnumerator> hideAnimation = null,
                                  bool?slideUpOnHide          = null,
                                  NotifySequence sequenceType = NotifySequence.None,
                                  float sequenceDelay         = 0.3f,
                                  bool clearSequence          = false,
                                  bool?newUnscaledTime        = null)
        {
            var uiEntity = CreateUI(new NotifyUIBlueprint(ui, message, customHideDelay, container, showAnimation,
                                                          hideAnimation, slideUpOnHide, sequenceType, sequenceDelay, clearSequence, newUnscaledTime));

            CreateUI(uiEntity);
            return(uiEntity);
        }
Example #5
0
 public NotifyUIBlueprint(string name,
                          string message        = null,
                          float?customHideDelay = null,
                          Transform container   = null,
                          Func <Notify, IEnumerator> showAnimation = null,
                          Func <Notify, IEnumerator> hideAnimation = null,
                          bool?slideUpOnHide          = null,
                          NotifySequence sequenceType = NotifySequence.None,
                          float sequenceDelay         = 0.3f,
                          bool clearSequence          = false,
                          bool?newUnscaledTime        = null)
 {
     uiName               = name;
     this.message         = message;
     this.customHideDelay = customHideDelay;
     this.container       = container;
     this.showAnimation   = showAnimation;
     this.hideAnimation   = hideAnimation;
     this.slideUpOnHide   = slideUpOnHide;
     this.sequenceType    = sequenceType;
     this.sequenceDelay   = sequenceDelay;
     this.clearSequence   = clearSequence;
     this.newUnscaledTime = newUnscaledTime;
 }
Example #6
0
        /// <summary>
        /// Show the notification.
        /// </summary>
        /// <param name="message">Message.</param>
        /// <param name="customHideDelay">Custom hide delay.</param>
        /// <param name="container">Container. Parent object for current notification.</param>
        /// <param name="showAnimation">Function used to run show animation.</param>
        /// <param name="hideAnimation">Function used to run hide animation.</param>
        /// <param name="slideUpOnHide">Start slide up animations after hide current notification.</param>
        /// <param name="sequenceType">Add notification to sequence and display in order according specified sequenceType.</param>
        /// <param name="sequenceDelay">Time between previous notification was hidden and next will be showed.</param>
        /// <param name="clearSequence">Clear notifications sequence and hide current notification.</param>
        /// <param name="newUnscaledTime">Use unscaled time.</param>
        public void Show(string message        = null,
                         float?customHideDelay = null,
                         Transform container   = null,
                         Func <Notify, IEnumerator> showAnimation = null,
                         Func <Notify, IEnumerator> hideAnimation = null,
                         bool?slideUpOnHide          = null,
                         NotifySequence sequenceType = NotifySequence.None,
                         float sequenceDelay         = 0.3f,
                         bool clearSequence          = false,
                         bool?newUnscaledTime        = null)
        {
            if (IsTemplate)
            {
                Debug.LogWarning("Use the template clone, not the template itself: NotifyTemplate.Clone().Show(...), not NotifyTemplate.Show(...)");
            }

            if (clearSequence)
            {
                NotifyManager.Clear();
            }

            SequenceDelay = sequenceDelay;

            oldShowAnimation = ShowAnimation;
            oldHideAnimation = HideAnimation;

            SetMessage(message);

            if (container != null)
            {
                transform.SetParent(container, false);
            }

            if (newUnscaledTime != null)
            {
                unscaledTime = (bool)newUnscaledTime;
            }

            if (customHideDelay != null)
            {
                HideDelay = (float)customHideDelay;
            }

            if (slideUpOnHide != null)
            {
                SlideUpOnHide = (bool)slideUpOnHide;
            }

            if (showAnimation != null)
            {
                ShowAnimation = showAnimation;
            }

            if (hideAnimation != null)
            {
                HideAnimation = hideAnimation;
            }

            if (sequenceType != NotifySequence.None)
            {
                NotifyManager.Add(this, sequenceType);
            }
            else
            {
                Display();
            }
        }
Example #7
0
		/// <summary>
		/// Show the notification.
		/// </summary>
		/// <param name="message">Message.</param>
		/// <param name="customHideDelay">Custom hide delay.</param>
		/// <param name="container">Container. Parent object for current notification.</param>
		/// <param name="showAnimation">Function used to run show animation.</param>
		/// <param name="hideAnimation">Function used to run hide animation.</param>
		/// <param name="slideUpOnHide">Start slide up animations after hide current notification.</param>
		/// <param name="sequenceType">Add notification to sequence and display in order according specified sequenceType.</param>
		/// <param name="sequenceDelay">Time between previous notification was hidden and next will be showed.</param>
		/// <param name="clearSequence">Clear notifications sequence and hide current notification.</param>
		public void Show(string message = null,
		                 float? customHideDelay = null,
		                 Transform container = null,
		                 Func<Notify,IEnumerator> showAnimation = null,
		                 Func<Notify,IEnumerator> hideAnimation = null,
		                 bool? slideUpOnHide = null,
		                 NotifySequence sequenceType = NotifySequence.None,
		                 float sequenceDelay = 0.3f,
		                 bool clearSequence = false)
		{
			if (clearSequence)
			{
				NotifyManager.Clear();
			}

			SequenceDelay = sequenceDelay;

			oldShowAnimation = ShowAnimation;
			oldHideAnimation = HideAnimation;
			if ((message!=null) && (text!=null))
			{
				text.text = message;
			}

			if (container!=null)
			{
				transform.SetParent(container, false);
			}

			if (customHideDelay!=null)
			{
				HideDelay = (float)customHideDelay;
			}

			if (slideUpOnHide!=null)
			{
				SlideUpOnHide = (bool)slideUpOnHide;
			}

			if (showAnimation!=null)
			{
				ShowAnimation = showAnimation;
			}

			if (hideAnimation!=null)
			{
				HideAnimation = hideAnimation;
			}

			if (sequenceType!=NotifySequence.None)
			{
				NotifyManager.Add(this, sequenceType);
			}
			else
			{

				Display();
			}
		}
Example #8
0
        /// <summary>
        /// Show the notification.
        /// </summary>
        /// <param name="message">Message.</param>
        /// <param name="customHideDelay">Custom hide delay.</param>
        /// <param name="container">Container. Parent object for current notification.</param>
        /// <param name="showAnimation">Function used to run show animation.</param>
        /// <param name="hideAnimation">Function used to run hide animation.</param>
        /// <param name="slideUpOnHide">Start slide up animations after hide current notification.</param>
        /// <param name="sequenceType">Add notification to sequence and display in order according specified sequenceType.</param>
        /// <param name="sequenceDelay">Time between previous notification was hidden and next will be showed.</param>
        /// <param name="clearSequence">Clear notifications sequence and hide current notification.</param>
        /// <param name="newUnscaledTime">Use unscaled time.</param>
        public void Show(string message        = null,
                         float?customHideDelay = null,
                         Transform container   = null,
                         Func <Notify, IEnumerator> showAnimation = null,
                         Func <Notify, IEnumerator> hideAnimation = null,
                         bool?slideUpOnHide          = null,
                         NotifySequence sequenceType = NotifySequence.None,
                         float sequenceDelay         = 0.3f,
                         bool clearSequence          = false,
                         bool?newUnscaledTime        = null)
        {
            if (ClosedEvent == null)
            {
                ClosedEvent = new UnityEvent();
            }

            if (clearSequence)
            {
                NotifyManager.Clear();
            }

            SequenceDelay = sequenceDelay;

            oldShowAnimation = ShowAnimation;
            oldHideAnimation = HideAnimation;

            SetMessage(message);

            if (container != null)
            {
                transform.SetParent(container, false);
            }

            if (newUnscaledTime != null)
            {
                unscaledTime = (bool)newUnscaledTime;
            }

            if (customHideDelay != null)
            {
                HideDelay = (float)customHideDelay;
            }

            if (slideUpOnHide != null)
            {
                SlideUpOnHide = (bool)slideUpOnHide;
            }

            if (showAnimation != null)
            {
                ShowAnimation = showAnimation;
            }

            if (hideAnimation != null)
            {
                HideAnimation = hideAnimation;
            }

            if (sequenceType != NotifySequence.None)
            {
                NotifyManager.Add(this, sequenceType);
            }
            else
            {
                Display();
            }
        }