コード例 #1
0
    private void UpdateResourceStatus(PointOfInterest pointOfInterest, global::Empire empire, Region region, AIRegionData regionData, DepartmentOfTheTreasury departmentOfTheTreasury)
    {
        regionData.ResourcePointOfInterestCount++;
        if (pointOfInterest.PointOfInterestImprovement != null)
        {
            regionData.BuiltExtractor++;
        }
        if (!DepartmentOfTheInterior.IsPointOfInterestVisible(empire, pointOfInterest))
        {
            return;
        }
        string empty     = string.Empty;
        bool   condition = pointOfInterest.PointOfInterestDefinition.TryGetValue("ResourceName", out empty);

        Diagnostics.Assert(condition);
        ResourceDefinition.Type resourceType = departmentOfTheTreasury.GetResourceType(empty);
        float num        = 0f;
        bool  condition2 = departmentOfTheTreasury.TryGetNetResourceValue(empire, empty, out num, true);

        Diagnostics.Assert(condition2);
        if (num > 0f)
        {
            if (resourceType == ResourceDefinition.Type.Luxury)
            {
                regionData.ProducedLuxuryRessourcesCount++;
            }
            else if (resourceType == ResourceDefinition.Type.Strategic)
            {
                regionData.ProducedStrategicRessourcesCount++;
            }
            return;
        }
        float num2       = 0f;
        bool  condition3 = departmentOfTheTreasury.TryGetResourceStockValue(empire, empty, out num2, true);

        Diagnostics.Assert(condition3);
        if (num2 > 0f)
        {
            if (resourceType == ResourceDefinition.Type.Luxury)
            {
                regionData.OwnedLuxuryRessourcesCount++;
            }
            else if (resourceType == ResourceDefinition.Type.Strategic)
            {
                regionData.OwnedStrategicRessourcesCount++;
            }
            return;
        }
        if (resourceType == ResourceDefinition.Type.Luxury)
        {
            regionData.NewLuxuryRessourcesCount++;
        }
        else if (resourceType == ResourceDefinition.Type.Strategic)
        {
            regionData.NewStrategicRessourcesCount++;
        }
    }