// called when we get to the title panel void InitTitlePanel() { Skinning.ResetSkin(selectedSkin); if (titleManager == null) { Debug.LogError(debuguableInterface.debugLabel + "TitleManager component shouldn't be null. If we can't get scene references we can't do anything."); return; } titleManager.Init( () => panelManager.JumpTo(GamePhase.INTRO, () => { introManager = FindObjectOfType <IntroManager>(); audioProjectManager.FadeMusicOut(); }), () => Application.Quit() ); }
public void Init(bool useCheats, GeneralPunchlines punchlines, GeneralDialogue dialogue, AudioProjectManager audioProject, Action toConsequencesCallback) { normalFont = FindObjectOfType <TextMeshProUGUI>().font; initializableInterface.InitInternal(); this.useCheats = useCheats; gamePunchlines = punchlines; toConsequences = toConsequencesCallback; audioProjectManager = audioProject; foreach (Transform child in sakuraParent) { child.GetComponent <Image>().color = sakuraColor; } katanaSlider.gameObject.SetActive(false); gongSlider.Init(() => { audioProjectManager.FadeMusicOut(0); AudioManager.PlaySound("Gong"); }, StartFinalPunchlines); lifePoints = new List <Animator>(); // spawns life points for (int i = 0; i < actualCombat.allowedErrors; i++) { Animator spawned = null; spawned = Instantiate(lifePrefab, triesHolder).GetComponent <Animator>(); lifePoints.Add(spawned); } categoryButtons.ForEach(item => item.Init(ShowPunchlines, gamePunchlines, streetFont)); spawnedConclusions = new List <ConclusionCard>(); // spawns conclusions foreach (Conclusion conclusion in dialogue.unlockableConclusions) { ConclusionCard spawned = Instantiate(conclusionPrefab, conclusionScroll); spawned.Init(conclusion); spawned.comment.font = streetFont; spawned.comment.wordSpacing = 5; spawnedConclusions.Add(spawned); } // finisher buttons for (int i = 0; i < finisherPunchlineButtons.Length; i++) { finisherPunchlineButtons[i].transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().text = actualCombat.finisherPunchlines.finishers[i]; finisherPunchlineButtons[i].transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().font = streetFont; finisherPunchlineButtons[i].transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().wordSpacing = 5; int j = i; finisherPunchlineButtons[i].onClick.AddListener(() => { selectedFinisher = actualCombat.finisherPunchlines.finishers[j]; isGoodFinisher = j == actualCombat.finisherPunchlines.correctOne; canvasAnimator.Play("PanDown"); Invoke("ShowAttackLines", 1); AudioManager.PlaySound("Button"); SetCanvasInterractable(false); actualPhase = Phase.EFFECT_FINAL; }); ColorBlock colors = finisherPunchlineButtons[i].colors; colors.normalColor = Skinning.GetSkin(SkinTag.SECONDARY_WINDOW); colors.highlightedColor = Skinning.GetSkin(SkinTag.PRIMARY_WINDOW); colors.pressedColor = Skinning.GetSkin(SkinTag.CONTRAST); finisherPunchlineButtons[i].colors = colors; } errorCount = 0; sakuraTimer = 0; trueSakuraDelay = UnityEngine.Random.Range(sakuraDelay.x, sakuraDelay.y); isGoodFinisher = false; gotToFinisher = false; invokedTransition = false; destructionAsked = false; isStartingGameOver = false; usedPunchlines = new List <Punchline>(); canvasAnimator.Play("Intro"); AudioManager.PlaySound("Wind"); Invoke("StartDialogue", 3); Debug.Log(debugableInterface.debugLabel + "Initializing done"); }