private void RefreshCurrentResearch() { DepartmentOfScience agency = base.Empire.GetAgency <DepartmentOfScience>(); DepartmentOfTheTreasury agency2 = base.Empire.GetAgency <DepartmentOfTheTreasury>(); Construction construction = agency.ResearchQueue.Peek(); IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName) && base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1)) { this.ResearchBuyoutButton.AgeTransform.Visible = true; this.ResearchBuyoutLabel.AgeTransform.Visible = true; this.CurrentResearchTitle.AgeTransform.Visible = false; this.EmpireResearchPanel.Enable = true; this.EmpireResearchPanel.AgeTooltip.Class = string.Empty; this.EmpireResearchPanel.AgeTooltip.Content = string.Empty; this.EmpireResearchPanel.AgeTooltip.ClientData = null; ConstructibleElement technology = null; if (this.departmentOfScience.ResearchQueue.Peek() != null) { technology = this.departmentOfScience.ResearchQueue.Peek().ConstructibleElement; } float buyOutTechnologyCost = this.departmentOfScience.GetBuyOutTechnologyCost(technology); float num = -buyOutTechnologyCost; string newValue = GuiFormater.FormatInstantCost(base.Empire, buyOutTechnologyCost, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 0); string content; if (construction != null) { this.ResearchBuyoutLabel.AgeTransform.Alpha = 1f; TechnologyDefinition technologyDefinition = construction.ConstructibleElement as TechnologyDefinition; if (technologyDefinition != null) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetTechnologyTitle(technologyDefinition)), this.ResearchBuyoutLabel, out this.format, '.'); DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, base.Empire, this.ResearchBuyoutLabel.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); } if (agency2.IsTransferOfResourcePossible(base.Empire, DepartmentOfTheTreasury.Resources.TechnologiesBuyOut, ref num) && this.interactionsAllowed) { this.ResearchBuyoutButton.AgeTransform.Enable = true; this.ResearchBuyoutButton.AgeTransform.Alpha = 1f; this.ResearchBuyoutLabel.Text = this.format; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutAvailableFormat").Replace("$Cost", newValue); } else { this.ResearchBuyoutButton.AgeTransform.Enable = false; this.ResearchBuyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutLabel.Text = this.format; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutUnavailableFormat").Replace("$Cost", newValue); } } else { this.ResearchBuyoutButton.AgeTransform.Enable = false; this.ResearchBuyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutLabel.Text = "%ResearchNoneTitle"; this.ResearchBuyoutLabel.AgeTransform.Alpha = 0.5f; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutNoSelection"); this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.Class = string.Empty; this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.Content = "%ResearchNoneDescription"; this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.ClientData = null; } if (this.ResearchBuyoutButton.AgeTransform.AgeTooltip != null) { this.ResearchBuyoutButton.AgeTransform.AgeTooltip.Content = content; return; } } else { this.ResearchBuyoutButton.AgeTransform.Visible = false; this.ResearchBuyoutLabel.AgeTransform.Visible = false; this.CurrentResearchTitle.AgeTransform.Visible = true; if (construction != null) { this.EmpireResearchPanel.Enable = true; int num2 = agency2.ComputeConstructionRemainingTurn(base.Empire, construction); if (num2 == 2147483647) { this.format = string.Format("$Tech ({0})", GuiFormater.Infinite.ToString()); } else { this.format = string.Format("$Tech ({0})", QueueGuiItem.FormatNumberOfTurns(num2)); } TechnologyDefinition technologyDefinition2 = construction.ConstructibleElement as TechnologyDefinition; if (technologyDefinition2 != null) { AgeUtils.TruncateStringWithSubst(this.format, "$Tech", AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetTechnologyTitle(technologyDefinition2)), this.CurrentResearchTitle, out this.format, '.'); this.CurrentResearchTitle.Text = this.format; DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition2, base.Empire, this.EmpireResearchPanel.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); } } else { this.EmpireResearchPanel.Enable = false; AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%ResearchNoneTitle"), this.CurrentResearchTitle, out this.format, '.'); this.CurrentResearchTitle.Text = this.format; this.EmpireResearchPanel.AgeTooltip.Class = string.Empty; this.EmpireResearchPanel.AgeTooltip.Content = "%ResearchNoneDescription"; this.EmpireResearchPanel.AgeTooltip.ClientData = null; } this.CurrentResearchTitle.Text = this.format; } }
public override void RefreshContent() { base.RefreshContent(); base.Empire.Refresh(false); DepartmentOfScience agency = base.Empire.GetAgency <DepartmentOfScience>(); DepartmentOfTheTreasury agency2 = base.Empire.GetAgency <DepartmentOfTheTreasury>(); this.ComputeCurrentEraNumber(); this.CurrentEraNumber.Text = AgeUtils.ToRoman(this.currentEraNumber); this.ResearchErasTable.RefreshChildrenIList <ResearchEraFrame.TechnologyEra>(this.eras, this.refreshEraDelegate, true, false); Construction construction = agency.ResearchQueue.Peek(); bool flag = construction != null; float quantity; if (flag) { quantity = DepartmentOfTheTreasury.GetProductionCostWithBonus(base.Empire.SimulationObject, construction.ConstructibleElement, DepartmentOfTheTreasury.Resources.EmpireResearch); } else { quantity = agency.GetResearchPropertyValue(SimulationProperties.TechnologyCost); } this.TechnologyCostValue.Text = GuiFormater.FormatQuantity(quantity, SimulationProperties.EmpireResearch, 1); float quantity2; agency2.TryGetNetResourceValue(base.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpireResearch, out quantity2, false); this.EmpireOutputValue.Text = GuiFormater.FormatQuantity(quantity2, SimulationProperties.EmpireResearch, 0); if (flag) { float num = agency2.ComputeConstructionProgress(base.Empire, construction); this.ResearchProgress.Text = Mathf.RoundToInt(num * 100f).ToString() + "%"; int num2 = agency2.ComputeConstructionRemainingTurn(base.Empire, construction); num2 = Mathf.Max(num2, 1); if (num2 == 2147483647) { this.ResearchTurns.Text = GuiFormater.Infinite.ToString(); } else { this.ResearchTurns.Text = num2.ToString(); } TechnologyDefinition technologyDefinition = construction.ConstructibleElement as TechnologyDefinition; if (technologyDefinition != null) { this.TechnologyName.Text = DepartmentOfScience.GetTechnologyTitle(technologyDefinition); this.TechnologyImage.Image = DepartmentOfScience.GetTechnologyImage(technologyDefinition, GuiPanel.IconSize.Small); } DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, base.Empire, this.TechnologyName.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); } else { this.TechnologyName.Text = "%ResearchNoneTitle"; this.TechnologyImage.Image = null; this.ResearchProgress.Text = "%ResearchVoidSymbol"; this.ResearchTurns.Text = "%ResearchVoidSymbol"; if (this.TechnologyName.AgeTransform.AgeTooltip != null) { this.TechnologyName.AgeTransform.AgeTooltip.Class = string.Empty; this.TechnologyName.AgeTransform.AgeTooltip.Content = string.Empty; this.TechnologyName.AgeTransform.AgeTooltip.ClientData = null; } if (this.TechnologyImage.AgeTransform.AgeTooltip != null) { this.TechnologyImage.AgeTransform.AgeTooltip.Class = string.Empty; this.TechnologyImage.AgeTransform.AgeTooltip.Content = string.Empty; this.TechnologyImage.AgeTransform.AgeTooltip.ClientData = null; } } IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName) && base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1)) { this.TechnologyStatsGroup.Visible = false; this.ResearchBuyoutButton.AgeTransform.Visible = true; this.ResearchCompletionGroup.Visible = false; this.RefreshBuyout(this.ResearchBuyoutButton); return; } this.TechnologyStatsGroup.Visible = true; this.ResearchBuyoutButton.AgeTransform.Visible = false; this.ResearchCompletionGroup.Visible = true; }
public void GenerateTooltip(AgeTooltip ageTooltip) { if (this.Type == GuiDiplomaticTerm.TermType.Dust) { ageTooltip.Class = "Simple"; ageTooltip.Content = string.Empty; ageTooltip.ClientData = null; return; } if (this.Type == GuiDiplomaticTerm.TermType.City && this.Term.Definition.Name == DiplomaticTermCityExchange.MimicsCityDeal) { string text = this.Term.EmpireWhichProvides.Faction.Affinity.Name.ToString(); text = text.Replace("Affinity", ""); if (text == "Mezari") { text = "Vaulters"; } ageTooltip.Class = "Simple"; ageTooltip.Content = "#FFB43F#" + AgeLocalizer.Instance.LocalizeString("%" + text + "IntegrationDescriptor1Title") + "#REVERT#\n\n" + AgeLocalizer.Instance.LocalizeString("%" + text + "IntegrationDescriptor1EffectOverride"); ageTooltip.ClientData = null; return; } if (this.Type == GuiDiplomaticTerm.TermType.Strategic || this.Type == GuiDiplomaticTerm.TermType.Luxury) { DiplomaticTermResourceExchange diplomaticTermResourceExchange = this.Term as DiplomaticTermResourceExchange; ResourceDefinition resourceDefinition; if (diplomaticTermResourceExchange != null && Databases.GetDatabase <ResourceDefinition>(false).TryGetValue(diplomaticTermResourceExchange.ResourceName, out resourceDefinition)) { IPlayerControllerRepositoryService service = Services.GetService <IGameService>().Game.Services.GetService <IPlayerControllerRepositoryService>(); Diagnostics.Assert(service != null); ResourceTooltipData resourceTooltipData = new ResourceTooltipData(resourceDefinition, service.ActivePlayerController.Empire as global::Empire); if (this.Type == GuiDiplomaticTerm.TermType.Luxury) { IDatabase <BoosterDefinition> database = Databases.GetDatabase <BoosterDefinition>(false); if (database != null) { resourceTooltipData.Constructible = database.GetValue("Booster" + resourceDefinition.Name); } } ageTooltip.Class = resourceTooltipData.TooltipClass; ageTooltip.Content = resourceDefinition.Name; ageTooltip.ClientData = resourceTooltipData; return; } } else if (this.Type == GuiDiplomaticTerm.TermType.Booster) { DiplomaticTermBoosterExchange diplomaticTermBoosterExchange = this.Term as DiplomaticTermBoosterExchange; BoosterDefinition boosterDefinition; if (diplomaticTermBoosterExchange != null && Databases.GetDatabase <BoosterDefinition>(false).TryGetValue(diplomaticTermBoosterExchange.BoosterDefinitionName, out boosterDefinition)) { GuiStackedBooster guiStackedBooster = new GuiStackedBooster(boosterDefinition); ageTooltip.Class = guiStackedBooster.BoosterDefinition.TooltipClass; ageTooltip.Content = guiStackedBooster.BoosterDefinition.Name; ageTooltip.ClientData = guiStackedBooster; return; } } else { if (this.Type == GuiDiplomaticTerm.TermType.Technology) { DepartmentOfScience.BuildTechnologyTooltip((this.Term as DiplomaticTermTechnologyExchange).TechnologyDefinition, this.Term.EmpireWhichProvides, ageTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); return; } if (this.Type == GuiDiplomaticTerm.TermType.Orb) { ageTooltip.Class = "OrbResource"; ageTooltip.Content = "Orb"; ageTooltip.ClientData = null; return; } ageTooltip.Class = "Simple"; ageTooltip.Content = this.Description; ageTooltip.ClientData = this; } }
public void SetupTechnology(global::Empire empire, TechnologyDefinition technologyDefinition, GameObject client) { this.empire = empire; this.TechnologyDefinition = technologyDefinition; this.selectionClient = client; if (this.TagsList == null) { this.TagsList = new List <string>(); } else { this.TagsList.Clear(); } if (this.empire == null) { return; } this.BuildTags(); if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Quest)) { this.EraLabel.Text = string.Empty; AgePrimitiveLabel eraLabel = this.EraLabel; eraLabel.Text += (char)this.QuestCharNumber; } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Medal)) { this.EraLabel.Text = string.Empty; AgePrimitiveLabel eraLabel2 = this.EraLabel; eraLabel2.Text += (char)this.MedalCharNumber; } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Affinity)) { this.EraLabel.Text = string.Empty; AgePrimitiveLabel eraLabel3 = this.EraLabel; eraLabel3.Text += GuiEmpire.GetFactionSymbolString(this.empire, this.empire); } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.OrbUnlock)) { this.EraLabel.Text = string.Empty; } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.KaijuUnlock)) { this.EraLabel.Text = string.Empty; } else { int technologyEraNumber = DepartmentOfScience.GetTechnologyEraNumber(technologyDefinition); if (technologyEraNumber > 0) { this.EraLabel.Text = AgeUtils.ToRoman(technologyEraNumber); } else { this.EraLabel.Text = "-"; } } this.GlowImage.AgeTransform.Visible = false; IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null && service.IsShared(DownloadableContent9.ReadOnlyName) && technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Unique)) { this.GlowImage.AgeTransform.Visible = true; } if (this.UnlockImage != null) { this.UnlockImage.Image = DepartmentOfScience.GetTechnologyImage(technologyDefinition, global::GuiPanel.IconSize.Small); } this.CategoryIcon.Image = DepartmentOfScience.GetCategoryIcon(technologyDefinition, global::GuiPanel.IconSize.Small); this.CategoryFullIcon.Image = this.CategoryIcon.Image; if (this.SubCategoryIcon.Image != null) { this.CategoryIcon.AgeTransform.PixelOffsetLeft = -this.CategoryIcon.AgeTransform.Width; this.CategoryFullIcon.AgeTransform.PixelOffsetLeft = -this.CategoryFullIcon.AgeTransform.Width; } else { this.CategoryIcon.AgeTransform.PixelOffsetLeft = -(0.5f * this.CategoryIcon.AgeTransform.Width); this.CategoryFullIcon.AgeTransform.PixelOffsetLeft = -(0.5f * this.CategoryFullIcon.AgeTransform.Width); } this.SubCategoryIcon.Image = DepartmentOfScience.GetSubCategoryIcon(technologyDefinition, global::GuiPanel.IconSize.Small); this.SubCategoryFullIcon.Image = this.SubCategoryIcon.Image; DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, this.empire, this.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); this.InProgressSector.TintColor = this.InProgressColor; this.MarkupGroup.Visible = false; DepartmentOfScience agency = empire.GetAgency <DepartmentOfScience>(); DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(technologyDefinition); this.Refresh(empire, technologyState); }