Пример #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);
    }
    public override void ViewRender()
    {
        base.ViewRender();

        var positionings = Marketing.GetNichePositionings(Flagship);

        SetItems(positionings);
    }
    void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData)
    {
        // audiences loyalty change
        var positioning = Marketing.GetNichePositionings(Flagship);

        var currentBuff = positioning[positioningId].Loyalties;

        FindObjectOfType <AudiencesOnMainScreenListView>().ShowLoyaltyChanges(currentBuff);
    }
    public override void ViewRender()
    {
        base.ViewRender();

        var positioningTitle = "<b>" + Marketing.GetNichePositionings(Flagship)[positioningId].name + "</b>";

        if (positioningId == Flagship.productPositioning.Positioning)
        {
            positioningTitle += "\n" + Visuals.Colorize("Our positioning", Colors.COLOR_GOLD);
        }

        GetComponentInChildren <TextMeshProUGUI>().text = positioningTitle;
    }
Пример #5
0
    public override void OnItemSelected(int ind)
    {
        base.OnItemSelected(ind);

        var positionings = Marketing.GetNichePositionings(Flagship);

        var p = positionings[Item.GetComponent <SegmentPreview>().PositioningID];

        foreach (var it in Items)
        {
            it.GetComponent <SegmentPreview>().DeselectSegment();
        }

        Item.GetComponent <SegmentPreview>().ChooseSegment();

        FindObjectOfType <PositioningManagerView>().SetAnotherPositioning(p);
    }
Пример #6
0
 List <ProductPositioning> GetProductPositionings(List <int> Audiences, GameEntity company)
 {
     return(Marketing.GetNichePositionings(company)
            .Where(p => Audiences.All(a => p.Loyalties[a] >= 0))
            .ToList());
 }
Пример #7
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();
    }