コード例 #1
0
ファイル: ConclusionCard.cs プロジェクト: MMike17/Koei
 public bool IsCorrelated(Punchline punchline)
 {
     return(punchline.subCategory == conclusion.correctedSubCategory);
 }
コード例 #2
0
ファイル: FightManager.cs プロジェクト: MMike17/Koei
    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");
        }
    }