Пример #1
0
    public void SetPivotPositionings()
    {
        var positioning  = Marketing.GetPositioning(Flagship);
        var positionings = Marketing.GetNichePositionings(Flagship);

        var favouriteSegments = positioning.Loyalties.Select((l, i) => new { l, i }).Where(r => r.l >= 0).Select(r => r.i);
        var favouriteCount    = favouriteSegments.Count();

        var pivotPositionings = new List <ProductPositioning>(); // positionings.Where(p => p.Loyalties.All((l, i) => l >= 0 && positioning.Loyalties[i] >= 0));

        foreach (var p in positionings)
        {
            bool willNotLosePreviousUsers = true;
            var  newFavouriteCount        = p.Loyalties.Count(l => l >= 0);

            for (var i = 0; i < p.Loyalties.Count; i++)
            {
                bool likesAudience    = positioning.Loyalties[i] >= 0;
                bool willHateAudience = p.Loyalties[i] < 0;

                if (likesAudience && willHateAudience)
                {
                    willNotLosePreviousUsers = false;
                }
            }

            //willNotLosePreviousUsers &&
            if (newFavouriteCount <= favouriteCount)
            {
                pivotPositionings.Add(p);
            }
        }

        SetPositionings(pivotPositionings);
    }
Пример #2
0
    private void OnEnable()
    {
        var audiences = Marketing.GetAudienceInfos();

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

        CleanScreen();

        ViewRender();
    }
Пример #3
0
    List <ProductPositioning> WrapWithCurrentPositioning(GameEntity company, List <ProductPositioning> positionings)
    {
        var pps = positionings;

        var currentPositioning = Marketing.GetPositioning(Flagship);

        pps.RemoveAll(p => p.ID == currentPositioning.ID);
        pps.Insert(0, currentPositioning);

        return(pps);
    }
Пример #4
0
    void RenderPositioningChangeBenefit()
    {
        var product        = Flagship;
        var audienceChange = (double)Marketing.GetAudienceChange(product, Q);


        var audienceGrowth = (double)Marketing.GetAudienceGrowth(product, Q);

        // Fake positioning change -------------------
        var positioning = Marketing.GetPositioning(product);

        Marketing.ChangePositioning(product, Positioning.ID);
        var newAudienceGrowth = (double)Marketing.GetAudienceGrowth(product, Q);

        var companies = Companies.GetCompetitionInSegment(product, Q, Positioning.ID, true);

        //var newBestAppQuality = Marketing
        Marketing.ChangePositioning(product, positioning.ID);
        // --------------------------------

        var incomePerUser    = Economy.GetIncomePerUser(product, 0) * C.PERIOD / 30; //  0.05d;
        var newIncomePerUser = incomePerUser;

        bool noCompetitors = companies.Count() == 0;

        if (noCompetitors)
        {
            newAudienceGrowth *= 2;
        }


        var incomeGrowth    = Convert.ToInt64((audienceGrowth * incomePerUser));
        var newIncomeGrowth = Convert.ToInt64(newAudienceGrowth * newIncomePerUser);


        var situation = $"Your income grows by {Format.Money(incomeGrowth)} every week (by getting {Format.Minify(audienceGrowth)} users).";

        ChangeGain.text = situation;

        var incomeChange         = newIncomeGrowth - incomeGrowth;
        var audienceGrowthChange = newAudienceGrowth - audienceGrowth;

        if (newAudienceGrowth != audienceGrowth)
        {
            ChangeGain.text += $"\nAfter positioning change you will ";

            if (newAudienceGrowth > audienceGrowth)
            {
                var incomeGainDescription   = "+" + Format.Money(incomeChange) + " / week";
                var audienceGainDescription = "+" + Format.Minify(audienceGrowthChange) + " users";

                ChangeGain.text += $"<b>GET</b> additional <b>{Visuals.Positive(incomeGainDescription)}</b> (by getting <b>additional</b> {Visuals.Positive(audienceGainDescription)})";
            }

            if (newAudienceGrowth < audienceGrowth)
            {
                var incomeGainDescription   = Format.Money(-incomeChange) + " / week";
                var audienceGainDescription = Format.Minify(-audienceGrowthChange) + " users";

                ChangeGain.text += $"<b>LOSE</b> <b>{Visuals.Negative(incomeGainDescription)}</b> (by losing {Visuals.Negative(audienceGainDescription)})";
            }
        }
        else
        {
            ChangeGain.text += Visuals.Colorize("\nThis is our current positioning", Colors.COLOR_CONTROL);
        }


        // Competition --------------------
        if (noCompetitors)
        {
            ChangeGain.text += "\n" + Visuals.Positive("There are NO competitors, so you will get <b>TWICE</b> more users!");
        }
        // -------------------------
        //if (newAudienceGrowth == audienceGrowth)
        //{
        //    ChangeGain.text += $""
        //}
    }
Пример #5
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();
    }