コード例 #1
0
    private void RefreshEmpirePoints()
    {
        float stockValue;

        if (!this.departmentOfTheTreasury.TryGetResourceStockValue(base.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out stockValue, false))
        {
            Diagnostics.LogError("Can't get resource stock value {0} on simulation object {1}.", new object[]
            {
                DepartmentOfTheTreasury.Resources.EmpirePoint,
                base.Empire.SimulationObject
            });
        }
        float netValue;

        this.departmentOfTheTreasury.TryGetNetResourceValue(base.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out netValue, false);
        this.EmpirePointsValue.Text = GuiFormater.FormatStockAndNet(stockValue, netValue, SimulationProperties.EmpirePoint, true);
        if (this.EmpirePointsValue.TextLines.Count > 1)
        {
            this.EmpirePointsValue.AgeTransform.Visible      = false;
            this.EmpirePointsValueSmall.AgeTransform.Visible = true;
            this.EmpirePointsValueSmall.Text = GuiFormater.FormatStockAndNet(stockValue, netValue, SimulationProperties.EmpirePoint, true);
        }
        else
        {
            this.EmpirePointsValue.AgeTransform.Visible      = true;
            this.EmpirePointsValueSmall.AgeTransform.Visible = false;
        }
    }
コード例 #2
0
    private string FormatEmpirePoints(global::Empire empire, bool withNet = false)
    {
        DepartmentOfTheTreasury agency = empire.GetAgency <DepartmentOfTheTreasury>();
        float stockValue;

        if (!agency.TryGetResourceStockValue(empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out stockValue, false))
        {
            Diagnostics.LogError("Can't get resource stock value {0} on simulation object {1}.", new object[]
            {
                DepartmentOfTheTreasury.Resources.EmpirePoint,
                empire.SimulationObject
            });
        }
        if (!withNet)
        {
            return(GuiFormater.FormatStock(stockValue, SimulationProperties.EmpirePoint, 1, false));
        }
        float netValue;

        if (!agency.TryGetNetResourceValue(empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out netValue, false))
        {
            Diagnostics.LogError("Can't get resource net value {0} on simulation object {1}.", new object[]
            {
                DepartmentOfTheTreasury.Resources.EmpirePoint,
                empire.SimulationObject
            });
        }
        return(GuiFormater.FormatStockAndNet(stockValue, netValue, SimulationProperties.EmpirePoint, false));
    }