示例#1
0
        private static void GenerateNotification(Notification notification, Notification.Data data)
        {
            if (Instance._showingNotifications.Count >= Instance.MaxNotificationsOnScreen)
            {
                Instance._notificationQueue.Enqueue(
                    new KeyValuePair <Notification, Notification.Data>(notification, data));
                return;
            }

            Notification.Create(notification, data);
        }
示例#2
0
 private static bool IsKeyValid(string key, out Notification.Data data, Notification.Data originalData)
 {
     data = originalData;
     if (string.IsNullOrEmpty(key))
     {
         Debug.LogWarning("You did not enter a key. Showing empty or custom data type now..");
     }
     else if (!Instance._notificationEntries.TryGetValue(key, out data))
     {
         Debug.LogError("The key '" + key + "' does not exist in the Notification Entries list");
         return(false);
     }
     return(true);
 }
示例#3
0
        public static void ShowNotification <T>(string key, Notification.Data data) where T : Notification
        {
            string path = GetPrefabPath <T>();

            if (!IsKeyValid(key, out data, data))
            {
                return;
            }

            Notification notification = Resources.Load <T>(path);

            if (notification == null)
            {
                Debug.LogError("The notification prefab at path '" + path + "' of type '" + typeof(T) +
                               "' could not be found. Did you forget to create it? Hint: The prefab name and the type should always be the same");
                return;
            }

            GenerateNotification(notification, data);
        }
示例#4
0
 public static void ShowNotification <T>(Notification.Data data) where T : Notification
 {
     ShowNotification <T>("", data);
 }