コード例 #1
0
    void RefreshButtons()
    {
        Country         playerCountry   = CountryManager.instance.PlayerCountry;
        CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(playerCountry, currentCountry);
        float           relationAmount  = countryRelation.GetAmount();

        if (relationAmount >= 0)
        {
            makePeaceButton.gameObject.SetActive(false);
            makeWarButton.gameObject.SetActive(true);
        }
        else
        {
            if (relationAmount >= -10)
            {
                makePeaceButton.gameObject.SetActive(true);
            }
            else
            {
                makePeaceButton.gameObject.SetActive(false);
            }

            makeWarButton.gameObject.SetActive(false);
        }
    }
コード例 #2
0
    void RefreshRelationBar()
    {
        Country         playerCountry   = CountryManager.instance.PlayerCountry;
        CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(playerCountry, currentCountry);

        float amount = countryRelation.GetAmount();

        //Fill UI realtions bar
        if (amount > 0)
        {
            goodProgressImg.fillAmount = amount / CountryRelation.maxAmount;
            badProgressImg.fillAmount  = 0;
        }
        else if (amount < 0)
        {
            goodProgressImg.fillAmount = 0;
            badProgressImg.fillAmount  = amount / CountryRelation.minAmount;
        }
        else
        {
            goodProgressImg.fillAmount = 0;
            badProgressImg.fillAmount  = 0;
        }
    }