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 RefreshCostGroup(DepartmentOfScience.ConstructibleElement.State state)
    {
        bool flag = state != DepartmentOfScience.ConstructibleElement.State.Researched && state != DepartmentOfScience.ConstructibleElement.State.ResearchedButUnavailable;

        if (this.ShowCaptionCost && flag)
        {
            Amplitude.Unity.Gui.IGuiService service = Services.GetService <global::IGuiService>();
            Diagnostics.Assert(service != null);
            DepartmentOfTheTreasury agency = this.empire.GetAgency <DepartmentOfTheTreasury>();
            Diagnostics.Assert(agency != null);
            string empty = string.Empty;
            int    num   = 0;
            PanelFeatureCost.ComputeCostAndTurn(service, this.TechnologyDefinition, agency, this.empire, out empty, out num);
            if (string.IsNullOrEmpty(empty))
            {
                this.CaptionCostGroup.Visible = false;
            }
            else
            {
                this.CostLabel.Text           = empty;
                this.CaptionCostGroup.Visible = true;
            }
        }
        else if (this.CaptionCostGroup != null)
        {
            this.CaptionCostGroup.Visible = false;
        }
    }
    private void FillDecisionMakerVariables()
    {
        if (this.decisionMaker.Context == null)
        {
            return;
        }
        this.decisionMaker.Context.Register("GlobalWarNeed", this.aiLayerDiplomacy.GetGlobalWarNeed());
        this.decisionMaker.Context.Register("IndustryReferenceTurnCount", this.aiLayerResourceAmas.Amas.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.IndustryReferenceTurnCount));
        this.decisionMaker.Context.Register("TechnologyReferenceTurnCount", this.aiLayerResourceAmas.Amas.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.TechnologyReferenceTurnCount));
        this.decisionMaker.Context.Register("MoneyReferenceRatio", this.aiLayerResourceAmas.Amas.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.MoneyReferenceRatio));
        int num  = this.departmentOfScience.CurrentTechnologyEraNumber - 1;
        int num2 = 0;
        int num3 = 0;

        foreach (DepartmentOfScience.ConstructibleElement constructibleElement in this.departmentOfScience.TechnologyDatabase)
        {
            TechnologyDefinition technologyDefinition = constructibleElement as TechnologyDefinition;
            if (technologyDefinition != null)
            {
                int technologyEraNumber = DepartmentOfScience.GetTechnologyEraNumber(technologyDefinition);
                DepartmentOfScience.ConstructibleElement.State technologyState = this.departmentOfScience.GetTechnologyState(constructibleElement);
                if (technologyState == DepartmentOfScience.ConstructibleElement.State.Available)
                {
                    num3++;
                    if (technologyEraNumber < num)
                    {
                        num2++;
                    }
                }
            }
        }
        float num4 = 0f;

        if (num3 > 0)
        {
            num4 = (float)num2 / (float)num3;
        }
        this.decisionMaker.Context.Register("OldTechnologyRatio", num4);
        AILayer_Strategy layer      = base.AIEntity.GetLayer <AILayer_Strategy>();
        float            agentValue = layer.StrategicNetwork.GetAgentValue("Expansion");

        this.decisionMaker.Context.Register("ColonizationPriority", agentValue);
        DepartmentOfTheInterior agency = base.AIEntity.Empire.GetAgency <DepartmentOfTheInterior>();
        float num5 = 0f;

        if (agency.Cities.Count > 0)
        {
            for (int i = 0; i < agency.Cities.Count; i++)
            {
                AgentGroup cityAgentGroup = this.aiLayerResourceAmas.GetCityAgentGroup(agency.Cities[i]);
                if (cityAgentGroup != null)
                {
                    num5 += cityAgentGroup.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.PopulationReferenceTurnCount);
                }
            }
            num5 /= (float)agency.Cities.Count;
        }
        this.decisionMaker.Context.Register("PopulationReferenceTurnCount", num5);
    }
Exemple #4
0
 private void ComputeCurrentEraNumber()
 {
     this.currentEraNumber = -1;
     for (int i = 0; i < this.eras.Count; i++)
     {
         ResearchEraFrame.TechnologyEra technologyEra = this.eras[i];
         DepartmentOfScience.ConstructibleElement.State technologyState = this.departmentOfScience.GetTechnologyState(technologyEra.Definition);
         if (technologyState == DepartmentOfScience.ConstructibleElement.State.Researched && technologyEra.EraNumber > this.currentEraNumber)
         {
             this.currentEraNumber = technologyEra.EraNumber;
         }
     }
 }
    private void OnOrderResponse(object sender, TicketRaisedEventArgs args)
    {
        this.AgeTransform.Enable = true;
        DepartmentOfScience agency = this.empire.GetAgency <DepartmentOfScience>();

        DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(this.TechnologyDefinition);
        if (this.TechnologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.KaijuUnlock))
        {
            IGameService service = Services.GetService <IGameService>();
            if (service == null || service.Game == null)
            {
                Diagnostics.LogError("GameService or GameService.Game is null");
                return;
            }
            IKaijuTechsService service2 = service.Game.Services.GetService <IKaijuTechsService>();
            technologyState = service2.GetTechnologyState(this.TechnologyDefinition, this.empire);
        }
        this.Refresh(this.empire, technologyState);
    }
    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);
        }
    }
    private void OnSelectKaijuUnlockCB(GameObject obj)
    {
        if (this.empire == null)
        {
            Diagnostics.LogError("Empire is null");
            return;
        }
        IGameService service = Services.GetService <IGameService>();

        if (service == null || service.Game == null)
        {
            Diagnostics.LogError("GameService or GameService.Game is null");
            return;
        }
        IKaijuTechsService service2 = service.Game.Services.GetService <IKaijuTechsService>();

        DepartmentOfScience.ConstructibleElement.State technologyState = service2.GetTechnologyState(this.TechnologyDefinition, this.empire);
        ConstructionQueue constructionQueueForEmpire = service2.GetConstructionQueueForEmpire(this.empire);

        if (constructionQueueForEmpire == null)
        {
            return;
        }
        if (technologyState == DepartmentOfScience.ConstructibleElement.State.Available)
        {
            this.AgeTransform.Enable = false;
            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 construction = constructionQueueForEmpire.Get(this.TechnologyDefinition);
            this.CancelResearch(construction);
            this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver);
        }
    }
Exemple #8
0
    public override IEnumerator Ignite(IGameEntity gameEntity, Amplitude.Unity.Framework.IServiceProvider serviceProvider)
    {
        yield return(base.Ignite(gameEntity, serviceProvider));

        string text = base.PointOfInterest.Type;

        if (text != null)
        {
            if (WorldPointOfInterest_QuestLocation.< > f__switch$map24 == null)
            {
                WorldPointOfInterest_QuestLocation.< > f__switch$map24 = new Dictionary <string, int>(2)
                {
                    {
                        "NavalQuestLocation",
                        0
                    },
                    {
                        "QuestLocation",
                        0
                    }
                };
            }
            int num;
            if (WorldPointOfInterest_QuestLocation.< > f__switch$map24.TryGetValue(text, out num))
            {
                if (num == 0)
                {
                    int bits = base.PointOfInterest.Interaction.Bits & base.PlayerControllerRepositoryService.ActivePlayerController.Empire.Bits;
                    if (bits == 0)
                    {
                        base.PointOfInterest.Interaction.PointOfInterestInteractionChange += this.Interaction_PointOfInterestInteractionChange;
                        this.interactionBitsBound = true;
                    }
                    if (bits == base.PlayerControllerRepositoryService.ActivePlayerController.Empire.Bits)
                    {
                        DepartmentOfScience departmentOfScience = base.PlayerControllerRepositoryService.ActivePlayerController.Empire.GetAgency <DepartmentOfScience>();
                        Diagnostics.Assert(departmentOfScience != null);
                        if (!StaticString.IsNullOrEmpty(departmentOfScience.ArcheologyTechnologyDefinitionName))
                        {
                            DepartmentOfScience.ConstructibleElement.State state = departmentOfScience.GetTechnologyState(departmentOfScience.ArcheologyTechnologyDefinitionName);
                            if (state != DepartmentOfScience.ConstructibleElement.State.Researched)
                            {
                                base.PointOfInterest.Interaction.PointOfInterestInteractionChange += this.Interaction_PointOfInterestInteractionChange;
                                this.interactionBitsBound = true;
                            }
                        }
                    }
                    StaticString questLocationType = base.PointOfInterest.SimulationObject.GetDescriptorNameFromType("QuestLocationType");
                    if (questLocationType == "QuestLocationTypeTemple")
                    {
                        this.sensibleToEndlessDay = true;
                        DownloadableContent8.EndlessDay.ActivationChange += this.EndlessDay_ActivationChange;
                        SeasonManager.DustDepositsToggle += this.DustDepositsToggle;
                    }
                    if (base.PointOfInterest is IWorldEntityMappingOverride)
                    {
                        ((IWorldEntityMappingOverride)base.PointOfInterest).TryResolve(out this.interpreterContext);
                    }
                    if (this.interpreterContext == null)
                    {
                        this.interpreterContext = new InterpreterContext(base.PointOfInterest);
                    }
                    this.RefreshVFXEffects();
                }
            }
        }
        yield break;
    }
    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);
    }
    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);
    }
Exemple #11
0
    protected override void EvaluateNeeds(StaticString context, StaticString pass)
    {
        base.EvaluateNeeds(context, pass);
        if (!this.CanUseAltar())
        {
            return;
        }
        if (!this.seasonService.IsAlive || this.seasonService.Target == null)
        {
            return;
        }
        Season winterSeason = this.seasonService.Target.GetWinterSeason();

        if (this.seasonService.Target.IsCurrentSeason(winterSeason))
        {
            return;
        }
        global::Game        game = Services.GetService <IGameService>().Game as global::Game;
        List <SeasonEffect> candidateEffectsForSeasonType = this.seasonService.Target.GetCandidateEffectsForSeasonType(Season.ReadOnlyWinter);

        Diagnostics.Assert(this.elementEvaluator != null);
        this.decisions.Clear();
        this.RegisterInterpreterContextData();
        if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools)
        {
            EvaluationData <SeasonEffect, InterpreterContext> evaluationData = new EvaluationData <SeasonEffect, InterpreterContext>();
            this.elementEvaluator.Evaluate(candidateEffectsForSeasonType, ref this.decisions, evaluationData);
            evaluationData.Turn = game.Turn;
            this.SeasonEffectsEvaluationDataHistoric.Add(evaluationData);
        }
        else
        {
            this.elementEvaluator.Evaluate(candidateEffectsForSeasonType, ref this.decisions, null);
        }
        if (this.decisions.Count <= 0)
        {
            return;
        }
        int num  = 0;
        int num2 = 0;

        for (int i = 0; i < candidateEffectsForSeasonType.Count; i++)
        {
            SeasonEffect seasonEffect = candidateEffectsForSeasonType[i];
            int          seasonEffectDisplayedScoreForEmpire = this.seasonService.Target.GetSeasonEffectDisplayedScoreForEmpire(base.AIEntity.Empire, seasonEffect);
            if (seasonEffectDisplayedScoreForEmpire > num)
            {
                num  = seasonEffectDisplayedScoreForEmpire;
                num2 = 1;
            }
            else if (seasonEffectDisplayedScoreForEmpire == num)
            {
                num2++;
            }
        }
        DecisionResult decisionResult = this.decisions[0];
        float          score          = decisionResult.Score;
        float          score2         = this.decisions[this.decisions.Count - 1].Score;
        float          num3           = score - score2;

        num3 = Mathf.Clamp01(num3 / this.maximumGainFromXml);
        SeasonEffect seasonEffect2 = decisionResult.Element as SeasonEffect;

        Diagnostics.Assert(seasonEffect2 != null);
        int seasonEffectScore = this.seasonService.Target.GetSeasonEffectScore(seasonEffect2);

        if (seasonEffectScore == num && num2 == 1)
        {
            return;
        }
        int neededVoteCount = num - seasonEffectScore + 1;
        List <EvaluableMessage_VoteForSeasonEffect> list = new List <EvaluableMessage_VoteForSeasonEffect>(base.AIEntity.AIPlayer.Blackboard.GetMessages <EvaluableMessage_VoteForSeasonEffect>(BlackboardLayerID.Empire, (EvaluableMessage_VoteForSeasonEffect message) => message.EvaluationState != EvaluableMessage.EvaluableMessageState.Obtained && message.EvaluationState != EvaluableMessage.EvaluableMessageState.Cancel));
        EvaluableMessage_VoteForSeasonEffect        evaluableMessage_VoteForSeasonEffect;

        if (list.Count == 0)
        {
            evaluableMessage_VoteForSeasonEffect = new EvaluableMessage_VoteForSeasonEffect(seasonEffect2.SeasonEffectDefinition.Name, 1, AILayer_AccountManager.OrbAccountName);
            base.AIEntity.AIPlayer.Blackboard.AddMessage(evaluableMessage_VoteForSeasonEffect);
        }
        else
        {
            evaluableMessage_VoteForSeasonEffect = list[0];
            if (seasonEffect2.SeasonEffectDefinition.Name != evaluableMessage_VoteForSeasonEffect.SeasonEffectReference)
            {
                Diagnostics.Log("AI don't want to vote for the season effect {0} anymore. AI now wants season effect {1}.", new object[]
                {
                    evaluableMessage_VoteForSeasonEffect.SeasonEffectReference,
                    seasonEffect2.SeasonEffectDefinition.Name
                });
                evaluableMessage_VoteForSeasonEffect.Cancel();
                evaluableMessage_VoteForSeasonEffect = new EvaluableMessage_VoteForSeasonEffect(seasonEffect2.SeasonEffectDefinition.Name, 1, AILayer_AccountManager.OrbAccountName);
                base.AIEntity.AIPlayer.Blackboard.AddMessage(evaluableMessage_VoteForSeasonEffect);
            }
        }
        float num4 = this.seasonService.Target.ComputePrayerOrbCost(base.AIEntity.Empire);
        float num5 = 10f * base.AIEntity.Empire.GetPropertyValue(SimulationProperties.GameSpeedMultiplier);
        int   num6 = this.seasonService.Target.GetExactSeasonStartTurn(winterSeason) - game.Turn;
        float num7 = Mathf.Clamp01((num5 - (float)num6) / num5);
        float num8 = num3 * (0.5f + num7 / 2f);

        num8 = Mathf.Clamp01(num8);
        int num9 = this.ComputeWantedNumberOfOrbs(neededVoteCount);
        DepartmentOfScience agency = base.AIEntity.Empire.GetAgency <DepartmentOfScience>();
        float num10 = 0f;
        float num11 = 0f;

        for (int j = 0; j < this.orbUnlockDefinitions.Length; j++)
        {
            TechnologyDefinition technologyDefinition = this.orbUnlockDefinitions[j];
            if (DepartmentOfTheTreasury.CheckConstructiblePrerequisites(base.AIEntity.Empire, technologyDefinition, new string[]
            {
                ConstructionFlags.Prerequisite
            }))
            {
                DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(technologyDefinition);
                if (technologyState != DepartmentOfScience.ConstructibleElement.State.Researched && technologyState != DepartmentOfScience.ConstructibleElement.State.NotAvailable)
                {
                    num11 += 1f;
                }
                else if (technologyState == DepartmentOfScience.ConstructibleElement.State.Researched)
                {
                    num10 += 1f;
                }
            }
        }
        float num12 = num11 / (num11 + num10);

        num12 = Mathf.Min(1f, Mathf.Max(0f, 2f * num12 - 0.6f));
        if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools)
        {
            Diagnostics.Log("[ELCP: AILayer_Altar] {0} has reasearched {1} of {2} Orb Techs", new object[]
            {
                base.AIEntity.Empire,
                num10,
                num11 + num10
            });
            Diagnostics.Log("... Season Effect Voting score altered from {0} to {1}", new object[]
            {
                num8,
                num8 * num12
            });
        }
        evaluableMessage_VoteForSeasonEffect.VoteCount = num9;
        evaluableMessage_VoteForSeasonEffect.Refresh(0.5f, num8 * num12, (float)num9 * num4, int.MaxValue);
    }