Exemplo n.º 1
0
    public override string RenderHint()
    {
        var income      = Economy.GetCompanyIncome(Q, SelectedCompany);
        var maintenance = Economy.GetCompanyMaintenance(Q, SelectedCompany);

        var bonus = new Bonus <long>("Balance change")
                    .Append("Income", income)
                    //.AppendAndHideIfZero("Maintenance cost", SelectedCompany.hasProduct ? -Economy.GetDevelopmentCost(SelectedCompany, GameContext) : 0)
                    .AppendAndHideIfZero("Maintenance", -maintenance)
                    .MinifyValues();

        return(bonus.ToString());
    }
    public override void ViewRender()
    {
        base.ViewRender();


        var company   = SelectedCompany;    // Companies.Get(Q, companyId);
        int companyId = company.company.Id; // GetComponent<SetTargetCompany>().companyId;

        Income.text = "$" + Format.Minify(Economy.GetCompanyIncome(Q, company));
        IncomeHint.SetHint(GetIncomeDescription(Q, companyId));

        Maintenance.text = "$" + Format.Minify(Economy.GetCompanyMaintenance(Q, company));
        MaintenanceHint.SetHint(GetMaintenanceDescription(Q, companyId));
    }
    void PayAIDividends(GameEntity e)
    {
        long marketingBudget = 0;

        if (e.hasProduct)
        {
            marketingBudget = Marketing.GetBrandingCost(e, gameContext) + Marketing.GetTargetingCost(e, gameContext);
        }


        var dividends = Economy.BalanceOf(e) - Economy.GetCompanyMaintenance(gameContext, e) - marketingBudget;

        if (dividends > 0)
        {
            Companies.PayDividends(gameContext, e, dividends);
        }
    }
Exemplo n.º 4
0
    void Render()
    {
        if (niche == null)
        {
            return;
        }

        SetPanelColor();

        var nicheType = niche.niche.NicheType;

        GetComponent <LinkToNicheInfo>().SetNiche(nicheType);

        RenderMarketName(nicheType);


        DescribePhase();
        //var growth = NicheUtils.GetAbsoluteAnnualMarketGrowth(GameContext, entity);

        MonetisationType.text = Enums.GetFormattedMonetisationType(niche);

        RenderTimeToMarket();

        var sumOfBrandPowers = (int)Marketing.GetSumOfBrandPowers(niche, Q);

        //
        var profitLeader = Markets.GetMostProfitableCompanyOnMarket(Q, niche);

        var profit             = profitLeader == null ? 0 : Economy.GetProfit(Q, profitLeader);
        var income             = profitLeader == null ? 0 : Economy.GetCompanyIncome(Q, profitLeader);
        var biggestMaintenance = profitLeader == null ? 0 : Economy.GetCompanyMaintenance(Q, profitLeader);

        // maintenance
        Maintenance.text = Visuals.Positive(Format.MinifyMoney(income));

        bool canMaintain = Economy.IsCanMaintain(MyCompany, Q, biggestMaintenance);

        StartCapital.text = Visuals.Colorize(Format.MinifyMoney(biggestMaintenance), canMaintain);
        // income
        var ROI = Markets.GetMarketROI(Q, niche);

        NicheSize.text  = profitLeader == null ? "???" : ROI + "%";
        NicheSize.color = Visuals.GetColorPositiveOrNegative(profit);
    }
    private string GetGroupMaintenanceDescription(GameContext context, int companyId)
    {
        string description = "Group maintenance:\n";

        var holdings = Companies.GetCompanyHoldings(context, companyId, false);

        foreach (var h in holdings)
        {
            var c = Companies.Get(context, h.companyId);

            string name       = c.company.Name;
            long   income     = Economy.GetCompanyMaintenance(context, c);
            string tiedIncome = Format.Minify(h.control * income / 100);

            description += $"\n  {name}: -${tiedIncome} ({h.control}%)";
        }

        return(description);
    }