/// <summary>
        /// either update of the panel or let base processing update the panel
        /// </summary>
        /// <returns>whether or not to do base processing</returns>
        public static bool Prefix()
        {
            // assume do base processing
            bool doBaseProcessing = true;

            // check if should exclude mail
            if (!ExcludeMailLoading.IncludeMail())
            {
                // do processing with mail set to zero
                // logic copied from OutsideConnectionsInfoViewPanel.UpdatePanel and then mail was set to zero

                // do imports
                DistrictManager instance       = Singleton <DistrictManager> .instance;
                int             importOil      = (int)(instance.m_districts.m_buffer[0].m_importData.m_averageOil + 99) / 100;
                int             importOre      = (int)(instance.m_districts.m_buffer[0].m_importData.m_averageOre + 99) / 100;
                int             importForestry = (int)(instance.m_districts.m_buffer[0].m_importData.m_averageForestry + 99) / 100;
                int             importGoods    = (int)(instance.m_districts.m_buffer[0].m_importData.m_averageGoods + 99) / 100;
                int             importFarming  = (int)(instance.m_districts.m_buffer[0].m_importData.m_averageAgricultural + 99) / 100;
                int             importMail     = 0;
                int             importTotal    = importOil + importOre + importForestry + importGoods + importFarming + importMail;
                _importTotalLabel.text = StringUtils.SafeFormat(ColossalFramework.Globalization.Locale.Get(_importTotalLabel.localeID), importTotal);
                _importChart.SetValues(
                    GetValue(importOil, importTotal),
                    GetValue(importOre, importTotal),
                    GetValue(importForestry, importTotal),
                    GetValue(importGoods, importTotal),
                    GetValue(importFarming, importTotal),
                    GetValue(importMail, importTotal));

                // do exports
                int exportOil      = (int)(instance.m_districts.m_buffer[0].m_exportData.m_averageOil + 99) / 100;
                int exportOre      = (int)(instance.m_districts.m_buffer[0].m_exportData.m_averageOre + 99) / 100;
                int exportForestry = (int)(instance.m_districts.m_buffer[0].m_exportData.m_averageForestry + 99) / 100;
                int exportGoods    = (int)(instance.m_districts.m_buffer[0].m_exportData.m_averageGoods + 99) / 100;
                int exportFarming  = (int)(instance.m_districts.m_buffer[0].m_exportData.m_averageAgricultural + 99) / 100;
                int exportMail     = 0;
                int exportFish     = (int)(instance.m_districts.m_buffer[0].m_exportData.m_averageFish + 99) / 100;
                int exportTotal    = exportOil + exportOre + exportForestry + exportGoods + exportFarming + exportMail + exportFish;
                _exportTotalLabel.text = StringUtils.SafeFormat(ColossalFramework.Globalization.Locale.Get(_exportTotalLabel.localeID), exportTotal);
                _exportChart.SetValues(
                    GetValue(exportOil, exportTotal),
                    GetValue(exportOre, exportTotal),
                    GetValue(exportForestry, exportTotal),
                    GetValue(exportGoods, exportTotal),
                    GetValue(exportFarming, exportTotal),
                    GetValue(exportMail, exportTotal),
                    GetValue(exportFish, exportTotal));

                // everything was performed here, skip base processing
                doBaseProcessing = false;
            }

            // return whether or not to do the base processing
            return(doBaseProcessing);
        }
Example #2
0
        /// <summary>
        /// return the color of the building
        /// </summary>
        /// <returns>whether or not to do base processing</returns>
        public static bool Prefix(ushort buildingID, ref Building data, InfoManager.InfoMode infoMode, ref Color __result)
        {
            // assume do base processing
            bool doBaseProcessing = true;

            // do processing for this mod only for Outside Connections info view
            if (infoMode == InfoManager.InfoMode.Connections)
            {
                // if excluding mail, set building to neutral color
                if (!ExcludeMailLoading.IncludeMail())
                {
                    __result         = Singleton <InfoManager> .instance.m_properties.m_neutralColor;
                    doBaseProcessing = false;
                }
            }

            // return whether or not to do the base processing
            return(doBaseProcessing);
        }