Пример #1
0
        /// <summary>
        /// Функция добавления ачивки в список заработанных и вывода в UI
        /// </summary>
        private void AddAchievement(Achievement achievement, bool showUi = true)
        {
            achievement.Unlocked = true;
            PlayerManager.Data.Achievements.Add(achievement);

            if (!showUi)
            {
                return;
            }

            void Notification()
            {
                newAchievementEffect.Show(newAchievementSprite, () =>
                {
                    var compareValueString       = GetCompareValueString(achievement);
                    var localizedAchievementName = LocalizationManager.Instance.Get(achievement.Type.GetDescription());
                    var achievementString        = $"{localizedAchievementName}: {compareValueString}";
                    var description = "Some description"; // todo: Добавить дескриптион для ачивки

                    newAchievementsPage.ShowNewAchievement(achievementString, description);
                }, true);
            }

            NotificationManager.Instance.AddIndependentNotification(Notification);
        }
Пример #2
0
        /// <summary>
        /// Разблокирует тиммейта
        /// </summary>
        private void UnlockTeammate(Teammate teammate)
        {
            teammate.Skill.Value = 1;
            teammate.HasPayment  = true;

            void Notification()
            {
                var info = GetInfo(teammate.Type);

                newTeammateEffect.Show(
                    info.Avatar,
                    () => unlockTeammatePage.Show(teammate, info.Avatar)
                    );
            }

            NotificationManager.Instance.AddClickNotification(Notification);
        }
Пример #3
0
        /// <summary>
        /// Событие нажатия кнопки "Купить"
        /// </summary>
        private void OnPurchaseItemClick(GoodsType type, short level, int price)
        {
            if (!PlayerManager.Instance.SpendMoney(price))
            {
                //todo: какая-то оповещалка, что "недостаточно средств"
                print("Не хватает золота!");
                return;
            }

            var good = PlayerManager.Data.Goods.FirstOrDefault(g => g.Type == type);

            if (good == null)
            {
                good = new Good {
                    Type = type
                };
                PlayerManager.Data.Goods.Add(good);
            }
            good.Level = level;

            void Notification()
            {
                Debug.LogWarning($"Показ шмотки {good.Type}_{good.Level}. Кликни в центр.");

                var uIData = GetGoodUi(good.Type, good.Level);

                _newGoodEffect.Show(uIData.Image, NotificationManager.Instance.UnlockIndependentQueue);
            }

            NotificationManager.Instance.AddIndependentNotification(Notification);

            var info = _goodInfos.First(gi => gi.Type == type);

            if (level + 1 > info.MaxItemLevel)
            {
                DisposeItem(type, level);
            }
            else
            {
                DrawItem(type, level, true);
            }
        }