Exemplo n.º 1
0
    public override IEnumerator LoadGame(Game game)
    {
        this.technologyDatabase = Databases.GetDatabase <DepartmentOfScience.ConstructibleElement>(false);
        if (this.technologyDatabase == null)
        {
            Diagnostics.LogError("Wasn't able to find the technology database.");
        }
        this.researchQueues.Clear();
        if (this.researchQueues.Count == 0)
        {
            Empire[] array = Array.FindAll <Empire>(base.Game.Empires, (Empire empire) => empire is MajorEmpire);
            for (int i = 0; i < array.Length; i++)
            {
                this.researchQueues.Add(array[i].Index, new ConstructionQueue());
            }
        }
        if (this.researchedTechNames.Count > 0)
        {
            for (int j = 0; j < this.researchedTechNames.Count; j++)
            {
                DepartmentOfScience.ConstructibleElement item = null;
                if (this.technologyDatabase.TryGetValue(this.researchedTechNames[j], out item))
                {
                    this.researchedTechs.Add(item);
                }
            }
        }
        this.AssignLuxuryTypes(KaijuTechsManager.ComputeLuxuryAbundance(game));
        yield return(base.LoadGame(game));

        yield break;
    }
Exemplo n.º 2
0
 public OrderQueueResearch(int empireIndex, DepartmentOfScience.ConstructibleElement constructibleElement, bool Insert = false) : base(empireIndex)
 {
     if (constructibleElement == null)
     {
         throw new ArgumentNullException("constructibleElement");
     }
     this.ConstructionGameEntityGUID = GameEntityGUID.Zero;
     this.ConstructibleElementName   = constructibleElement.Name;
     this.InsertAtFirstPlace         = Insert;
 }
Exemplo n.º 3
0
    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);
    }