Exemplo n.º 1
0
    void ChurnUsers(GameEntity[] products, GameEntity niche)
    {
        var clientContainers = niche.nicheClientsContainer.Clients;

        var dumpingCompanies = products.Where(p => p.isDumping);

        var totalBrands = dumpingCompanies.Sum(p => p.branding.BrandPower);

        for (var i = 0; i < products.Length; i++)
        {
            var p = products[i];

            var churnClients = Marketing.GetChurnClients(contexts.game, p.company.Id);
            Marketing.AddClients(p, -churnClients);

            clientContainers[0] += churnClients;

            continue;
            // send churn users to dumping companies
            foreach (var d in dumpingCompanies)
            {
                float clients = churnClients;
                if (totalBrands == 0)
                {
                    clients /= dumpingCompanies.Count();
                }
                else
                {
                    clients *= p.branding.BrandPower / totalBrands;
                }

                Marketing.AddClients(d, (long)(clients));
            }
        }
    }
Exemplo n.º 2
0
    protected override void Execute(List <GameEntity> entities)
    {
        var companies = Companies.GetProductCompanies(gameContext);

        foreach (var product in companies)
        {
            // churn users
            var churn = Marketing.GetChurnClients(product, gameContext);
            Marketing.AddClients(product, -churn);

            // add users
            if (product.isControlledByPlayer || product.isRelatedToPlayer)
            {
                //Debug.Log("Will lose " + churn);
                continue;
            }

            /*var myChannels = product.companyMarketingActivities.Channels;
             *
             * foreach (var c in myChannels)
             * {
             *  var channelId = c.Key;
             *
             *  var clients = Marketing.GetChannelClientGain(product, channelId);
             *  Marketing.AddClients(product, clients);
             * }*/
        }
    }
Exemplo n.º 3
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 + "%)
    }
Exemplo n.º 4
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();
    }
Exemplo n.º 5
0
    public override string RenderValue()
    {
        var growth = Marketing.GetAudienceGrowth(SelectedCompany, Q);

        var churn = Marketing.GetChurnClients(Q, SelectedCompany.company.Id);

        //var text = "Audience grows by " + Format.Minify(clients) + " clients each month due to current brand power and concept level";
        var text = $"This product will {Visuals.Positive("receive")} approximately {Format.Minify(growth)} clients next month." +
                   $"\n\nDue to churn they will {Visuals.Negative("lose")} {Format.Minify(churn)} clients." +
                   $"\n\nThis values are based on brand power, product relevance"
        ;

        return(text);
    }
Exemplo n.º 6
0
    void RenderMarketingButton(bool forceShow)
    {
        var channels         = Markets.GetAffordableMarketingChannels(Flagship, Q).Count();
        var isLosingAudience = Marketing.GetChurnClients(Flagship, Q) > 0;

        if (isLosingAudience)
        {
            channels += 1;
        }

        MarketingCounter.GetComponentInChildren <Text>().text = channels.ToString();


        Draw(MarketingCounter, channels > 0 || forceShow);
        Draw(MarketingButton, HasOrCompletedGoal(Flagship, InvestorGoalType.ProductFirstUsers) || forceShow);
    }
Exemplo n.º 7
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)}");
    }