public override void Pack(BinaryWriter writer)
 {
     base.Pack(writer);
     writer.Write(this.ForceEdit);
     if (this.RetrofitCosts == null)
     {
         writer.Write(0);
         return;
     }
     writer.Write(this.RetrofitCosts.Length);
     for (int i = 0; i < this.RetrofitCosts.Length; i++)
     {
         IConstructionCost constructionCost = this.RetrofitCosts[i];
         writer.Write(constructionCost.GetType().FullName);
         constructionCost.Serialize(writer);
     }
 }
Beispiel #2
0
    private void RefreshCosts()
    {
        IConstructionCost[] array              = this.ArmyAction.Costs;
        ArmyAction_Bribe    armyAction_Bribe   = this.ArmyAction as ArmyAction_Bribe;
        ArmyAction_Convert  armyAction_Convert = this.ArmyAction as ArmyAction_Convert;

        if (armyAction_Bribe != null || armyAction_Convert != null)
        {
            Village village = this.Target as Village;
            if (village != null)
            {
                IConstructionCost[] array2 = null;
                if (armyAction_Bribe != null)
                {
                    IConstructionCost[] array3 = armyAction_Bribe.GetBribeCosts(this.Army, village);
                    array2 = array3;
                }
                else if (armyAction_Convert != null)
                {
                    IConstructionCost[] array3 = armyAction_Convert.GetConvertionCost(this.Army, village);
                    array2 = array3;
                }
                if (array2 != null && array2.Length != 0)
                {
                    if (array == null)
                    {
                        array = array2;
                    }
                    else
                    {
                        Array.Resize <IConstructionCost>(ref array, array.Length + array2.Length);
                        Array.Copy(array2, 0, array, array.Length - array2.Length, array2.Length);
                    }
                }
            }
        }
        if (this.Army != null && this.Army.Empire != null && array != null && array.Length != 0)
        {
            this.ActionCostLabel.AgeTransform.Visible = true;
            if (ELCPUtilities.UseELCPSymbiosisBuffs && this.ArmyAction is ArmyAction_TameUnstunnedKaiju)
            {
                KaijuGarrison kaijuGarrison = this.Target as KaijuGarrison;
                if (kaijuGarrison != null)
                {
                    KaijuCouncil agency = kaijuGarrison.KaijuEmpire.GetAgency <KaijuCouncil>();
                    if (agency != null)
                    {
                        ConstructionCost constructionCost = new ConstructionCost(agency.ELCPResourceName, KaijuCouncil.GetKaijuTameCost().GetValue(this.Army.Empire), true, true);
                        array = new IConstructionCost[]
                        {
                            constructionCost
                        };
                    }
                }
            }
            this.ActionCostLabel.Text = GuiFormater.FormatCost(this.Army.Empire, array, false, 1, this.Army);
            this.ActionDescription.AgeTransform.PixelMarginBottom = this.ActionCostLabel.AgeTransform.PixelMarginBottom + this.ActionCostLabel.AgeTransform.Height;
            return;
        }
        this.ActionCostLabel.AgeTransform.Visible = false;
        this.ActionCostLabel.Text = string.Empty;
        this.ActionDescription.AgeTransform.PixelMarginBottom = this.ActionCostLabel.AgeTransform.PixelMarginBottom;
    }