Example #1
0
        public bool IsSupported(ushort buildingID)
        {
            Building building = Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingID];

            ItemClass.Service service = building.Info.GetService();

            // ignore prisons
            if (service.Equals(ItemClass.Service.PoliceDepartment) &&
                building.Info.m_class.m_level >= ItemClass.Level.Level4)
            {
                return(false);
            }

            if (service.Equals(ItemClass.Service.FireDepartment) ||
                service.Equals(ItemClass.Service.Garbage) ||
                service.Equals(ItemClass.Service.HealthCare) ||
                service.Equals(ItemClass.Service.PoliceDepartment) ||
                service.Equals(ItemClass.Service.Road) ||
                (service.Equals(ItemClass.Service.PublicTransport) && building.Info.GetSubService().Equals(ItemClass.SubService.PublicTransportTaxi)) ||    //allow Taxi
                (service.Equals(ItemClass.Service.Education) && Settings.RestrictCitizenEducationalAccess) ||    //allow for schools if citizen access restricted
                (service.Equals(ItemClass.Service.Beautification) && Settings.RestrictCitizenParkAccess)       //allow for parks if citizen access restricted
                )
            {
                DistrictManager districtManager = Singleton <DistrictManager> .instance;
                byte            districtID      = districtManager.GetDistrict(building.m_position);

                Utils.LogGeneral($"Checking buildingID {buildingID}, District {districtID}:'{districtManager.GetDistrictName(districtID)}' active... {DistrictChecker.IsActive(districtID)}");

                return(DistrictChecker.IsActive(districtID));
            }
            return(false);
        }
Example #2
0
        private void RefreshData(ushort selectedBuildingID)
        {
            fastList.Clear();
            fastList.rowsData.Add(new object[] { (byte)0, ALL_DISTRICTS });

            DistrictManager districtManager            = Singleton <DistrictManager> .instance;
            Building        building                   = Singleton <BuildingManager> .instance.m_buildings.m_buffer[selectedBuildingID];
            byte            selectedBuildingDistrictID = districtManager.GetDistrict(building.m_position);

            int index;

            for (index = 1; index < 128; ++index)
            {
                if (index != selectedBuildingDistrictID && DistrictChecker.IsActive((byte)index))
                {
                    string name = districtManager.GetDistrictName(index);
                    fastList.rowsData.Add(new object[] { (byte)index, name });
                }
            }

            fastList.DisplayAt(0);

            Utils.LogGeneral($"[DistrictSelectionPanel]: {fastList.rowsData.m_size} available Districts for building: ");
        }