コード例 #1
0
    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);
    }
コード例 #2
0
 public int CompareTo(GuiDiplomaticTerm other)
 {
     if (this.Type != other.Type)
     {
         return(this.Type.CompareTo(other.Type));
     }
     if ((this.Type == GuiDiplomaticTerm.TermType.Strategic || this.Type == GuiDiplomaticTerm.TermType.Luxury) && this.ResourceGuiElement != null)
     {
         return(this.ResourceGuiElement.Title.CompareTo(other.ResourceGuiElement.Title));
     }
     if (this.Type == GuiDiplomaticTerm.TermType.City)
     {
         DiplomaticTermCityExchange diplomaticTermCityExchange  = this.Term as DiplomaticTermCityExchange;
         DiplomaticTermCityExchange diplomaticTermCityExchange2 = other.Term as DiplomaticTermCityExchange;
         if (diplomaticTermCityExchange != null && diplomaticTermCityExchange2 != null)
         {
             return(diplomaticTermCityExchange.CityGUID.CompareTo(diplomaticTermCityExchange2.CityGUID));
         }
     }
     if (this.Type == GuiDiplomaticTerm.TermType.Fortress)
     {
         DiplomaticTermFortressExchange diplomaticTermFortressExchange  = this.Term as DiplomaticTermFortressExchange;
         DiplomaticTermFortressExchange diplomaticTermFortressExchange2 = other.Term as DiplomaticTermFortressExchange;
         if (diplomaticTermFortressExchange != null && diplomaticTermFortressExchange2 != null)
         {
             return(diplomaticTermFortressExchange.FortressGUID.CompareTo(diplomaticTermFortressExchange2.FortressGUID));
         }
     }
     if (this.Type == GuiDiplomaticTerm.TermType.Technology)
     {
         DiplomaticTermTechnologyExchange diplomaticTermTechnologyExchange  = this.Term as DiplomaticTermTechnologyExchange;
         DiplomaticTermTechnologyExchange diplomaticTermTechnologyExchange2 = other.Term as DiplomaticTermTechnologyExchange;
         int technologyEraNumber  = DepartmentOfScience.GetTechnologyEraNumber(diplomaticTermTechnologyExchange.TechnologyDefinition);
         int technologyEraNumber2 = DepartmentOfScience.GetTechnologyEraNumber(diplomaticTermTechnologyExchange2.TechnologyDefinition);
         if (technologyEraNumber != technologyEraNumber2)
         {
             return(technologyEraNumber.CompareTo(technologyEraNumber2));
         }
     }
     if (this.Type == GuiDiplomaticTerm.TermType.Prisoner)
     {
         DiplomaticTermPrisonerExchange diplomaticTermPrisonerExchange  = this.Term as DiplomaticTermPrisonerExchange;
         DiplomaticTermPrisonerExchange diplomaticTermPrisonerExchange2 = other.Term as DiplomaticTermPrisonerExchange;
         if (diplomaticTermPrisonerExchange != null && diplomaticTermPrisonerExchange2 != null)
         {
             return(diplomaticTermPrisonerExchange.HeroGuid.CompareTo(diplomaticTermPrisonerExchange2.HeroGuid));
         }
     }
     return(this.Term.Definition.Name.CompareTo(other.Term.Definition.Name));
 }
コード例 #3
0
    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);
    }