void RenderClients(GameEntity company) { if (Clients != null) { Clients.text = Format.Minify(Marketing.GetClients(company)); } }
List <long> NormalizeGraphData(GameEntity p, int start, int end, int necessaryMetrics) { var metrics = p.metricsHistory.Metrics .Where(m => m.Date >= start) .ToList(); //var necessaryMetrics = (end - start) / Constants.PERIOD; // metrics are saved each 7 days var metricsCount = metrics.Count(); //Debug.Log($"Found {metricsCount} / {necessaryMetrics} queries for {p.company.Name}"); var insertBefore = necessaryMetrics - metricsCount; for (var i = 0; i < insertBefore; i++) { metrics.Add(GetMetricMockup(0, start + i * Balance.PERIOD)); } // add current value metrics.Add(GetMetricMockup(Marketing.GetClients(p), CurrentIntDate + 1)); var result = metrics.OrderBy(m => m.Date); //var loggedMetrics = result.Select(m => $"date={m.Date}, audience={Format.Minify(m.AudienceSize)}"); //Debug.Log("normalising " + p.company.Name + $" (Entity{p.creationIndex}: {result.Count()}/{necessaryMetrics} " + string.Join("\n", loggedMetrics)); return(result .Select(m => m.AudienceSize) .ToList()); }
public static GoalRequirements GoalFirstUsers(GameEntity company, GameContext gameContext) { return(new GoalRequirements { have = Marketing.GetClients(company), need = company.companyGoal.MeasurableGoal }); }
public static long GetClientBaseCost(GameContext context, int companyId) { return(0); var c = Companies.Get(context, companyId); return(Marketing.GetClients(c) * 100); }
public void SetEntity(GameEntity c, bool darkImage) { company = c; EnableDarkTheme = darkImage; bool hasControl = Companies.GetControlInCompany(MyCompany, c, Q) > 0; Name.text = c.company.Name; // .Substring(0, 1); Name.color = Visuals.GetColorFromString(hasControl ? Colors.COLOR_CONTROL : Colors.COLOR_NEUTRAL); SetEmblemColor(); LinkToProjectView.CompanyId = c.company.Id; ShowProductChanges.SetEntity(company); var isRelatedToPlayer = Companies.IsRelatedToPlayer(Q, c); ConceptProgress.SetCompanyId(c.company.Id); //ConceptProgress.gameObject.SetActive(isRelatedToPlayer); CompanyHint.SetHint(GetCompanyHint(hasControl)); var clients = Marketing.GetClients(company); Concept.text = Format.Minify(clients); // Products.GetProductLevel(c) + "LVL"; var position = Markets.GetPositionOnMarket(Q, company); PositionOnMarket.text = $"#{position + 1}"; var level = Products.GetProductLevel(company); PositionOnMarket.text = $"{level}LVL"; Dumping.SetCompanyId(c.company.Id); if (Profitability != null) { var profit = Economy.GetProfit(Q, company.company.Id); var marketShare = Companies.GetMarketShareOfCompanyMultipliedByHundred(c, Q); var shareChange = 1; bool isGrowing = Companies.IsCompanyGrowing(company, Q); //Profitability.text = Visuals.DescribeValueWithText(shareChange, marketShare + "%", marketShare + "%", ""); Profitability.text = Visuals.Colorize(marketShare + "%", isGrowing); Profitability.text = Visuals.Positive(marketShare + "%"); //Profitability.GetComponent<Hint>().SetHint( // profit > 0 ? // Visuals.Positive($"This company is profitable!\nProfit: +{Format.Money(profit)}") : // Visuals.Negative($"This company loses {Format.Money(-profit)} each month!") // ); } var financing = Economy.GetMarketingFinancing(company); AggressiveMarketing.SetActive(financing == Products.GetMaxFinancing); }
public override void ViewRender() { base.ViewRender(); var products = Markets.GetProductsOnMarket(Q, SelectedNiche) .OrderByDescending(p => Marketing.GetClients(p)) ; SetItems(products); }
void SaveProductCompanyMetrics(GameEntity e, int date) { CompanyStatisticsUtils.AddMetrics(gameContext, e, new MetricsInfo { Date = date, AudienceSize = Marketing.GetClients(e), Income = Economy.GetCompanyIncome(gameContext, e), Profit = Economy.GetProfit(gameContext, e), Valuation = Economy.GetCompanyCost(gameContext, e) }); }
string GetCompanyHint(bool hasControl) { StringBuilder hint = new StringBuilder(company.company.Name); var position = Markets.GetPositionOnMarket(Q, company); // quality description var conceptStatus = Products.GetConceptStatus(company, Q); var concept = "???"; switch (conceptStatus) { case ConceptStatus.Leader: concept = "Sets Trends!"; break; case ConceptStatus.Outdated: concept = "Outdated"; break; case ConceptStatus.Relevant: concept = "Relevant"; break; } // var level = Products.GetProductLevel(company); var clients = Marketing.GetClients(company); var brand = (int)company.branding.BrandPower; hint.AppendLine($"\n\n"); hint.AppendLine($"Clients: {Format.Minify(clients)} (#{position + 1})"); hint.AppendLine($"Brand: {brand}"); hint.AppendLine($"\nConcept: {level}LVL ({concept})"); hint.AppendLine(); hint.AppendLine(); var profitDescription = GetProfitDescription(); hint.AppendLine(profitDescription); //var posTextual = Markets.GetCompanyPositioning(company, GameContext); //hint.AppendLine($"\nPositioning: {posTextual}"); ////var expertise = CompanyUtils.GetCompanyExpertise(company); //var expertise = company.expertise.ExpertiseLevel + " LVL"; //hint.AppendLine($"\nExpertise: {expertise}"); if (hasControl) { hint.AppendLine(Visuals.Colorize("\nWe control this company", Colors.COLOR_CONTROL)); } return(hint.ToString()); }
internal static long GetMarketShareOfCompanyMultipliedByHundred(GameEntity product, GameContext gameContext) { long clients = 0; foreach (var p in Markets.GetProductsOnMarket(gameContext, product)) { clients += Marketing.GetClients(p); } if (clients == 0) { return(0); } var share = 100 * Marketing.GetClients(product) / clients; return(share); }
string GetCompanyHint() { StringBuilder hint = new StringBuilder(company.company.Name); var position = Markets.GetPositionOnMarket(Q, company); // quality description var conceptStatus = Products.GetConceptStatus(company, Q); var concept = "???"; switch (conceptStatus) { case ConceptStatus.Leader: concept = "Sets Trends!"; break; case ConceptStatus.Outdated: concept = "Outdated"; break; case ConceptStatus.Relevant: concept = "Relevant"; break; } // var level = Products.GetProductLevel(company); var clients = Marketing.GetClients(company); var brand = (int)company.branding.BrandPower; hint.AppendLine(); hint.AppendLine(); hint.AppendLine($"Clients: {Format.Minify(clients)} (#{position + 1})"); hint.AppendLine($"Brand: {brand}"); hint.AppendLine(); hint.AppendLine($"Concept: {level}LVL ({concept})"); hint.AppendLine(); hint.AppendLine(); hint.AppendLine(GetProfitDescription()); return(hint.ToString()); }
void Render() { var company = Companies.Get(Q, companyId); var clients = Marketing.GetClients(company); var newClients = Marketing.GetAudienceGrowth(company, Q); Clients.text = Format.Minify(clients); NewClients.text = Format.Minify(newClients); var isPlayerRelated = Companies.IsRelatedToPlayer(Q, company); Name.text = company.company.Name; Name.color = Visuals.GetColorFromString(isPlayerRelated ? Colors.COLOR_COMPANY_WHERE_I_AM_CEO : Colors.COLOR_COMPANY_WHERE_I_AM_NOT_CEO); LinkToProjectView.CompanyId = company.company.Id; ClientChange.SetHint($"{company.company.Name} will get this amount of clients next week"); }
internal static long GetControlInMarket(GameEntity group, NicheType nicheType, GameContext gameContext) { long share = 0; long clients = 0; foreach (var p in Markets.GetProductsOnMarket(gameContext, nicheType)) { var cli = Marketing.GetClients(p); share += GetControlInCompany(group, p, gameContext) * cli; clients += cli; } if (clients == 0) { return(0); } return(share / clients); }
private static long GiveInnovationBenefits(GameEntity product, GameContext gameContext) { Marketing.AddBrandPower(product, Balance.INNOVATION_BRAND_POWER_GAIN); // get your competitor's clients var products = Markets.GetProductsOnMarket(gameContext, product) .Where(p => p.isRelease) .Where(p => p.company.Id != product.company.Id); long sum = 0; foreach (var p in products) { var disloyal = Marketing.GetClients(p) / 6; Marketing.LooseClients(p, disloyal); Marketing.AddClients(product, disloyal); sum += disloyal; } return(sum); }
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)}"); }