Exemplo n.º 1
0
 public ClassNode GetCurrentClass()
 {
     if (currentClass.Length == 0)
     {
         return(null);
     }
     return(StaticClassRef.GetClass((StaticClassRef.AvailableClasses)Enum.Parse(typeof(StaticClassRef.AvailableClasses), currentClass)));
 }
Exemplo n.º 2
0
    void PopulateClassesPanel()
    {
        classPnl.SetActive(true);
        classBtn.GetComponent <Outline>().effectColor = Color.red;
        GameMeta game      = BaseSaver.GetGame();
        string   pnlString = "";

        classPnl.transform.GetChild(1).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = pnlString;
        classPnl.transform.GetChild(1).GetChild(1).GetChild(0).GetComponent <Animator>().runtimeAnimatorController = null;
        classPnl.transform.GetChild(1).GetChild(1).GetChild(0).GetComponent <ImageAnimation>().Flush();
        classPnl.transform.GetChild(1).GetChild(2).GetComponent <TextMeshProUGUI>().text = pnlString;
        classPnl.transform.GetChild(1).GetChild(3).GetComponent <TextMeshProUGUI>().text = pnlString;

        string[] clssSeen = game.classesSeen.Where(clss => !(clss.Contains("BaseMage") || clss.Contains("BaseScout") || clss.Contains("BaseSoldier"))).ToArray();

        if (clssSeen.Length > 0)
        {
            game.classesSeen = game.classesSeen.OrderBy(nm => nm).ToArray();

            classPnl.transform.GetChild(0).GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(800, 150 * game.classesSeen.Length);

            foreach (Transform child in classPnl.transform.GetChild(0).GetChild(0))
            {
                Destroy(child.gameObject);
            }

            //string[] clssSeen = game.classesSeen.Where(clss => !(clss.Contains("BaseMage") || clss.Contains("BaseScout") || clss.Contains("BaseSoldier"))).ToArray();

            for (int i = 0; i < clssSeen.Length; i++)
            {
                //foreach(string clss in game.classesSeen.Where(clss => !(clss.Contains("BaseMage") || clss.Contains("BaseScout") || clss.Contains("BaseSoldier"))).ToArray()){
                string     clss    = clssSeen[i];
                GameObject clssCpy = Instantiate(clssRw, classPnl.transform.GetChild(0).GetChild(0));
                clssCpy.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = ClassNode.FormatClass(clss);
                ClassNode nde      = StaticClassRef.GetClass((StaticClassRef.AvailableClasses)Enum.Parse(typeof(StaticClassRef.AvailableClasses), clss));
                UnitProxy baseUnit = ClassNode.ComputeClassBaseUnit(nde, glossy);
                clssCpy.transform.GetChild(1).GetComponent <Image>().sprite         = baseUnit.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
                clssCpy.transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = " " + ClassNode.GetFactionFromClass(clss);
                clssCpy.GetComponent <Button>().onClick.AddListener(() => {
                    instance.SetClassInfoText("Battle Bonus: " + StaticClassRef.GetFullClassDescription(clss) + "\n\nInactive Bonus: " + nde.ClassInactiveDesc(), StaticClassRef.GetClassByReference(clss).ClassName(),
                                              ClassNode.GetClassHeirarchyString(nde));
                    instance.SetClassSpriteAnimator(baseUnit.transform.GetChild(0).GetComponent <Animator>());
                });
                if (i == 0)
                {
                    clssCpy.GetComponent <Button>().onClick.Invoke();
                }
            }
            classPnl.transform.GetChild(0).GetComponent <ScrollRect>().normalizedPosition = new Vector2(0, 1);
        }
        else
        {
            SetClassInfoText("", "", "No classes found yet... Explore a little bit more and maybe something will be here!");
        }
    }