private void OnSelectOrbUnlockCB(GameObject obj) { if (this.empire == null) { Diagnostics.LogError("Empire is null"); return; } DepartmentOfScience agency = this.empire.GetAgency <DepartmentOfScience>(); DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(this.TechnologyDefinition); ConstructionQueue constructionQueueForTech = agency.GetConstructionQueueForTech(this.TechnologyDefinition); if (technologyState == DepartmentOfScience.ConstructibleElement.State.Available && agency.OrbUnlockQueue.Length < 2) { this.AgeTransform.Enable = false; if (agency.OrbUnlockQueue.Length > 0) { Construction construction = constructionQueueForTech.Peek(); this.CancelResearch(construction); } this.QueueResearch(); this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver); } else if (technologyState == DepartmentOfScience.ConstructibleElement.State.InProgress || technologyState == DepartmentOfScience.ConstructibleElement.State.Queued) { this.AgeTransform.Enable = false; Construction construction2 = constructionQueueForTech.Get(this.TechnologyDefinition); this.CancelResearch(construction2); this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver); } }
private void OnSelectTechnologyCB(GameObject obj) { if (this.empire == null) { Diagnostics.LogError("Empire is null"); return; } DepartmentOfScience agency = this.empire.GetAgency <DepartmentOfScience>(); DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(this.TechnologyDefinition); ConstructionQueue constructionQueueForTech = agency.GetConstructionQueueForTech(this.TechnologyDefinition); if (technologyState == DepartmentOfScience.ConstructibleElement.State.Available) { this.AgeTransform.Enable = false; if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools && Input.GetKey(KeyCode.G)) { this.ForceUnlockTechnology(); } else { this.QueueResearch(); } this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver); return; } if (technologyState == DepartmentOfScience.ConstructibleElement.State.InProgress || technologyState == DepartmentOfScience.ConstructibleElement.State.Queued) { this.AgeTransform.Enable = false; Construction construction = constructionQueueForTech.Get(this.TechnologyDefinition); this.CancelResearch(construction); if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools && Input.GetKey(KeyCode.G)) { this.ForceUnlockTechnology(); } this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver); } }
public void Refresh(global::Empire empire, DepartmentOfScience.ConstructibleElement.State state) { if (this.Button != null) { this.Button.AgeTransform.Enable = true; } TechnologyDefinitionVisibility visibility = this.TechnologyDefinition.Visibility; if (visibility != TechnologyDefinitionVisibility.VisibleWhenUnlocked) { if (visibility == TechnologyDefinitionVisibility.BasedOnPrerequisites) { bool flag = DepartmentOfTheTreasury.CheckConstructiblePrerequisites(empire, this.TechnologyDefinition, new string[] { "Visibility" }); if (flag) { this.AgeTransform.Visible = true; } else { this.AgeTransform.Visible = false; } } } else { if (state != DepartmentOfScience.ConstructibleElement.State.Researched) { this.AgeTransform.Visible = false; return; } if (!this.AgeTransform.Visible) { this.AgeTransform.Visible = true; this.SetSimpleMode(false); } } this.UnlockDisabled.Visible = false; this.InProgressSector.AgeTransform.Visible = false; this.OrderCaption.AgeTransform.Visible = false; DepartmentOfScience agency = empire.GetAgency <DepartmentOfScience>(); bool flag2 = false; int num = 0; ConstructionQueue constructionQueueForTech = agency.GetConstructionQueueForTech(this.TechnologyDefinition); if ((state == DepartmentOfScience.ConstructibleElement.State.Queued || state == DepartmentOfScience.ConstructibleElement.State.InProgress) && constructionQueueForTech.Length > 1) { flag2 = true; if (state == DepartmentOfScience.ConstructibleElement.State.Queued) { for (int i = 0; i < constructionQueueForTech.Length; i++) { DepartmentOfScience.ConstructibleElement constructibleElement = constructionQueueForTech.PeekAt(i).ConstructibleElement as DepartmentOfScience.ConstructibleElement; if (constructibleElement.Name == this.TechnologyDefinition.Name) { num = i; break; } } } } bool flag3 = this.TechnologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Affinity) || this.TechnologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Medal) || this.TechnologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Quest); bool flag4 = this.TechnologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.OrbUnlock); Color tintColor; Color tintColor2; Color tintColor3; Color tintColor4; switch (state) { case DepartmentOfScience.ConstructibleElement.State.Available: tintColor = ((!flag4) ? this.AvailableColor : this.AvailableOrbUnlockColor); tintColor2 = ((!flag3) ? ((!flag4) ? this.AvailableBackdropColor : this.AvailableOrbUnlockBackdropColor) : this.AvailableBackdropColorAffinity); tintColor3 = this.AvailableSymbolColor; tintColor4 = this.GlowAvailableColor; break; case DepartmentOfScience.ConstructibleElement.State.Queued: tintColor = this.QueuedColor; tintColor2 = ((!flag3) ? this.QueuedBackdropColor : this.QueuedBackdropColorAffinity); tintColor3 = this.QueuedSymbolColor; tintColor4 = this.GlowAvailableColor; this.OrderCaption.AgeTransform.Visible = true; this.OrderCaption.TintColor = this.QueuedColor; this.OrderLabel.Text = (num + 1).ToString(); break; case DepartmentOfScience.ConstructibleElement.State.InProgress: tintColor = this.InProgressColor; tintColor2 = ((!flag3) ? this.InProgressBackdropColor : this.InProgressBackdropColorAffinity); tintColor3 = this.InProgressSymbolColor; tintColor4 = this.GlowAvailableColor; this.InProgressSector.AgeTransform.Visible = true; if (flag2) { this.OrderCaption.AgeTransform.Visible = true; this.OrderCaption.TintColor = this.InProgressColor; this.OrderLabel.Text = (num + 1).ToString(); } break; case DepartmentOfScience.ConstructibleElement.State.Researched: if (this.Button != null) { this.Button.AgeTransform.Enable = false; } tintColor = ((!flag4) ? this.ResearchedColor : this.ResearchedOrbUnlockColor); tintColor2 = ((!flag3) ? this.ResearchedBackdropColor : this.ResearchedBackdropColorAffinity); tintColor3 = this.ResearchedSymbolColor; tintColor4 = this.GlowAvailableColor; break; case DepartmentOfScience.ConstructibleElement.State.ResearchedButUnavailable: if (this.Button != null) { this.Button.AgeTransform.Enable = false; } tintColor = this.ResearchedButUnavailableColor; tintColor2 = ((!flag3) ? this.ResearchedBackdropColor : this.ResearchedBackdropColorAffinity); tintColor3 = this.ResearchedSymbolColor; tintColor4 = this.GlowNotAvailableColor; this.UnlockDisabled.Visible = true; break; default: tintColor = this.NotAvailableColor; tintColor2 = ((!flag3) ? this.NotAvailableBackdropColor : this.NotAvailableBackdropColorAffinity); tintColor3 = this.NotAvailableSymbolColor; tintColor4 = this.GlowNotAvailableColor; if (this.Button != null) { this.Button.AgeTransform.Enable = false; } this.UnlockDisabled.Visible = true; break; } this.CircularFrame.TintColor = tintColor; this.CaptionFullBackground.TintColor = tintColor2; this.CaptionTopBackground.TintColor = tintColor2; this.CaptionBottomBackground.TintColor = tintColor2; this.EraLabel.TintColor = tintColor3; this.CategoryIcon.TintColor = tintColor3; this.SubCategoryIcon.TintColor = tintColor3; this.CategoryFullIcon.TintColor = tintColor3; this.SubCategoryFullIcon.TintColor = tintColor3; this.GlowImage.TintColor = tintColor4; this.RefreshCostGroup(state); }