コード例 #1
0
        private static DistrictEducationData GetEducationData(int educationLevel)
        {
            District d = dm.m_districts.m_buffer[0];

            DistrictEducationData ded = d.m_educated0Data;

            switch (educationLevel)
            {
            case 0:
                ded = d.m_educated0Data;
                break;

            case 1:
                ded = d.m_educated1Data;
                break;

            case 2:
                ded = d.m_educated2Data;
                break;

            case 3:
                ded = d.m_educated3Data;
                break;
            }

            return(ded);
        }
コード例 #2
0
        public static string GetEmploymentLabel(int educationLevel)
        {
            DistrictEducationData ded = GetEducationData(educationLevel);
            int percent = GetPercentEmployed(educationLevel);

            return(percent + "% (" + (ded.m_finalEligibleWorkers - ded.m_finalUnemployed) + "/" + ded.m_finalEligibleWorkers + ")");
        }
コード例 #3
0
        public static string GetWorkplacesLabel(int educationLevel)
        {
            DistrictEducationData districtEducationData = JobsUtils.GetEducationData(educationLevel);
            int wp      = GetWorkplacesByLevel(educationLevel);
            var percent = wp == 0 ? " - " :
                          ((int)(districtEducationData.m_finalEligibleWorkers / ((float)wp) * 100)).ToString();

            return(percent + "% (" + districtEducationData.m_finalEligibleWorkers + "/" + wp + ")");
        }
コード例 #4
0
        public static float GetPercent(int educationLevel)
        {
            DistrictEducationData districtEducationData = JobsUtils.GetEducationData(educationLevel);
            int   wp = GetWorkplacesByLevel(educationLevel);
            float percent;

            if (wp == 0)
            {
                percent = districtEducationData.m_finalEligibleWorkers == 0 ? 0 : 1;
            }
            else
            {
                percent = districtEducationData.m_finalEligibleWorkers / (float)wp;
            }
            return(percent);
        }
コード例 #5
0
        public static string GetWorkplacesLabel(int educationLevel)
        {
            DistrictEducationData ded = JobsUtils.GetEducationData(educationLevel);
            int    wp = getWorkplacesByLevel(educationLevel);
            string percent;

            if (wp == 0)
            {
                percent = " - ";
            }
            else
            {
                percent = ((int)((float)ded.m_finalEligibleWorkers / ((float)wp) * 100)).ToString();
            }

            return(percent + "% (" + ded.m_finalEligibleWorkers + "/" + wp + ")");
        }
コード例 #6
0
ファイル: DemandExtension.cs プロジェクト: vikkin/RushHour
        public override int OnCalculateResidentialDemand(int originalDemand)
        {
            int finalDemand = originalDemand;

            if (ExperimentsToggle.ImprovedResidentialDemand && !ExperimentsToggle.GhostMode)
            {
                DistrictManager       _districtManager           = Singleton <DistrictManager> .instance;
                DistrictPrivateData   _residentialData           = _districtManager.m_districts.m_buffer[0].m_residentialData;
                DistrictPrivateData   _industrialData            = _districtManager.m_districts.m_buffer[0].m_industrialData;
                DistrictPrivateData   _commercialData            = _districtManager.m_districts.m_buffer[0].m_commercialData;
                DistrictPrivateData   _playerData                = _districtManager.m_districts.m_buffer[0].m_playerData;
                DistrictEducationData _uneducatedData            = _districtManager.m_districts.m_buffer[0].m_educated0Data;
                DistrictEducationData _primarySchoolEducatedData = _districtManager.m_districts.m_buffer[0].m_educated1Data;
                DistrictEducationData _highSchoolEducatedData    = _districtManager.m_districts.m_buffer[0].m_educated2Data;
                DistrictEducationData _universityEducatedData    = _districtManager.m_districts.m_buffer[0].m_educated3Data;

                uint _totalHousePositions     = _residentialData.m_finalHomeOrWorkCount;
                uint _emptyHousePositions     = _residentialData.m_finalEmptyCount;
                uint _homelessPeople          = _uneducatedData.m_finalHomeless + _primarySchoolEducatedData.m_finalHomeless + _highSchoolEducatedData.m_finalHomeless + _universityEducatedData.m_finalHomeless;
                uint _emptyWorkplacePositions = _commercialData.m_finalEmptyCount + _industrialData.m_finalEmptyCount + _playerData.m_finalEmptyCount;
                uint _totalWorkplacePositions = _commercialData.m_finalHomeOrWorkCount + _industrialData.m_finalHomeOrWorkCount + _playerData.m_finalHomeOrWorkCount;

                if (_emptyHousePositions != 0 && _totalHousePositions != 0 && _emptyWorkplacePositions != 0 && _totalWorkplacePositions != 0)
                {
                    float _emptyJobPercentage   = ((float)_emptyWorkplacePositions / (float)_totalWorkplacePositions) * 100f;
                    float _emptyHomesPercentage = ((float)_emptyHousePositions / (float)_totalHousePositions) * 100f;

                    CimTools.CimToolsHandler.CimToolBase.DetailedLogger.Log("Empty job percentage: " + _emptyJobPercentage);
                    CimTools.CimToolsHandler.CimToolBase.DetailedLogger.Log("Empty homes percentage: " + _emptyHomesPercentage);
                    CimTools.CimToolsHandler.CimToolBase.DetailedLogger.Log("Empty houses: " + _emptyHousePositions);
                    CimTools.CimToolsHandler.CimToolBase.DetailedLogger.Log("Homeless: " + _homelessPeople);

                    finalDemand = (Mathf.RoundToInt(_emptyJobPercentage * 8f) + (int)_homelessPeople) /*- Mathf.RoundToInt(_emptyHomesPercentage)*/;

                    CimTools.CimToolsHandler.CimToolBase.DetailedLogger.Log("Final residential demand: " + finalDemand);
                }
            }
            else
            {
                CimTools.CimToolsHandler.CimToolBase.DetailedLogger.Log("Using legacy residential demand");
            }

            return(finalDemand);
        }
コード例 #7
0
        public static float GetPercentUnemployedF(int educationLevel)
        {
            DistrictEducationData ded = GetEducationData(educationLevel);

            return((float)ded.m_finalUnemployed / (float)ded.m_finalEligibleWorkers);
        }
コード例 #8
0
        public static int GetEmploymentCurrentValue(int educationLevel)
        {
            DistrictEducationData ded = GetEducationData(educationLevel);

            return((int)(ded.m_finalEligibleWorkers - ded.m_finalUnemployed));
        }
コード例 #9
0
        public static int GetEmploymentMaxValue(int educationLevel)
        {
            DistrictEducationData ded = GetEducationData(educationLevel);

            return((int)ded.m_finalEligibleWorkers);
        }