Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssetSizes"/> class.
        /// </summary>
        /// <param name="assetType">The type.</param>
        public AssetSizes(AssetInfo.AssetTypes assetType)
        {
            this.AssetType = assetType;

            this.TotalAssetCount    = 0;
            this.CustomAssetCount   = 0;
            this.BuiltInAssetCount  = 0;
            this.WorkshopAssetCount = 0;

            this.Main = new Values();
            this.Lod  = new Values();
        }
        /// <summary>
        /// Aggregates the assets.
        /// </summary>
        private void AggregateAssets()
        {
            if (this.BuiltInAssetSizes != null)
            {
                return;
            }

            Log.Debug(this, "AggregateAssets", "Begin");

            AssetSizes allCounts = new AssetSizes(AssetInfo.AssetTypes.All);

            this.BuiltInAssetSizes = new Dictionary <AssetInfo.AssetTypes, AssetSizes>();

            AssetInfo.AssetTypes curType   = AssetInfo.AssetTypes.Unknown;
            AssetSizes           curCounts = null;

            foreach (AssetInfo asset in this.Assets)
            {
                if (asset.AssetType != curType)
                {
                    curType = asset.AssetType;
                    if (!this.BuiltInAssetSizes.TryGetValue(curType, out curCounts))
                    {
                        curCounts = new AssetSizes(curType);
                        this.BuiltInAssetSizes[curType] = curCounts;
                    }
                }

                curCounts.Add(asset);
                allCounts.Add(asset);
            }

            this.BuiltInAssetSizes[AssetInfo.AssetTypes.All] = allCounts;

            Log.Debug(this, "AggregateAssets", "End");
        }