コード例 #1
0
    public void SetEntity(GameEntity c, bool darkImage, bool ShowIncome)
    {
        company         = c;
        EnableDarkTheme = darkImage;

        bool hasControl = Companies.GetControlInCompany(MyCompany, c, Q) > 0;

        Name.text  = c.company.Name; // .Substring(0, 1);
        Name.color = Visuals.GetColorFromString(hasControl ? Colors.COLOR_CONTROL : Colors.COLOR_NEUTRAL);
        SetEmblemColor();

        LinkToProjectView.CompanyId = c.company.Id;
        ShowProductChanges.SetEntity(company);

        var change = Marketing.GetAudienceChange(c, Q);

        var changeBonus = Marketing.GetAudienceChange(company, Q, true);


        CompanyGrowth.text  = Format.SignOf(change) + Format.Minify(change);
        CompanyGrowth.color = Visuals.GetColorPositiveOrNegative(change);
        CompanyGrowth.GetComponent <Hint>().SetHint($"Audience change: <b>{Format.Minify(change)}</b>");

        CompanyHint.SetHint(GetCompanyHint(hasControl));

        var clients = Marketing.GetUsers(company);

        Concept.text = ShowIncome ? Format.Money(Economy.GetIncome(Q, company), true) : Format.Minify(clients); // Products.GetProductLevel(c) + "LVL";

        var position = Markets.GetPositionOnMarket(Q, company);

        PositionOnMarket.text = $"#{position + 1}";

        var marketShare = Companies.GetMarketShareOfCompanyMultipliedByHundred(c, Q);
        var lastMetrics = CompanyStatisticsUtils.GetLastMetrics(company, 1);

        var lastShare   = Random.Range(2f, 30f);
        var shareChange = marketShare - lastShare;

        //Animate(Visuals.Colorize(Format.SignOf((long)shareChange) + shareChange.ToString("0.0%"), shareChange >= 0), AnimationPosition);

        if (Profitability != null)
        {
            //var shareChange = 1;
            //Profitability.text = Visuals.DescribeValueWithText(shareChange, marketShare + "%", marketShare + "%", "");

            Profitability.text = Visuals.Positive(marketShare + "%");
        }
    }
コード例 #2
0
    void Render()
    {
        var company = Companies.Get(Q, companyId);

        Brand.text = (int)company.branding.BrandPower + "";

        Valuation.text = Format.Money(Economy.CostOf(company, Q));

        var lastMonthMetrics = CompanyStatisticsUtils.GetLastMetrics(company, 4);
        var currentMetrics   = CompanyStatisticsUtils.GetLastMetrics(company, 1);

        var costGrowth = currentMetrics.Valuation - lastMonthMetrics.Valuation;
        var profit     = Economy.GetProfit(Q, company);

        ValuationGrowth.text  = (costGrowth > 0 ? "+" : "") + Format.Money(costGrowth, true);
        ValuationGrowth.color = Visuals.GetColorPositiveOrNegative(costGrowth > 0);

        Profit.text  = "Profit: " + Format.Money(profit, true);
        Profit.color = Visuals.GetColorPositiveOrNegative(profit > 0);

        var daughters = Companies.GetDaughtersAmount(company);

        NumberOfDaughters.text = daughters < 2 ? "" : daughters.ToString();

        // name
        var isPlayerRelated = Companies.IsDirectlyRelatedToPlayer(Q, company);
        var nameColor       = isPlayerRelated ? Colors.COLOR_COMPANY_WHERE_I_AM_CEO : Colors.COLOR_COMPANY_WHERE_I_AM_NOT_CEO;

        if (Companies.IsHaveStrategicPartnershipAlready(company, MyCompany))
        {
            nameColor = Colors.COLOR_PARTNERSHIP;
        }

        Name.text  = company.company.Name;
        Name.color = Visuals.GetColorFromString(nameColor);

        // link to project
        LinkToProjectView.CompanyId = company.company.Id;
    }