void OnObjectiveUpdateEvent(ObjectiveUpdateEvent evt)
 {
     if (!string.IsNullOrEmpty(evt.NotificationText))
     {
         CreateNotification(evt.NotificationText);
     }
 }
Beispiel #2
0
        void OnUpdateObjective(ObjectiveUpdateEvent evt)
        {
            if (m_ObjectivesDictionnary.TryGetValue(evt.Objective, out ObjectiveToast toast) && toast != null)
            {
                // set the new updated description for the objective, and forces the content size fitter to be recalculated
                Canvas.ForceUpdateCanvases();
                if (!string.IsNullOrEmpty(evt.DescriptionText))
                {
                    toast.DescriptionTextContent.text = evt.DescriptionText;
                }

                if (!string.IsNullOrEmpty(evt.CounterText))
                {
                    toast.CounterTextContent.text = evt.CounterText;
                }

                if (toast.GetComponent <RectTransform>())
                {
                    UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(toast.GetComponent <RectTransform>());
                }
            }
        }