public void SetEntity(ProductCompanyResult result) { result1 = result; var CompanyId = result.CompanyId; var product = Companies.Get(Q, CompanyId); CompanyName.text = product.company.Name; DrawProductGrowth(product, result); DrawProductStatus(); var profit = Economy.GetProfit(Q, product); Profit.text = "Profit\n" + Visuals.Colorize(Format.Money(profit), profit > 0); LinkToNiche.SetNiche(product.product.Niche); SetAggressiveMarketing.SetCompanyId(CompanyId); SetNormalMarketing.SetCompanyId(CompanyId); SetZeroMarketing.SetCompanyId(CompanyId); ReleaseApp.SetCompanyId(CompanyId); RenderMarketingButtons(CompanyId); }
void RenderMarketName(NicheType nicheType) { var industryType = Markets.GetIndustry(nicheType, Q); var hasCompany = Companies.HasCompanyOnMarket(MyCompany, nicheType, Q); var isInterestingMarket = MyCompany.companyFocus.Niches.Contains(nicheType); var marketColorName = Colors.COLOR_MARKET_ATTITUDE_NOT_INTERESTED; if (hasCompany) { marketColorName = Colors.COLOR_MARKET_ATTITUDE_HAS_COMPANY; } else if (isInterestingMarket) { marketColorName = Colors.COLOR_MARKET_ATTITUDE_FOCUS_ONLY; } bool isOurIndustry = MyCompany.companyFocus.Industries.Contains(industryType); var industryColorName = isOurIndustry ? Colors.COLOR_MARKET_ATTITUDE_HAS_COMPANY : Colors.COLOR_MARKET_ATTITUDE_NOT_INTERESTED; var coloredMarket = Visuals.Colorize(Enums.GetFormattedNicheName(nicheType), marketColorName); var coloredIndustry = Visuals.Colorize(Enums.GetFormattedIndustryName(industryType), industryColorName); NicheName.text = $"{coloredMarket}\n<i>{coloredIndustry}</i>"; }
public override string RenderValue() { var load = Products.GetServerLoad(Flagship); var capacity = Products.GetServerCapacity(Flagship); var loadFormatted = Format.Minify(load); var capacityFormatted = Format.Minify(capacity); bool overloaded = Products.IsNeedsMoreServers(Flagship); var percentage = 100L; if (capacity > 0) { percentage = load * 100 / capacity; } var str = $"Load: <b>{loadFormatted} / {capacityFormatted} ({Visuals.Colorize((int)percentage, 0, 100, true)}%)</b>"; if (overloaded) { str += " (" + Visuals.Negative("ADD SERVERS!") + ")"; } return(str); }
string GetCompanyHint(bool hasControl) { StringBuilder hint = new StringBuilder(company.company.Name); var position = Markets.GetPositionOnMarket(Q, company); // var clients = Marketing.GetUsers(company); var change = Marketing.GetAudienceChange(company, Q); //CompanyGrowth.text = Format.SignOf(change) + Format.Minify(change); //CompanyGrowth.color = Visuals.GetColorPositiveOrNegative(change); //CompanyGrowth.GetComponent<Hint>().SetHint($"Audience change: <b>{Format.Minify(change)}</b>"); hint.AppendLine($"\n\n"); hint.AppendLine($"Users: <b>{Format.Minify(clients)}</b> (#{position + 1})"); hint.AppendLine($"Audience change: <b>{Format.Minify(change)}</b>"); hint.AppendLine(GetProfitDescription()); if (hasControl) { hint.AppendLine(Visuals.Colorize("\nYou control this company", Colors.COLOR_CONTROL)); } return(hint.ToString()); }
public override string RenderValue() { var changeSum = string.Format("{0:+0.00;-0.00}", change.Sum()); return($"{Visuals.Colorize(changeSum, change.Sum() >= 0)}"); //return Flagship.companyResource.Resources.managerPoints + $" {Visuals.Colorize(changeSum, change.Sum() >= 0)}"; }
void RenderProposalStatus(bool willAcceptOffer) { if (Companies.IsDaughterOfCompany(MyCompany, SelectedCompany)) { ProposalStatus.text = "It is OUR COMPANY ALREADY!"; return; } var progress = Companies.GetOfferProgress(Q, SelectedCompany.company.Id, MyCompany.shareholder.Id); var status = Visuals.Colorize(progress + "%", willAcceptOffer) + " of owners want to accept your offer"; var textDescription = willAcceptOffer ? Visuals.Positive("They will accept offer!") : Visuals.Negative("They will not accept offer!"); ProposalStatus.text = status; // + "\n" + textDescription; var o = AcquisitionOffer; if (o.Turn == AcquisitionTurn.Seller) { ProposalStatus.text = "Waiting for response... "; if (!ScheduleUtils.IsTimerRunning(Q)) { ProposalStatus.text += Visuals.Negative("Unpause") + " to get their response"; } } }
void RenderUsers() { var users = Marketing.GetUsers(company); var growth = Marketing.GetAudienceChange(company, Q, true); var growthSum = growth.Sum(); var growthSign = Format.SignOf(growthSum); var growthPhrase = $"<b>{growthSign}{Format.MinifyToInteger(growthSum)}</b>"; var growthDescription = Visuals.Colorize(growthPhrase, growthSum > 0); Growth.text = $"<b>{Format.MinifyToInteger(users)}</b> users"; if (growthSum != 0) { Growth.text += $" ({growthDescription})"; } Users.text = $"<b>{company.company.Name}</b>"; if (users != previousUsers) { AnimationSpawner.Spawn(Visuals.Colorize(growthPhrase + " users", growthSum > 0), null); // PlaySound(); previousUsers = users; } }
string Wrap(CorporatePolicy corporatePolicy, string descriptionLeft, string descriptionRight) { var investorCulture = Companies.GetOwnCulture(SelectedInvestor); var playerCulture = Companies.GetActualCorporateCulture(MyCompany); int diff = Mathf.Abs(investorCulture[corporatePolicy] - playerCulture[corporatePolicy]); string description = DescribePolicy(corporatePolicy, descriptionLeft, descriptionRight); if (description.Length > 0) { var colorName = Colors.COLOR_NEUTRAL; if (diff <= 2) { colorName = Colors.COLOR_POSITIVE; } if (diff > 6) { colorName = Colors.COLOR_NEGATIVE; } return(Visuals.Colorize(description + "\n", colorName)); } return(""); }
public void RenderShareholderData() { var shareholder = Companies.GetInvestorById(Q, shareholderId); var shares = Companies.GetExactShareSize(Q, MyCompany, shareholder); var sharesCount = Companies.GetAmountOfShares(Q, MyCompany, shareholder); string name = isPlayerSelected ? "YOU" : Companies.GetInvestorName(Q, shareholderId); // investor.shareholder.Name; // active investments var investments = MyCompany.shareholders.Shareholders[shareholderId].Investments; var activeInvestments = investments.Where(i => i.RemainingPeriods > 0); var investmentInfo = string.Join( "\n", activeInvestments .Select(i => $"Will give {Format.Money(i.Portion, true)} for {i.RemainingPeriods} weeks") .ToArray() ); MainInfo.Title.text = $"<b>{name}</b>\n{Visuals.Colorize(sharesCount)} shares ({shares.ToString("0.0")}%)"; // \n{goal} BuyBackFromSpecificInvestor.GetComponent <BuyBackFromShareholder>().ShareholderId = shareholderId; bool hasInvestments = activeInvestments.Count() > 0; CurrentInvestments.GetComponentInChildren <TextMeshProUGUI>().text = !hasInvestments ? "Is not paying investments" : investmentInfo; }
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); }
string RequiredResourceSpec(int req, int res, string literal) { if (req > 0) { return(Visuals.Colorize($"{req} {literal}\n", req > res ? Colors.COLOR_NEGATIVE : Colors.COLOR_POSITIVE)); } return(""); }
public override string RenderValue() { var company = Flagship; var color = Colors.COLOR_COMPANY_WHERE_I_AM_CEO; var status = Enums.GetFormattedCompanyType(company.company.CompanyType); return(Visuals.Colorize(company.company.Name, color) + $"#{company.creationIndex} ({status})"); }
public override void ViewRender() { base.ViewRender(); if (!HasCompany) { return; } var name = SelectedCompany.company.Name; Title.text = $"Integrate \"{name}\" to our corporation"; bool willAcceptOffer = Companies.IsCompanyWillAcceptCorporationOffer(Q, SelectedCompany.company.Id, MyCompany.shareholder.Id); var progress = Companies.GetCorporationOfferProgress(Q, SelectedCompany.company.Id, MyCompany.shareholder.Id); Progress.text = Visuals.Colorize(progress + "%", willAcceptOffer); // TODO DIVIDE BY ZERO var ourCost = Economy.GetCompanyCost(Q, MyCompany); if (ourCost == 0) { ourCost = 1; } var targetCost = Economy.GetCompanyCost(Q, SelectedCompany); var sizeComparison = targetCost * 100 / ourCost; var futureShares = targetCost * 100 / (targetCost + ourCost); OurValuation.text = Format.Money(ourCost); TargetValuation.text = $"{Format.Money(targetCost)} ({sizeComparison}% compared to us)"; bool willStayIndependent = KeepAsIndependent.isOn; var isTargetTooBig = targetCost * 100 > ourCost * 15; var tooSmallToAcquire = isTargetTooBig ? Visuals.Negative("This company costs more than 15% of our corporation, so they won't join us.") : ""; OfferNote.text = $"{tooSmallToAcquire}\n\nCompany {name} will be <b>Fully</b> integrated to our company.\n\n" + $"Their shareholders will own {futureShares} % of our corporation"; //if (willStayIndependent) //{ //} //else //{ // OfferNote.text = $"Company {name} will be <b>Partially</b> integrated to our company." + // $"\n\nThey will be able to leave whenever they want." + // $"\nTheir shareholders won't receive our shares." + // $"\n\nOur company will get +1 Brand power for all products in Communications industry." + // $"\n\n{name} will get "; //} }
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()); }
public override string RenderValue() { var competitors = Companies.GetDirectCompetitors(Flagship, Q, true); var upgrades = competitors.Select(c => Visuals.Colorize(c.company.Name, c.isFlagship ? Colors.COLOR_BEST : Colors.COLOR_NEUTRAL)); var space = " "; return("Leader" + space + Flagship.company.Name + space + "Leader gets"); return(string.Join($"{space}|{space}", upgrades)); }
string RenderStars(string title, int stars) { string str = $"<b>{title}</b>\n<size=40>"; for (var i = 0; i < 5; i++) { str += Visuals.Colorize("<b>*</b>", i < stars ? Colors.COLOR_GOLD : Colors.COLOR_NEUTRAL); } return(str + "</size>"); }
public string RenderName(GameEntity company) { if (Companies.IsDirectlyRelatedToPlayer(Q, company)) { return(Visuals.Colorize(company.company.Name, Colors.COLOR_GOLD)); } else { return(Visuals.Colorize(company.company.Name, Colors.COLOR_WHITE)); } }
void Anim(string title, long change) { if (change > 0) { Animate(Visuals.Positive("+" + change) + $" {title}"); } else { Animate(Visuals.Colorize(change) + $" {title}"); } }
public override void SetItem <T>(Transform t, T entity) { // previous prefab: StrategicPartnershipView var company = entity as GameEntity; var companyId = company.company.Id; //t.GetComponent<LinkToProjectView>().CompanyId = companyId; //t.GetComponent<RenderPartnerName>().SetCompanyId(companyId); t.gameObject.AddComponent <Button>(); t.gameObject.AddComponent <LinkToProjectView>().CompanyId = companyId; string text = company.company.Name; if (Companies.IsDirectlyRelatedToPlayer(Q, company)) { text = Visuals.Colorize(text, Colors.COLOR_GOLD); } var sameMarkets = new List <NicheType>(); var m1 = SelectedCompany.companyFocus.Niches; var m2 = company.companyFocus.Niches; foreach (var m in m1) { if (m2.Contains(m)) { sameMarkets.Add(m); } } if (company.hasProduct) { var innovativeness = Products.GetInnovationChance(company, Q); var level = Products.GetProductLevel(company); text += $" ({level}LVL)\n(Innovativeness: {innovativeness}%)"; } else { var cost = Economy.CostOf(company, Q); text += $" (Cost: {Format.Money(cost)})"; text += "\nCommon markets: " + String.Join(", ", sameMarkets.Select(Enums.GetFormattedNicheName)); } t.gameObject.GetComponent <MockText>().SetEntity(text); }
public override string RenderValue() { var company = SelectedCompany; bool isRelatedToPlayer = Companies.IsRelatedToPlayer(Q, company); var color = isRelatedToPlayer ? Colors.COLOR_COMPANY_WHERE_I_AM_CEO : Colors.COLOR_COMPANY_WHERE_I_AM_NOT_CEO; var status = Enums.GetFormattedCompanyType(company.company.CompanyType); return(Visuals.Colorize(company.company.Name, color) + $" ({status})"); }
public override string RenderValue() { var company = SelectedCompany; bool isRelatedToPlayer = Companies.IsDirectlyRelatedToPlayer(Q, company) || Companies.HasControlInCompany(MyCompany, company, Q); var color = isRelatedToPlayer ? Colors.COLOR_COMPANY_WHERE_I_AM_CEO : Colors.COLOR_COMPANY_WHERE_I_AM_NOT_CEO; var status = Enums.GetFormattedCompanyType(company.company.CompanyType); return(Visuals.Colorize(company.company.Name, color) + $"#{company.creationIndex} ({status})"); }
public override void ViewRender() { base.ViewRender(); var goal = MyCompany.companyGoal.InvestorGoal; var goalInfo = Investments.GetFormattedInvestorGoal(goal); var requirements = Investments.GetGoalRequirements(MyCompany, Q); Goal.text = Visuals.Colorize(goalInfo, Investments.IsGoalCompleted(MyCompany, Q)); RenderProgress(requirements, goal); }
string GetGoals(GameEntity product) { if (product.companyGoal.Goals.Any()) { var goal = product.companyGoal.Goals.First(); return("<b>" + goal + "</b>\n"); // + string.Join(", ", Investments.GetProductActions(product, goal)); } var released = product.isRelease ? "RELEASED" : "prototype"; return(Visuals.Colorize($"<b>NO Goals</b> {released}\n" + string.Join(", ", product.completedGoals.Goals), "pink")); }
void RenderInnovatorPopup(PopupMessageInnovation popup) { bool ourInnovation = Companies.IsRelatedToPlayer(Q, popup.companyId); var innovationBenefit = $"They will get {Balance.INNOVATION_BRAND_POWER_GAIN} Brand Power and " + $"{Format.Minify(popup.clientGain)} clients from their competitors"; RenderUniversalPopup( $"Company {GetCompanyName(popup.companyId)} is innovator!", Visuals.Colorize(innovationBenefit, ourInnovation), typeof(ClosePopupOK) ); }
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; }
void DrawProductGrowth(GameEntity product, ProductCompanyResult result) { var bonus = Marketing.GetBrandChange(product, Q); var change = bonus.Sum(); ClientGrowth.text = $"Brand\n{(int)product.branding.BrandPower} ({Visuals.PositiveOrNegativeMinified(change)})"; ClientGrowth.gameObject.GetComponent <Hint>().SetHint(bonus.ToString()); var shareChange = (long)result.MarketShareChange; var share = Companies.GetMarketShareOfCompanyMultipliedByHundred(product, Q); MarketShareChange.text = "Market share\n" + Visuals.Colorize(share.ToString(), shareChange >= 0) + "%"; }
string GetCompanyHint(bool hasControl) { var position = Markets.GetPositionOnMarket(Q, company); // #{position + 1} var clients = Marketing.GetUsers(company); var change = Marketing.GetAudienceChange(company, Q); var changeFormatted = $"<b>{Format.SignOf(change) + Format.Minify(change)}</b> weekly"; StringBuilder hint = new StringBuilder($"<size=35>{Visuals.Colorize(company.company.Name, hasControl ? Colors.COLOR_CONTROL : Colors.COLOR_NEUTRAL)}</size>"); if (hasControl) { hint.AppendLine(Visuals.Colorize("\n\nYour company", Colors.COLOR_CONTROL)); } else { hint.AppendLine("\n<b>Goals</b>: " + string.Join("\n", company.companyGoal.Goals.Select(g => g.GetFormattedName()))); } hint.AppendLine($"\n\nUsers: <b>{Format.Minify(clients)}</b>"); hint.AppendLine($"{Visuals.Colorize(changeFormatted, change >=0)}\n"); //hint.AppendLine($"Users: <b>{Format.Minify(clients)}</b> {Visuals.Colorize(changeFormatted, change >=0)}\n"); //hint.AppendLine(RenderStars("Product", techStars)); //hint.AppendLine(); // STRENGTH //hint.AppendLine(RenderStars("Company strength", productStrength)); //hint.AppendLine(RenderStars("Budget", budgetStars)); //hint.AppendLine(); //hint.AppendLine(RenderStars("Managers", managerStars)); //hint.AppendLine(RenderStars("Teams", teamStars)); //hint.AppendLine($"\n<b>{company.team.Teams.Count}</b> teams"); //hint.AppendLine($"Managers: <b>{Teams.GetTeamAverageStrength(company, Q)}LVL</b>"); //hint.AppendLine($"\nBudget: <b>{Visuals.Positive(budgetFormatted)}</b>"); //hint.AppendLine(GetProfitDescription()); //if (hasControl) // hint.AppendLine(Visuals.Colorize("\nYour company", Colors.COLOR_CONTROL)); return(hint.ToString()); }
public override void ViewRender() { base.ViewRender(); var company = Flagship; // modal RenderMarketingEfficiencyInModal(company); CalculateROI(company); if (PossibleChannels != null) { Draw(PossibleChannels, !ShowAffordableOnly); } if (AllChannels != null) { Draw(AllChannels, ShowAffordableOnly); } // list var channels = ShowAffordableOnly ? Markets.GetAffordableMarketingChannels(company, Q) : Markets.GetTheoreticallyPossibleMarketingChannels(company); // ---------------------------------------------------- var p = Teams.GetMarketingTaskMockup(); var activeTasks = Teams.GetActiveSameTaskTypeSlots(company, p); var pending = Teams.GetPendingSameTypeTaskAmount(company, p); AmountOfFeatures.text = $"{activeTasks}"; if (pending > 0) { AmountOfFeatures.text += $"+{Visuals.Colorize(pending.ToString(), "orange")}"; } Draw(PendingTaskIcon, pending > 0); AmountOfSlots.text = Visuals.Colorize((long)Teams.GetOverallSlotsForTaskType(company, p)); // ---------------------------------------------------- SetItems(channels.OrderByDescending(c => Marketing.GetChannelCost(company, c.ID))); }
public override void ViewRender() { base.ViewRender(); var markets = Companies.GetPrimaryMarketsAmount(MyCompany); var limit = Companies.GetPrimaryMarketsLimit(MyCompany, Q); bool isOverflow = markets > limit; GetComponent <Text>().text = $"Main markets: {Visuals.Colorize(markets.ToString(), !isOverflow)} / {limit}"; var innovationPenalty = Companies.GetPrimaryMarketsInnovationPenalty(MyCompany, Q); MarketLimitDescription.text = isOverflow ? $"You will receive {Visuals.Negative(innovationPenalty.ToString())}% innovation chance penalty for each product! " : $""; }
public override void ViewRender() { base.ViewRender(); var daughters = Companies.GetDaughtersAmount(MyCompany); var limit = Companies.GetCompanyLimit(MyCompany); bool isOverflow = daughters > limit; GetComponent <Text>().text = $"Company limit: {Visuals.Colorize(daughters.ToString(), !isOverflow)} / {limit}"; var iterationTime = Companies.GetCompanyLimitPenalty(MyCompany, Q); CompanyLimitDescription.text = isOverflow ? $"Product upgrade time will increase by {Visuals.Negative(iterationTime.ToString())}%" : $""; }