Inheritance: MonoBehaviour
Example #1
0
 //Static class to call when creating a new notification.
 public static void NewNotification(string text, Notification.LWNotificationType Type)
 {
     GameObject newNotification;
     newNotification = Resources.Load("GUI/LWNotificationObject") as GameObject;
     newNotification.GetComponent<Notification>().Text = text;
     newNotification.GetComponent<Notification>().Type = Type;
     Instantiate(newNotification, Vector3.zero, new Quaternion(0, 0, 0, 0));
     newNotification = null;
 }
Example #2
0
        public override void ProcessNotification(Notification notification)
        {
            //            DevHelper.PerformanceManager.StartTimer("InGameConsole_ProcessNotification");

            var consoleLineText = FormatNotification(notification);
            Display(consoleLineText);

            //            var elapsedMs = DevHelper.PerformanceManager.StopTimer("InGameConsole_ProcessNotification");
            //            Debug.Log("Time spent in InGameConsole_ProcessNotification: " + elapsedMs + "ms");
        }
 public void OnNotification(object sender, Notification n)
 {
     var notifType = n.GetType();
     var baseNotifType = typeof(Notification);
     while (baseNotifType.IsAssignableFrom(notifType))
     {
         if (_handlers.ContainsKey(notifType))
         {
             _handlers[notifType].DynamicInvoke(sender, n);
         }
         notifType = notifType.BaseType;
     }
 }
        public override bool Trigger(object arg)
        {
            if (!this.CanTrigger) return false;

            if(_n == null || _n.GetType() != _notification.Type)
            {
                try
                {
                    _n = System.Activator.CreateInstance(_notification.Type) as Notification;
                    if (_n == null) return false;
                }
                catch
                {
                    return false;
                }
            }

            Notification.UnsafePostNotification(this, _n);

            return true;
        }
 private void OnNotification(object sender, Notification n)
 {
     this.ActivateTrigger(n);
 }
 public abstract void ProcessNotification(Notification notification);
Example #7
0
 /// <summary>
 /// Posts one completion notification
 /// </summary>
 /// <param name='handler'>
 /// completion notify 
 /// </param>
 void PostNotification(Notification handler)
 {
     lock (notifications) {
         notifications.Enqueue(handler);
     }
 }
 private bool Check(Notification.Problem problems, HashSet<ushort> category)
 {
     if ((_building.m_problems & problems) != Notification.Problem.None)
     {
         category.Add(_id);
         return true;
     }
     else
     {
         category.Remove(_id);
         return false;
     }
 }
Example #9
0
        private string FormatNotification(Notification notification)
        {
            // [YB] removed the ToRichFormat(White) and changed the default color instead
            // to reduce the number of vertices!

            return String.Format(Format,
                notification.Timestamp.ToFormattedShortTime(true),
                notification.Severity.ToUpper().ToRichFormat(_severityColors[notification.Severity]).ToRichFormatBold(),
                notification.Message,
                notification.Details);
        }