示例#1
0
    public Conclusion(Category category, SubCategory subCategory, ConclusionCard card)
    {
        this.category    = category;
        this.subCategory = subCategory;

        cardObject = card;
    }
示例#2
0
    void SpawnConclusions(List <Conclusion> unlockableConclusions, GameData.GameState state)
    {
        conclusionsToUnlock = new List <Conclusion>();

        foreach (Conclusion conclusion in unlockableConclusions)
        {
            ConclusionCard spawned = Instantiate(cardPrefab, cardList);

            spawned.Init(conclusion);

            if (state == GameData.GameState.GAME_OVER_FINISHER)
            {
                spawned.ShowCard();
            }
            else
            {
                spawned.HideCard();
            }

            conclusionsToUnlock.Add(new Conclusion(conclusion.category, conclusion.correctedSubCategory, spawned));
        }
    }
示例#3
0
    void ShowPunchlines(List <Punchline> punchlines, Category buttonCategory)
    {
        selectedCategory = buttonCategory;

        AudioManager.PlaySound("Button");
        Invoke("Swish", 0.4f);

        foreach (Transform transform in punchlineScroll)
        {
            Destroy(transform.gameObject);
        }

        foreach (Punchline punchline in punchlines)
        {
            Button temp = Instantiate(punchlinePrefab, punchlineScroll);
            temp.onClick.AddListener(() =>
            {
                usedPunchlines.Add(punchline);
                selectedPunchline = punchline;

                actualPhase = Phase.EFFECT_GENERAL;

                canvasAnimator.Play("PanDown");
                Invoke("ShowAttackLines", 1);

                AudioManager.PlaySound("Button");

                ConclusionCard selected = null;

                spawnedConclusions.ForEach(item =>
                {
                    if (item.IsCorrelated(punchline))
                    {
                        selected = item;
                    }
                });

                if (selected != null)
                {
                    spawnedConclusions.Remove(selected);
                    Destroy(selected.gameObject);
                }

                SetCanvasInterractable(false);

                foreach (Transform transform in punchlineScroll)
                {
                    Destroy(transform.gameObject);
                }
            });

            if (string.IsNullOrEmpty(punchline.line))
            {
                temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponentInChildren <TextMeshProUGUI>().text = punchline.subCategory.ToString();
            }
            else
            {
                temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponentInChildren <TextMeshProUGUI>().text = punchline.line;
            }

            Color categoryColor = GameData.GetColorFromCategory(GameData.GetCategoryFromSubCategory(punchline.subCategory));

            ColorBlock colors = temp.colors;
            colors.normalColor      = Skinning.GetSkin(SkinTag.SECONDARY_WINDOW);
            colors.pressedColor     = categoryColor;
            colors.highlightedColor = ColorTools.LerpColorValues(categoryColor, ColorTools.Value.SV, new int[2] {
                -20, -30
            });
            colors.disabledColor = Skinning.GetSkin(SkinTag.PRIMARY_WINDOW);
            temp.colors          = colors;

            temp.interactable = !usedPunchlines.Contains(punchline);
            temp.transform.GetChild(0).GetComponent <Image>().color = temp.interactable ? Skinning.GetSkin(SkinTag.SECONDARY_ELEMENT) : Skinning.GetSkin(SkinTag.SECONDARY_WINDOW);

            temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().font        = streetFont;
            temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().wordSpacing = 5;
            temp.GetComponent <Animator>().Play("Open");
        }
    }
示例#4
0
    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");
    }