Ejemplo n.º 1
0
    private void RefreshSelectedFaction()
    {
        GuiFaction selectedGuiFaction = this.GetSelectedGuiFaction(this.guiFactions);

        this.FactionDroplist.ItemTable = (from guiFaction in this.guiFactions
                                          select guiFaction.IconAndTitle).ToArray <string>();
        this.FactionDroplist.TooltipTable = (from guiFaction in this.guiFactions
                                             select guiFaction.Description).ToArray <string>();
        this.FactionDroplist.ReadOnly          = this.IsReadOnly;
        this.FactionDroplist.OnSelectionObject = base.gameObject;
        this.FactionDroplist.OnSelectionMethod = "OnChangeFactionCB";
        if (selectedGuiFaction == null)
        {
            this.FactionDroplist.SelectedItem     = 0;
            this.FactionPortrait.Image            = null;
            this.FactionLogo.AgeTransform.Visible = false;
            return;
        }
        this.FactionDroplist.SelectedItem     = this.guiFactions.IndexOf(selectedGuiFaction);
        this.FactionPortrait.Image            = selectedGuiFaction.GetImageTexture(GuiPanel.IconSize.Leader, false);
        this.FactionLogo.AgeTransform.Visible = true;
        this.FactionLogo.Image     = selectedGuiFaction.GetImageTexture(GuiPanel.IconSize.LogoSmall, false);
        this.FactionLogo.TintColor = Color.white;
        this.AdvancedFactionButton.AgeTransform.Enable = !this.IsReadOnly;
    }
Ejemplo n.º 2
0
 private void RefreshParticipantScoreLine(AgeTransform tableitem, EmpireInfo empireInfo, int index)
 {
     tableitem.SetupCustomELCPScaling(this.ParticipantsScoreTableScale);
     if (this.visibleEmpires.Contains(empireInfo.EmpireIndex))
     {
         tableitem.Visible = true;
         ParticipantScoreLine component = tableitem.GetComponent <ParticipantScoreLine>();
         component.ParticipantName.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale);
         component.ParticipantScore.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale);
         component.ParticipantLogoBackground.TintColor = empireInfo.FactionColor;
         component.ParticipantName.Text = empireInfo.LocalizedName;
         GuiFaction guiFaction = new GuiFaction(empireInfo.Faction);
         component.ParticipantLogo.Image = guiFaction.GetImageTexture(GuiPanel.IconSize.LogoLarge, true);
         Snapshot[] snapshots = this.Snapshot.Snapshots;
         string     name      = string.Format("Turn #{0}", snapshots.Length - 1);
         Snapshot   snapshot;
         Snapshot   snapshot2;
         if (this.Snapshot.TryGetSnapshot(name, out snapshot) && snapshot.TryGetSnapshot(empireInfo.EmpireName, out snapshot2))
         {
             float num;
             snapshot2.TryRead(this.CurrentScoreDefinition.Name, out num);
             string str      = "";
             int    decimals = 0;
             component.ParticipantScore.WordWrap = false;
             if (num >= 1000f)
             {
                 str = "k";
                 if (num <= 10000f)
                 {
                     num      = Mathf.Round(num / 100f);
                     num     /= 10f;
                     decimals = 1;
                 }
                 else if (num <= 999999f)
                 {
                     num = Mathf.Round(num / 1000f);
                 }
                 else if (num <= 9999999f)
                 {
                     num      = Mathf.Round(num / 100000f);
                     num     /= 10f;
                     str      = "M";
                     decimals = 1;
                 }
                 else if (num > 9999999f)
                 {
                     num = Mathf.Round(num / 1000000f);
                     str = "M";
                 }
             }
             component.ParticipantScore.Text = GuiFormater.FormatGui(num, false, false, false, decimals) + str;
             return;
         }
     }
     else
     {
         tableitem.Visible = false;
     }
 }