示例#1
0
    public override string RenderValue()
    {
        var churn     = Marketing.GetChurnClients(company, Q);
        var churnRate = Marketing.GetChurnRate(company, Q);

        Colorize(Visuals.GetGradientColor(0, 9, churnRate, true));
        return(Format.Minify(-churnRate) + "% weekly");
        //return Visuals.Negative(Format.Minify(-churn) + " weekly"); // (" + (int)churnRate + "%)
    }
    public override string RenderValue()
    {
        var competitors = Companies.GetDirectCompetitors(Flagship, Q, true);

        var users    = competitors.Sum(c => Marketing.GetUsers(c));
        var avgChurn = competitors.Average(c => Marketing.GetChurnRate(c, Q));

        return("Competitors " + Format.Minify(users) + $" users {avgChurn.ToString("0.0")}%");
    }
示例#3
0
    public override string RenderValue()
    {
        var rate       = Marketing.GetChurnRate(Q, SelectedCompany.company.Id).ToString();
        var churnUsers = Marketing.GetChurnClients(Q, SelectedCompany.company.Id);

        return($"Loses {Format.Minify(churnUsers)} users weekly ({rate}% churn)");

        return($"{Format.Minify(churnUsers)} users ({rate}%)");
        //return MarketingUtils.GetChurnBonus(GameContext, SelectedCompany.company.Id).Sum();
    }
    string GetMarketingActivity(string text, GameEntity product)
    {
        var churn = Marketing.GetChurnRate(product, Q);

        var joinedChannels = product.companyMarketingActivities.Channels.Keys
                             .Select(k => Marketing.GetChannelClientGain(product, k))
                             .Sum();

        text += $"\n{(int)churn}% channels: " + Marketing.GetActiveChannelsCount(product) + $"  +{Format.Minify(joinedChannels)}\n";

        return(text);
    }
示例#5
0
    void Monetize(GameEntity product)
    {
        var remainingFeatures = Products.GetUpgradeableMonetizationFeatures(product);
        var churn             = Marketing.GetChurnRate(product, gameContext);

        if (remainingFeatures.Any() && churn < 4)
        {
            var feature = remainingFeatures.First();

            Products.TryToUpgradeFeature(product, feature, gameContext);

            Companies.LogSuccess(product, $"Added {feature.Name} for profit");
        }
    }
示例#6
0
    public override string RenderHint()
    {
        var churnRate = Marketing.GetChurnRate(company, Q, true);

        return(churnRate.ToString(true));
    }
示例#7
0
    void ManageFeatures(GameEntity product)
    {
        var features = Products.GetUpgradeableRetentionFeatures(product);
        var churn    = Marketing.GetChurnRate(product, gameContext, true);

        if (churn.Sum() > 3)
        {
            // need to lower churn ASAP

            try
            {
                ReduceChurn(product, churn);
            }
            catch (System.Exception ex)
            {
                Debug.LogError("Caught exception while reducing churn in " + product.company.Name);
                Debug.LogError(ex);
            }
        }
        else
        {
            var core = product.team.Teams[0];

            var willMonetize = 0.25f;
            var willInnovate = 0.15f;

            if (!core.Managers.Any())
            {
                Debug.Log("HAS NO MANAGERS in " + product.company.Name);
            }
            else
            {
                var ceo = core.Managers[0];

                bool isGreedy   = Humans.HasTrait(ceo, Trait.Greedy);
                bool isCreative = Humans.HasTrait(ceo, Trait.Visionaire) || Humans.HasTrait(ceo, Trait.WantsToCreate);

                if (isGreedy)
                {
                    willMonetize = 0.8f;
                }

                if (isCreative)
                {
                    willInnovate = 0.9f;
                }
            }

            // monetize
            if (!product.isRelease)
            {
                // innovate
            }
            else
            {
                if (Random.Range(0, willMonetize + willInnovate) < willMonetize)
                {
                    // monetize
                }
                else
                {
                    // innovate
                }
            }


            // monetize?

            // go for innovations
        }

        return;

        // random development
        foreach (var f in features)
        {
            Products.TryToUpgradeFeature(product, f, gameContext);
        }
    }
示例#8
0
    void Render()
    {
        if (company == null)
        {
            return;
        }

        var id = company.company.Id;

        var clients      = Marketing.GetClients(company);
        var churn        = Marketing.GetChurnRate(Q, company);
        var churnClients = Marketing.GetChurnClients(Q, id);

        var profit = Economy.GetProfit(Q, id);

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

        var nameColor   = hasControl ? Colors.COLOR_CONTROL : Colors.COLOR_NEUTRAL;
        var profitColor = profit >= 0 ? Colors.COLOR_POSITIVE : Colors.COLOR_NEGATIVE;

        var positionOnMarket = Markets.GetPositionOnMarket(Q, company) + 1;

        var brand       = (int)company.branding.BrandPower;
        var brandChange = Marketing.GetBrandChange(company, Q);

        var effeciency = Products.GetTeamEffeciency(Q, company);



        SetEmblemColor();

        Clients.text = Format.Minify(clients);

        CompanyHint.SetHint(GetCompanyHint());

        Expertise.text = $"Effeciency: {effeciency}%";

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

        Profitability.text  = Format.Money(profit);
        Profitability.color = Visuals.GetColorFromString(profitColor);

        PositionOnMarket.text = $"#{positionOnMarket}";

        Brand.text  = $"{brand} ({brandChange.Sum()})";
        Brand.color = Visuals.GetGradientColor(0, 100, brand);

        UpdateIfNecessary(BrandIcon, company.isRelease);
        UpdateIfNecessary(Brand, company.isRelease);


        // buttons

        // set
        LinkToProjectView.CompanyId = id;
        HireWorker.companyId        = id;
        ReleaseApp.SetCompanyId(id);

        TestCampaignButton.SetCompanyId(id);
        StartRegularAdCampaign.SetCompanyId(id);
        StartBrandingCampaign.SetCompanyId(id);
        UpgradeChurn.SetCompanyId(id);
        UpgradeMonetisation.SetCompanyId(id);
        LinkToHiringScreen.SetCompanyId(id);


        var max     = Products.GetNecessaryAmountOfWorkers(company, Q);
        var workers = Teams.GetAmountOfWorkers(company, Q);

        var canHireTopManagers = false && workers > 5;

        var targetingCost = Marketing.GetTargetingCost(company, Q);
        var brandingCost  = Marketing.GetBrandingCost(company, Q);


        // enable / disable them
        UpdateIfNecessary(ReleaseApp, Companies.IsReleaseableApp(company, Q));

        UpdateIfNecessary(TestCampaignButton, !company.isRelease);
        UpdateIfNecessary(StartRegularAdCampaign, company.isRelease);
        UpdateIfNecessary(StartBrandingCampaign, company.isRelease);

        UpdateIfNecessary(LinkToHiringScreen, canHireTopManagers);
        UpdateIfNecessary(ManagementLabel, canHireTopManagers);


        // render
        HireWorker.GetComponentInChildren <TextMeshProUGUI>().text = $"Hire Worker ({workers}/{max})";
        HireWorker.GetComponentInChildren <Button>().interactable  = workers < max;
        HireWorker.GetComponentInChildren <Hint>().SetHint(workers < max ?
                                                           "Hiring workers will increase development speed"
            :
                                                           Visuals.Negative("You reached max limit of workers") + "\n\nTo increase this limit, hire TOP managers"
                                                           );

        StartRegularAdCampaign.GetComponent <Hint>().SetHint($"Cost: {Format.Money(targetingCost)}");
        StartBrandingCampaign.GetComponent <Hint>().SetHint($"Cost: {Format.Money(brandingCost)}");
    }