Esempio n. 1
0
    public override void ViewRender()
    {
        base.ViewRender();

        var audiences = Marketing.GetAudienceInfos();

        var product = Flagship;

        if (!product.hasProduct)
        {
            return;
        }

        //bool showAudiences = true;
        bool showAudiences = product.isRelease;

        if (showAudiences)
        {
            SetItems(audiences);
        }
        else
        {
            // take primary audience only
            // positioningId will be always less than amount of audiences
            SetItems(audiences.Where(a => a.ID == Marketing.GetCoreAudienceId(product)));
        }

        Teams.UpdateTeamEfficiency(product, Q);
    }
Esempio n. 2
0
    public override void ViewRender()
    {
        base.ViewRender();

        var audiences = Marketing.GetAudienceInfos();

        if (!product.hasProduct)
        {
            return;
        }

        //bool showAudiences = true;
        bool showAudiences = product.isRelease;

        if (showAudiences)
        {
            SetItems(audiences);
        }
        else
        {
            // take primary audience only
            // positioningId will be always less than amount of audiences
            SetItems(audiences.Where(a => a.ID == Marketing.GetCoreAudienceId(product)));
        }

        Teams.UpdateTeamEfficiency(product, Q);

        if (FeatureCap != null)
        {
            FeatureCap.text = Visuals.Positive(Products.GetFeatureRatingCap(product).ToString("0.0"));
        }
    }
Esempio n. 3
0
    public override void ViewRender()
    {
        base.ViewRender();

        var audiences = Marketing.GetAudienceInfos();

        SetItems(audiences);
    }
Esempio n. 4
0
    public void SetAudiences(ProductPositioning positioning)
    {
        var allAudiences = Marketing.GetAudienceInfos();
        var audiences    = positioning.Loyalties
                           .Select((l, i) => new { l, i })
                           .Where(pp => pp.l >= 0)
                           .Select(pp => allAudiences[pp.i]);

        SetItems(audiences);
    }
Esempio n. 5
0
    public override void ViewRender()
    {
        base.ViewRender();

        var audiences = Marketing.GetAudienceInfos();

        audiences.Take(Flagship.isRelease ? audiences.Count : 1);

        SetItems(audiences);
    }
Esempio n. 6
0
    private void OnEnable()
    {
        var audiences = Marketing.GetAudienceInfos();

        Positioning = Marketing.GetPositioning(Flagship);
        flag        = true;

        CleanScreen();

        ViewRender();
    }
Esempio n. 7
0
    void RenderSegmentImage(GameEntity company)
    {
        // audience icon
        if (Marketing.IsFocusingMoreThanOneAudience(company))
        {
            SegmentTypeImage.texture = Resources.Load <Texture2D>($"paidClients");
        }
        else
        {
            var segmentID = Marketing.GetBaseAudienceId(company);
            //var segmentID = Marketing.GetCoreAudienceId(company);
            var audiences = Marketing.GetAudienceInfos();

            SegmentTypeImage.texture = Resources.Load <Texture2D>($"Audiences/{audiences[segmentID].Icon}");
        }
    }
Esempio n. 8
0
    void RenderSegmentDescription(GameEntity company)
    {
        var audiences = Marketing.GetAudienceInfos();

        var audiencesSelected = Positioning.Loyalties
                                .Select((l, i) => new { i, isLoyal = l >= 0 });

        //Debug.Log()

        NewPositioningName.text = Positioning.name;


        HatedLabel.text = $"<size=50><color=red><b>!!! You will LOSE ALL of these users</b></color></size>";

        RenderPositioningChangeBenefit();
    }
Esempio n. 9
0
    public override void ViewRender()
    {
        base.ViewRender();

        var infos = Marketing.GetAudienceInfos();
        //.OrderBy(a => a.Size);

        // TODO DUPLICATED FROM AudiencesOnMainScreenListView.ViewRender()
        var audiences = Marketing.GetAudienceInfos();

        //bool showAudiences = true;
        var  company       = Flagship;
        bool showAudiences = company.isRelease;

        if (showAudiences)
        {
            SetItems(audiences);
        }
        else
        {
            // take primary audience only
            SetItems(audiences.Where(a => a.ID == Marketing.GetCoreAudienceId(company)));
        }

        //SetItems(infos);

        var audience    = Marketing.GetAudienceInfos()[segmentId];
        var segmentName = audience.Name;

        var potentialPhrase = $"{Format.Minify(audience.Size)} users";
        var incomePerUser   = (double)Economy.GetBaseIncomeByMonetizationType(company); // 1L * (segmentId + 1);
        var worth           = (long)(incomePerUser * audience.Size);

        var worthPhrase = Format.Money(worth, true);

        AudienceDescription.text    = segmentName + $"\n\n<size=30>Potential\n{Visuals.Positive(potentialPhrase)}\n\nIncome\n{Visuals.Positive(worthPhrase)}</size>";
        PositionongDescription.text = $"We are making {Marketing.GetPositioningName(company)}";

        if (CompaniesInterestedInUsers != null)
        {
            //CompaniesInterestedInUsers.text = $"which are interested in {segmentName}";
            CompaniesInterestedInUsers.text = $"which are interested in {Marketing.GetPositioningName(company)}";
        }

        //FindObjectOfType<CompaniesFocusingSpecificSegmentListView>().SetSegment(segmentId);
    }
Esempio n. 10
0
    public void SetEntity(int teamId, TeamTask teamTask)
    {
        this.teamId   = teamId;
        this.teamTask = teamTask;

        ChosenTaskLabel.SetTask(teamTask);

        Draw(ChosenTaskLabel, true);
        Draw(RemoveTaskButton, true);
        Draw(RemoveFeatureButton, teamTask.IsFeatureUpgrade);

        var team = Flagship.team.Teams[teamId];

        TaskBenefit.text = "";

        if (teamTask.IsPending)
        {
            TaskBenefit.text = Visuals.Negative("<size=30>This task is not active!</size>") + "\nCause our team is doing other tasks. Hire more teams, to make more tasks at the same time.\n\n";
        }

        if (teamTask.IsFeatureUpgrade)
        {
            var f = teamTask as TeamTaskFeatureUpgrade;


            var segments = Marketing.GetAudienceInfos();

            float sumLoyalty    = 0;
            float sumLoyaltyMax = 0;
            float sumLoyaltyABS = 0;

            var featureDescription = "";

            var rating      = Products.GetFeatureRating(Flagship, f.NewProductFeature.Name);
            var ratingColor = Visuals.GetGradientColor(0, 10f, rating);



            foreach (var s in segments)
            {
                var segmentId = s.ID;

                var maxBenefit = Marketing.GetLoyaltyChangeFromFeature(Flagship, f.NewProductFeature, segmentId, true);
                var benefit    = Marketing.GetLoyaltyChangeFromFeature(Flagship, f.NewProductFeature, segmentId, false);

                sumLoyalty    += benefit;
                sumLoyaltyMax += maxBenefit;
                sumLoyaltyABS += Mathf.Abs(benefit);

                var maxBenefitFormatted = Visuals.Colorize(maxBenefit.ToString("+0;-#"), maxBenefit >= 0);
                var benefitFormatted    = Visuals.Colorize(benefit.ToString("+0.0;-#"), ratingColor);

                //if (benefit != 0)
                //    featureDescription += $"\n\n{maxBenefitFormatted} loyalty for {s.Name}\n\t<i>currently</i>: {benefitFormatted}";
                //else
                //    featureDescription += "\n\nNo effects";
            }

            if (f.NewProductFeature.FeatureBonus.isRetentionFeature)
            {
            }
            if (f.NewProductFeature.FeatureBonus.isMonetisationFeature)
            {
                var monetisationBenefit    = Products.GetFeatureActualBenefit(Flagship, f.NewProductFeature); // f.NewProductFeature.FeatureBonus.Max;
                var monetisationBenefitMax = f.NewProductFeature.FeatureBonus.Max;

                featureDescription += Visuals.Positive("\n\nLoyalty will increase after upgrading this feature");

                featureDescription += $"\n\n{Visuals.Positive($"Increases income by +{monetisationBenefit.ToString("0.0")}% (max: +{monetisationBenefitMax}%)")}";
            }



            var sumLoyaltyFormatted    = Visuals.Colorize(sumLoyalty.ToString("+0.0;-#"), sumLoyalty >= 0);
            var sumLoyaltyMaxFormatted = Visuals.Colorize(sumLoyaltyMax.ToString("+0.0;-#"), sumLoyaltyMax >= 0);

            var ratingFormatted = Visuals.Colorize(rating.ToString("0.0"), ratingColor);

            var ratingCap = Products.GetFeatureRatingCap(Flagship);

            TaskBenefit.text += $"<size=40>Feature Quality: {ratingFormatted}lvl</size>" +
                                $"\n\nThis feature will be upgraded to level {ratingCap}" +
                                $"\n\n<size=30>Gives you {sumLoyaltyFormatted} loyalty total</size>" +
                                //$"\n\nOn quality=10 you will get:" +
                                //$"\n\n<size=30>{sumLoyaltyMaxFormatted} loyalty total</size>" +
                                $"\n{featureDescription}"
            ;



            TaskModifiers.text = $"Will be upgraded to level {ratingCap} due to assigned team";
        }

        if (teamTask.IsMarketingTask)
        {
            TaskBenefit.text  += $"Marketing task";
            TaskModifiers.text = "";
        }

        if (teamTask.IsHighloadTask)
        {
            TaskBenefit.text  += $"Server";
            TaskModifiers.text = "";
        }

        //TaskExecutor.text = $"<b>{Visuals.Link(team.Name)}</b>";
    }
Esempio n. 11
0
    public override string RenderValue()
    {
        var text = "";

        var audienceInfos = Marketing.GetAudienceInfos();

        var company = Flagship;

        var info = audienceInfos[segmentId];

        var incomePerUser = (double)Economy.GetBaseIncomeByMonetizationType(company);

        var maxIncome = (long)(info.Size * incomePerUser);

        var audienceIsPrimary = Marketing.IsTargetAudience(company, segmentId);
        var audienceColor     = audienceIsPrimary ? Colors.COLOR_GOLD : Colors.COLOR_WHITE;

        var primaryAudience = audienceIsPrimary ? " (Our target audience)" : "";

        text = $"<b>" +
               $"{Visuals.Colorize(info.Name, audienceColor)}" +
               $"{primaryAudience}" +
               $"</b>";
        text += $"\n\n<b>Potential Income (Audience)</b>" +
                $"\n{Format.Money(maxIncome, true)} ({Format.Minify(info.Size)} users)";
        //text += $"<b>Audience specs</b>";

        foreach (var b in info.Bonuses)
        {
            if (b.Max == 0)
            {
                continue;
            }

            var isGood = b.Max >= 0;


            if (b.isAcquisitionFeature)
            {
                //var value = Visuals.Colorize(b.Max.ToString("0.0") + "%", isGood);
                var value = Visuals.Colorize(b.Max.ToString("+#.#;-#.#;0") + "%", isGood);

                text += "\n\n<b>Growth</b>\n" + value;
            }

            if (b.isMonetisationFeature)
            {
                //var value = Visuals.Colorize(b.Max.ToString("0.0"), isGood);
                var value  = b.Max.ToString("0.0");
                var income = incomePerUser * (100f + b.Max) / 100f;

                //text += "\n\n<b>Monetisation</b>\n" + income.ToString("+#.##;-#.##;0") + "$ / user";
                text += "\n\n<b>Monetisation</b>\n" + income.ToString("0.00") + "$ / user";
            }

            //if (b.isRetentionFeature)
            //{
            //    text += "\nLoyalty: " + value;
            //}
        }

        text += "\n\n";

        var companies = Companies.GetCompetitorsOf(company, Q, false).Where(c => Marketing.IsTargetAudience(c, segmentId));
        var expenses  = companies.Select(c => Economy.GetProductMaintenance(c, Q));

        var maxBudget = expenses.Count() > 0 ? expenses.Max() : 0;


        var averageBudget = expenses.Count() > 0 ? expenses.Average() : 0;

        //$"\n{Random.Range(0, 4)} companies";
        if (averageBudget != 0)
        {
            text += $"<b>Average budget</b>\n{Format.Money(averageBudget, true)} / week  ({Format.Money(maxBudget, true)} max)";
        }
        else
        {
            text += "\n" + Visuals.Positive("It's a free segment, you can take it easily!");
        }

        return(text);
    }
Esempio n. 12
0
 string DescribeAudience(long cost, int i) => Visuals.Negative($"{Marketing.GetAudienceInfos()[i].Name} ({Format.Money(cost, true)})");
Esempio n. 13
0
    public void SetEntity(ProductPositioning positioning)
    {
        var company = Flagship;

        PositioningID = positioning.ID;

        var positionings = Marketing.GetNichePositionings(company);

        SegmentId = Marketing.GetCoreAudienceId(company);

        var infos = Marketing.GetAudienceInfos();
        var info  = infos[SegmentId];

        var actualPositioning = Marketing.GetPositioning(Flagship);

        var selectedPositioning = FindObjectOfType <PositioningManagerView>().Positioning;

        BorderImage.color = Visuals.GetColorFromString(selectedPositioning.ID == positioning.ID ? Colors.COLOR_CONTROL : Colors.COLOR_NEUTRAL);

        var worth = Marketing.GetPositioningWorth(company, positioning);


        bool isOurPositioning = company.productPositioning.Positioning == positioning.ID;

        var positioningColor = isOurPositioning ? Colors.COLOR_CONTROL : Colors.COLOR_WHITE;

        Title.text  = $"{positioning.name}\nWorth <size=40><b>{Format.Money(worth, true)}</b></size>";
        Title.color = Visuals.GetColorFromString(positioningColor);

        bool ourPositioning = positioning.ID == actualPositioning.ID;

        if (ourPositioning)
        {
            Title.text += $"\n{Visuals.Colorize("(Our positioning)", Colors.COLOR_CONTROL)}";
        }

        //Title.text = Visuals.Colorize($"{positioning.name}\nWorth <size=40><b>{Format.MinifyMoney(worth)}</b></size>", positioningColor);
        //Title.text = Visuals.Colorize($"{positioning.name} \n<b>{Format.MinifyMoney(worth)}</b>", positioningColor);

        var competition = Companies.GetCompetitionInSegment(Flagship, Q, positioning.ID);

        if (!ourPositioning)
        {
            var competitors      = competition.Count();
            var comeptitionColor = Visuals.GetGradientColor(0, 5, competitors, true);

            if (competitors == 0)
            {
                Title.text += "\n" + Visuals.Positive("NO COMPETITION");
            }
            else
            {
                Title.text += "\n" + Visuals.Colorize($"{competitors} companies", comeptitionColor);
            }
        }


        Icon.texture = Resources.Load <Texture2D>($"Audiences/{info.Icon}");

        if (SegmentAudiencesListView != null)
        {
            SegmentAudiencesListView.SetAudiences(positioning);
        }
        //AudienceListView.SetAudiences(positioning.Loyalties.Select((l, i) => new { l, i, asda = infos[i] }).Where(pp => )

        //bool isTargetAudience = Marketing.IsTargetAudience(company, segmentId);
        //var audienceColor = Visuals.GetColorFromString(isTargetAudience ? Colors.COLOR_GOLD : Colors.COLOR_WHITE);
        //if (isTargetAudience)
        //    PanelImage.color = audienceColor;

        HideChanges();
    }