private void loadNewTemplate(ref NotificationView view, string templateId) { NotificationId tempId = view.Id; Destroy(view.gameObject); view = NotificationView.CreateNotificationView(templateId, tempId); }
public void PushNotification(NotificationData data, string notificationIdentifier = "") { if (data.TemplateId == "") { Debug.LogError("[ERROR] TemplateId Not Set"); return; } if (!PrefabManager.IsContainPrefab(data.App, data.TemplateId)) { Debug.LogError("[ERROR] TemplateId Not Found"); return; } NotificationId id = new NotificationId(data.App, notificationIdentifier); NotificationView notificationView; if (!tryGetNotificationView(id, out notificationView)) { notificationView = NotificationView.CreateNotificationView(data.TemplateId, id); } loadNewTemplate(ref notificationView, data.TemplateId); notificationView.ResolveNotificationData(data); notificationView.transform.SetAsFirstSibling(); StartCoroutine(notificationView.ShowTransition(m_lerpSpeed, m_lerpThreshold)); }
void UpdateInfo() { if (!NotificationEditingBehavior.Instance) { return; } NotificationController.LoadViewPrefabs(); //Debug.Log(NotificationController.PrefabManager.GetPrefabList(Utility.App.Text).Length); if (!NotificationViewObject) { NotificationEditingBehavior.Instance.ClearNotificationSpace(); } if (!IsCreating) { if (m_selectedApp != Utility.App.COUNT) { m_templateOption = NotificationEditingBehavior.Instance.NotificationController.PrefabManager.GetTemplateOption(m_selectedApp); } else { m_templateOption = new string[0]; } if (m_templateOption.Length == 0) { m_templateOption = new[] { "" }; if (NotificationViewObject) { GameObject.DestroyImmediate(NotificationViewObject); NotificationViewObject = null; m_notificationData = null; } } else { if (NotificationViewObject) { GameObject.DestroyImmediate(NotificationViewObject); NotificationViewObject = null; m_notificationData = null; } NotificationView notificationView = NotificationView.CreateNotificationView(m_templateOption[m_selectedTemplate], new NotificationController.NotificationId(m_selectedApp, "Editor")); NotificationViewObject = notificationView.gameObject; m_notificationData = NotificationView.CreateDataInstance(); } } else { if (NotificationViewObject) { GameObject.DestroyImmediate(NotificationViewObject); NotificationViewObject = null; m_notificationData = null; } } }