Inheritance: MonoBehaviour
コード例 #1
0
ファイル: LWInterface.cs プロジェクト: gradylorenzo/LiveWorld
 //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;
 }
コード例 #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");
        }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
        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;
        }
コード例 #5
0
 private void OnNotification(object sender, Notification n)
 {
     this.ActivateTrigger(n);
 }
コード例 #6
0
 public abstract void ProcessNotification(Notification notification);
コード例 #7
0
ファイル: NetworkConnection.cs プロジェクト: benloong/recipes
 /// <summary>
 /// Posts one completion notification
 /// </summary>
 /// <param name='handler'>
 /// completion notify 
 /// </param>
 void PostNotification(Notification handler)
 {
     lock (notifications) {
         notifications.Enqueue(handler);
     }
 }
コード例 #8
0
 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;
     }
 }
コード例 #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);
        }