public void SetValue(MainGui gui, Charateristic value, Charateristic parent, Charateristic champion)
    {
        Name.text        = value.CharateristicType.ToString();
        Value.text       = value.Value.ToString();
        ParentValue.text = parent.Value.ToString();
        int championValue = champion == null ? 0 : champion.Value;

        ChampionValue.text = champion == null ? string.Empty : championValue.ToString();
        if (value.Value > parent.Value || (value.Value > championValue && championValue != 0))
        {
            Value.color         = gui.GameColors.Best;
            ParentValue.color   = value.Value > parent.Value ? gui.GameColors.Worst : Color.black;
            ChampionValue.color = value.Value > championValue ? gui.GameColors.Worst : Color.black;
        }
        else if (value.Value < parent.Value || (value.Value < championValue && championValue != 0))
        {
            Value.color         = gui.GameColors.Worst;
            ParentValue.color   = value.Value < parent.Value ? gui.GameColors.Best : Color.black;
            ChampionValue.color = value.Value < championValue ? gui.GameColors.Best : Color.black;
        }
        else
        {
            Value.color         = Color.black;
            ParentValue.color   = Color.black;
            ChampionValue.color = Color.black;
        }
    }
Esempio n. 2
0
    private void RefreshDetail(House house)
    {
        Detail.SetActive(Guy != null && Guy.Id != 0);
        if (Guy != null && Guy.Id != 0)
        {
            Detail.GetComponent <Image>().color = Guy.Man ? GameColors.Man : GameColors.Woman;
            GuyName.text   = Guy.FamillyName + ":" + Guy.Id;
            GuyParent.text = Guy.Man ? "Dad" : "Mom";
            for (int i = 0; i < 8; i++)
            {
                Charateristic parent   = Guy.Man ? house.Dad.Charateristics[i] : house.Mom.Charateristics[i];
                Charateristic champion = house.Champion == null || house.Champion.Id == 0 ? null : house.Champion.Charateristics[i];

                Charateristics[i].SetValue(this, Guy.Charateristics[i], parent, champion);
            }

            PromoteParent.interactable   = Guy != house.Dad && Guy != house.Mom && Guy != house.Champion;
            PromoteChampion.interactable = Guy != house.Dad && Guy != house.Mom && Guy != house.Champion;
            PromoteParent.GetComponentInChildren <Text>().text = Guy.Man ? "Promote Dad" : "Promote Mom";
            Sacrifice.interactable    = Guy != house.Dad && Guy != house.Mom && Guy != house.Champion;
            PromoteHouse.interactable = Guy != house.Dad && Guy != house.Mom && Guy != house.Champion && house.HouseGuys.Count < house.HouseSize && house.Nurcery.Contains(Guy);

            for (int index = 0; index < this.Tabs.Length; index++)
            {
                if (index == HouseIndex)
                {
                    TransfertButtons[index].GetComponent <Button>().interactable = false;
                }
                else
                {
                    TransfertButtons[index].GetComponent <Button>().interactable = Guy != house.Dad && Guy != house.Mom && Guy != house.Champion;
                }

                if (index < Engine.Houses.Count)
                {
                    TransfertButtons[index].GetComponent <Button>().interactable &=
                        Engine.Houses[index].HouseGuys.Count < Engine.Houses[index].HouseSize;
                    TransfertButtons[index].GetComponentInChildren <Text>().text = "Transfert to " +
                                                                                   Engine.Houses[index].Type.ToString();

                    TransfertButtons[index].gameObject.SetActive(true);
                }
                else
                {
                    TransfertButtons[index].gameObject.SetActive(false);
                }
            }
        }
    }