Example #1
0
        protected override void Start()
        {
            base.Start();

            buttons = gameState.GetAllStartupNodeNames().Select(chapter =>
            {
                var chapterButton = Instantiate(chapterButtonPrefab, chapterList.transform);
                var button        = chapterButton.GetComponent <Button>();
                button.onClick.AddListener(() => Hide(() => BeginChapter(chapter)));
                return(new KeyValuePair <string, GameObject>(chapter, chapterButton));
            }).ToDictionary(p => p.Key, p => p.Value);
        }
Example #2
0
        public override void Show(Action onFinish)
        {
            base.Show(() =>
            {
                viewManager.dialoguePanel.SetActive(false);
                viewManager.StopAllAnimations();
                gameState.ResetGameState();

                if (bgmController != null && !string.IsNullOrEmpty(bgmName))
                {
                    bgmController.scriptVolume = bgmVolume;
                    bgmController.Play(bgmName);
                }

                var reachedChapterCount = gameState.GetAllStartupNodeNames()
                                          .Count(name => checkpointManager.IsReachedForAnyVariables(name, 0) != null);
                if (reachedChapterCount > 1 && configManager.GetInt(ChapterFirstUnlockedKey) == 0)
                {
                    Alert.Show(I18n.__("title.first.selectchapter"));
                    configManager.SetInt(ChapterFirstUnlockedKey, 1);
                }

                onFinish?.Invoke();
            });
        }