Esempio n. 1
0
 /// <summary>
 /// Fills the information.
 /// </summary>
 /// <param name="info">The information.</param>
 public void FillInfo(Log.InfoList info)
 {
     info.Add("AssetType", this.AssetType);
     info.Add("Counts", this.TotalAssetCount, this.BuiltInAssetCount, this.CustomAssetCount, this.WorkshopAssetCount);
     this.Main.FillInfo("Main", info);
     this.Lod.FillInfo("Lod", info);
 }
        /// <summary>
        /// Logs the objects.
        /// </summary>
        public void LogObjects()
        {
            try
            {
                BuildingManager buildingManager = Singleton <BuildingManager> .instance;
                DistrictManager districtManager = Singleton <DistrictManager> .instance;

                Building[] buildings = buildingManager.m_buildings.m_buffer;

                for (ushort id = 0; id < buildings.Length; id++)
                {
                    if (buildings[id].Info != null)
                    {
                        Log.InfoList info = this.GetBuildingLogInfo(null, buildingManager, districtManager, id, ref buildings[id]);

                        if (info != null)
                        {
                            Log.DevDebug(this, "LogObjects", info);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(this, "LogObjects", ex);
            }
        }
        /// <summary>
        /// Gets the building log information.
        /// </summary>
        /// <param name="logInfo">The log information.</param>
        /// <param name="buildingManager">The building manager.</param>
        /// <param name="districtManager">The district manager.</param>
        /// <param name="buildingId">The building identifier.</param>
        /// <param name="building">The building.</param>
        /// <returns>The building log information.</returns>
        private Log.InfoList GetBuildingLogInfo(Log.InfoList logInfo, BuildingManager buildingManager, DistrictManager districtManager, ushort buildingId, ref Building building)
        {
            if (building.Info == null)
            {
                return(logInfo);
            }

            if (logInfo == null)
            {
                logInfo = new Log.InfoList();
            }

            string name;

            name = buildingManager.GetBuildingName(buildingId, building.Info.m_instanceID);
            logInfo.Add("Id", buildingId);
            if (!String.IsNullOrEmpty(name))
            {
                logInfo.Add("Name", name);
            }

            byte districtId = districtManager.GetDistrict(building.m_position);

            name = districtManager.GetDistrictName(districtId);
            if (!String.IsNullOrEmpty(name))
            {
                logInfo.Add("District", districtId, name);
            }

            logInfo.Add("Created", (building.m_flags & Building.Flags.Created) != Building.Flags.None ? "Yes" : "No");

            return(this.GetBuildingLogInfo(logInfo, building.Info));
        }
Esempio n. 4
0
        public override void FillInfo(Log.InfoList info)
        {
            info.Add("AssetType", this.AssetType);
            base.FillInfo(info);

            info.Add("Main", this.Main.CombinedWeight, "Triangles", this.Main.TrianglesCount, this.Main.TrianglesDimensions, this.Main.TrianglesSurface, this.Main.TrianglesWeight, "Texture", this.Main.TextureDimensions, this.Main.TextureArea, this.Main.TextureWeight);
            info.Add("Lod", this.Lod.CombinedWeight, "Triangles", this.Lod.TrianglesCount, this.Lod.TrianglesDimensions, this.Lod.TrianglesSurface, this.Lod.TrianglesWeight, "Texture", this.Lod.TextureDimensions, this.Lod.TextureArea, this.Lod.TextureWeight);
            info.Add("Fallback", this.FallbackLod.CombinedWeight, "Triangles", this.FallbackLod.TrianglesCount, this.FallbackLod.TrianglesDimensions, this.FallbackLod.TrianglesSurface, this.FallbackLod.TrianglesWeight, "Texture", this.FallbackLod.TextureDimensions, this.FallbackLod.TextureArea, this.FallbackLod.TextureWeight);

            info.Add("Ref", this.ReferenceCount, this.DependentCount);
        }
Esempio n. 5
0
        /// <summary>
        /// Fills the information.
        /// </summary>
        /// <param name="info">The information.</param>
        public virtual void FillInfo(Log.InfoList info)
        {
            if (this.SteamId > 0)
            {
                info.Add("SteamId", this.SteamId);
            }

            info.Add("PrefabName", this.PrefabName);
            info.Add("Title", this.Title);
            info.Add("Name", this.Name);
            info.Add("Category", this.Category);
            info.Add("SourceType", this.SourceType);
            info.Add("RawCategory", this.RawCategory);
        }
        /// <summary>
        /// Logs the assets.
        /// </summary>
        public void LogAssets()
        {
            try
            {
                foreach (BuildingInfo building in PrefabHelper.Collect <BuildingInfo>())
                {
                    Log.InfoList info = this.GetBuildingLogInfo(null, building);

                    if (info != null)
                    {
                        Log.DevDebug(this, "LogAssets", info);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(this, "LogAssets", ex);
            }
        }
        /// <summary>
        /// Gets the building log information.
        /// </summary>
        /// <param name="logInfo">The log information.</param>
        /// <param name="buildingInfo">The building information.</param>
        /// <returns>The building log information.</returns>
        private Log.InfoList GetBuildingLogInfo(Log.InfoList logInfo, BuildingInfo buildingInfo)
        {
            if (buildingInfo == null)
            {
                return(logInfo);
            }

            if (logInfo == null)
            {
                logInfo = new Log.InfoList();
            }

            logInfo.Add("AI", buildingInfo.m_buildingAI.GetType());
            logInfo.Add("InfoName", buildingInfo.name);

            logInfo.Add("LowWealthTourists", buildingInfo.m_buildingAI.GetLowWealthTourists());
            logInfo.Add("MediumWealthTourists", buildingInfo.m_buildingAI.GetMediumWealthTourists());
            logInfo.Add("HighWealthTourists", buildingInfo.m_buildingAI.GetHighWealthTourists());

            return(logInfo);
        }
Esempio n. 8
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <param name="prefix">The prefix.</param>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public string ToString(string prefix)
 {
     Log.InfoList info = new Log.InfoList();
     info.Add(prefix, this.Category, this.Count, this.RawCategory);
     return(info.ToString());
 }
Esempio n. 9
0
        /// <summary>
        /// Exports the textures.
        /// </summary>
        /// <param name="exportMode">The export mode.</param>
        public void ExportTextures(ExportMode?exportMode = null)
        {
            Log.Debug(this, "ExportTextures", exportMode);

            this.currentExportMode = (exportMode != null && exportMode.HasValue) ? exportMode.Value : this.defaultExportMode;

            try
            {
                this.exportLog.Clear();
                this.textures.Clear();
                this.netInfos.Clear();

                foreach (NetCollection netCollection in UnityEngine.Object.FindObjectsOfType <NetCollection>())
                {
                    if (netCollection != null)
                    {
                        Log.DevDebug(this, "ExportTextures", netCollection, netCollection.name, netCollection);

                        if (netCollection.m_prefabs != null)
                        {
                            Log.DevDebug(this, "ExportTextures", netCollection.m_prefabs, netCollection.m_prefabs.Length);

                            foreach (NetInfo netInfo in netCollection.m_prefabs)
                            {
                                if (netInfo != null && !this.netInfos.Contains(netInfo.GetInstanceID()))
                                {
                                    this.netInfos.Add(netInfo.GetInstanceID());
                                    Log.DevDebug(this, "ExportTextures", netInfo, netInfo.name, netInfo.m_class.name);

                                    if (netInfo.m_segments != null)
                                    {
                                        Log.DevDebug(this, "ExportTextures", netInfo.m_segments, netInfo.m_segments.Length);

                                        if (netInfo.m_segments.Length > 0 && netInfo.m_segments[0].m_material != null)
                                        {
                                            Log.DevDebug(this, "ExportTextures", netInfo.m_segments[0].m_material, netInfo.m_segments[0].m_material.name);

                                            this.currentInfoLogLine = new Log.InfoList();

                                            this.currentInfoLogLine.Add("netCollectionName", netCollection.name);
                                            this.currentInfoLogLine.Add("netInfoName", netInfo.name);
                                            this.currentInfoLogLine.Add("netInfoClassName", netInfo.m_class.name);
                                            this.currentInfoLogLine.Add("netInfoTag", netInfo.tag);
                                            this.currentInfoLogLine.Add("netInfoHashCode", netInfo.GetHashCode());
                                            this.currentInfoLogLine.Add("netInfoInstanceID", netInfo.GetInstanceID());

                                            this.currentInfoLogLine.Add("materialName", netInfo.m_segments[0].m_material.name);
                                            this.currentInfoLogLine.Add("materialHashCode", netInfo.m_segments[0].m_material.GetHashCode());
                                            this.currentInfoLogLine.Add("materialInstanceID", netInfo.m_segments[0].m_material.GetInstanceID());

                                            this.ExportTexture(netCollection, netInfo, netInfo.m_segments[0].m_material);

                                            this.exportLog.Add(this.currentInfoLogLine.ToLine());
                                            this.currentInfoLogLine = null;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (this.currentExportMode == ExportMode.Mapped)
                {
                    this.SaveTextureMap();
                }

                this.SaveExportLog();
            }
            catch (Exception ex)
            {
                Log.Error(this, "ExportTextures", ex);
            }
        }
Esempio n. 10
0
 /// <summary>
 /// Fills the information.
 /// </summary>
 /// <param name="prefix">The prefix.</param>
 /// <param name="info">The information.</param>
 public void FillInfo(string prefix, Log.InfoList info)
 {
     info.Add(prefix, this.TotalAssetCount, this.CombinedWeight,
              "Triangles", this.TrianglesAssetCount, this.TrianglesCount, this.TrianglesSurface, this.TrianglesWeight, this.trianglesCountValue, this.trianglesSurfaceValue,
              "Textures", this.TexturesAssetCount, this.TexturesDimensions, this.TexturesArea, this.TexturesWeight, this.texturesWidthValue, this.texturesHeightValue, this.texturesAreaValue);
 }
Esempio n. 11
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <param name="prefix">The prefix.</param>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public string ToString(string prefix)
 {
     Log.InfoList info = new Log.InfoList(prefix);
     this.FillInfo(info);
     return(info.ToString());
 }