Esempio n. 1
0
        private void Awake()
        {
            var i = 0;

            foreach (var level in _levelsInfo.LevelInfos)
            {
                var levelCard = _factory.Create();
                levelCard.transform.SetParent(levelsTransform);
                levelCard.SetInfo(level, i, ActionOnClick);

                levelCard.Select(false);
                if (!_currentCard || i == Scores.Instance.SelectedLevel)
                {
                    _currentCard = levelCard;
                }
                i++;
            }
            _currentCard.Select(true);

            if (GameInfo.gameType == GameType.Online)
            {
                nextButton.onClick.AddListener(StartOnlineGame);
            }
            else
            {
                nextButton.onClick.AddListener(StartOfflineGame);
            }
        }
Esempio n. 2
0
 private void ActionOnClick(LevelCard card)
 {
     if (_currentCard == card)
     {
         return;
     }
     GameInfo.selectedLevel = card.Index;
     _currentCard.Select(false);
     _currentCard = card;
     _currentCard.Select(true);
     Scores.Save();
 }