IEnumerator IEShowNotification(GameObject go, TPAchievement achievement) { OnNotifyActive(go, true); if (WaitSeconds != achievement.NotifyLong) { WaitSeconds = achievement.NotifyLong; Waiter = new WaitForSeconds(achievement.NotifyLong); } yield return(Waiter); OnNotifyActive(go, false); yield return(Waiter); if (Until == null) { Until = new WaitUntil(() => !go.activeSelf); } yield return(Until); if (AchievementQueue.Count > 0) { ShowNotification(); } else { IsNotify = false; } }
public void CompleteAchievement(TPAchievement achievement, bool showNotification) { achievement.Points = achievement.MaxPoints; achievement.IsCompleted = true; if (showNotification) { ShowNotification(achievement); } }
public void SetNotification(TPAchievement achievement) { OnAchievement = achievement; iconImage.sprite = achievement.Icon; titleText.text = achievement.Title; descriptionText.text = achievement.Description; pointsText.text = achievement.Points.ToString(); maxPointsText.text = achievement.MaxPoints.ToString(); }
public void ShowNotification(TPAchievement achievement) { if (!AchievementQueue.Contains(achievement)) { AchievementQueue.Enqueue(achievement); if (!IsNotify) { ShowNotification(); } } }
GameObject GetNotificationObject(TPAchievement achievement) { int length = _NotifyGO.Count; string _name = achievement.Notification.gameObject.name; if (_NotifyGO.ContainsKey(_name)) { return(_NotifyGO[_name]); } return(null); }
/// <param name="achievement"></param> /// <param name="value">How many points add to achievement?</param> /// <param name="showProgressNotify">Should show notification with progress?</param> /// <param name="showNotifyAfterCompleted">Should show notification if achievement will'be completed after adding points?</param> public void AddPointTo(TPAchievement achievement, float value, bool showProgressNotify, bool showNotifyAfterCompleted) { if (achievement.IsCompleted) { return; } achievement.Points += value; if (achievement.Points >= achievement.MaxPoints) { CompleteAchievement(achievement, showNotifyAfterCompleted); return; } if (showProgressNotify) { ShowNotification(achievement); } }
void ShowNotification() { IsNotify = true; TPAchievement achievement = AchievementQueue.Dequeue(); GameObject GO = achievement.Notification.gameObject; if (!_NotifyGO.ContainsKey(GO.name)) { string _GOName = GO.name; GO = Instantiate(GO); GO.SetActive(false); _NotifyGO.Add(_GOName, GO); } else { GO = GetNotificationObject(achievement); } TPNotification notification = GO.GetComponent <TPNotification>(); OnNotifySet(notification, achievement); StartCoroutine(IEShowNotification(GO, achievement)); }
void SetNotification(TPNotification notification, TPAchievement achievement) { notification.SetNotification(achievement); }