Exemple #1
0
        public static string GetFormattedString(this VariableCitySubType var, TextParameterVariableWrapper varWrapper)
        {
            switch (var)
            {
            case VariableCitySubType.CityName:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetDistrict(0).Name));

            case VariableCitySubType.CityPopulation:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetDistrict(0).Population));

            default:
                return(null);
            }
        }
Exemple #2
0
        public static string GetFormattedString(this VariableSegmentTargetSubType var, OnNetInstanceCacheContainerXml propDescriptor, ushort targId, TextParameterVariableWrapper varWrapper)
        {
            var multiplier = 1f;

            switch (var)
            {
            case VariableSegmentTargetSubType.StreetSuffix: return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetSegment(targId).StreetName));

            case VariableSegmentTargetSubType.StreetNameComplete: return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetSegment(targId).FullStreetName));

            case VariableSegmentTargetSubType.StreetPrefix: return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetSegment(targId).StreetQualifier));

            case VariableSegmentTargetSubType.ParkOrDistrict:
            case VariableSegmentTargetSubType.DistrictOrPark:
                var segmentData = WTSCacheSingleton.instance.GetSegment(targId);
                if (segmentData.DistrictId == 0 && segmentData.ParkId > 0 && var == VariableSegmentTargetSubType.ParkOrDistrict)
                {
                    goto case VariableSegmentTargetSubType.Park;
                }
                else
                {
                    goto case VariableSegmentTargetSubType.District;
                }

            case VariableSegmentTargetSubType.District:
                var segmentData2 = WTSCacheSingleton.instance.GetSegment(targId);
                return(varWrapper.TryFormat(segmentData2.OutsideConnectionId != 0
                        ? WTSCacheSingleton.instance.GetBuilding(segmentData2.OutsideConnectionId).Name
                        : WTSCacheSingleton.instance.GetDistrict(segmentData2.DistrictId).Name));

            case VariableSegmentTargetSubType.Park: return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetPark(WTSCacheSingleton.instance.GetSegment(targId).ParkId).Name));

            case VariableSegmentTargetSubType.PostalCode: return(WTSCacheSingleton.instance.GetSegment(targId).PostalCode);

            case VariableSegmentTargetSubType.MileageKilometers:
                multiplier = 0.001f;
                goto case VariableSegmentTargetSubType.MileageMeters;

            case VariableSegmentTargetSubType.MileageMiles:
                multiplier = 1 / 1609f;
                goto case VariableSegmentTargetSubType.MileageMeters;

            case VariableSegmentTargetSubType.MileageMeters:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetSegment(targId).GetMetersAt(propDescriptor.SegmentPosition), multiplier));

            case VariableSegmentTargetSubType.DistanceFromReferenceKilometers:
                multiplier = 0.001f;
                goto case VariableSegmentTargetSubType.DistanceFromReferenceMeters;

            case VariableSegmentTargetSubType.DistanceFromReferenceMiles:
                multiplier = 1 / 1609f;
                goto case VariableSegmentTargetSubType.DistanceFromReferenceMeters;

            case VariableSegmentTargetSubType.DistanceFromReferenceMeters:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetSegment(targId).DistanceFromCenter, multiplier));

            case VariableSegmentTargetSubType.DistrictAreaKm2:
                multiplier = 0.000001f;
                goto case VariableSegmentTargetSubType.DistrictAreaM2;

            case VariableSegmentTargetSubType.DistrictAreaMi2:
                multiplier = 1f / 1609f / 1609f;
                goto case VariableSegmentTargetSubType.DistrictAreaM2;

            case VariableSegmentTargetSubType.DistrictAreaM2:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetDistrict(WTSCacheSingleton.instance.GetSegment(targId).DistrictId).AreaSqMeters, multiplier));

            case VariableSegmentTargetSubType.ParkAreaKm2:
                multiplier = 0.000001f;
                goto case VariableSegmentTargetSubType.ParkAreaM2;

            case VariableSegmentTargetSubType.ParkAreaMi2:
                multiplier = 1f / 1609f / 1609f;
                goto case VariableSegmentTargetSubType.ParkAreaM2;

            case VariableSegmentTargetSubType.ParkAreaM2:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetPark(WTSCacheSingleton.instance.GetSegment(targId).ParkId).AreaSqMeters, multiplier));

            case VariableSegmentTargetSubType.DistrictPopulation:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetDistrict(WTSCacheSingleton.instance.GetSegment(targId).DistrictId).Population));


            case VariableSegmentTargetSubType.Direction: return(WTSCacheSingleton.instance.GetSegment(targId).Direction);

            case VariableSegmentTargetSubType.HwCodeShort: return(WTSCacheSingleton.instance.GetSegment(targId).HwCodeShort);

            case VariableSegmentTargetSubType.HwCodeLong: return(WTSCacheSingleton.instance.GetSegment(targId).HwCodeLong);

            case VariableSegmentTargetSubType.HwDettachedPrefix: return(WTSCacheSingleton.instance.GetSegment(targId).HwDettachedPrefix);

            case VariableSegmentTargetSubType.HwIdentifierSuffix: return(WTSCacheSingleton.instance.GetSegment(targId).HwIdentifierSuffix);

            default:
                return(null);
            }
        }
Exemple #3
0
 public static string GetFormattedString(this VariableVehicleSubType var, IEnumerable <int> platforms, TextParameterVariableWrapper varWrapper, ushort vehicleId)
 {
     if (vehicleId == 0)
     {
         return(null);
     }
     switch (var)
     {
     case VariableVehicleSubType.NextStopLine:
         ref Vehicle[] buffer7        = ref VehicleManager.instance.m_vehicles.m_buffer;
         ref Vehicle   targetVehicle7 = ref buffer7[buffer7[vehicleId].GetFirstVehicle(vehicleId)];
         var           regLine2       = WriteTheSignsMod.Controller.ConnectorTLM.GetVehicleLine(vehicleId);
         return(WriteTheSignsMod.Controller.ConnectorTLM.GetStopName(targetVehicle7.m_targetBuilding, regLine2));
        public static string GetFormattedString(this VariableBuildingSubType var, IEnumerable <int> platforms, ushort buildingId, TextParameterVariableWrapper varWrapper)
        {
            if (buildingId == 0)
            {
                return(null);
            }
            switch (var)
            {
            case VariableBuildingSubType.OwnName:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetBuilding(buildingId).Name));

            case VariableBuildingSubType.NextStopLine:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetBuilding(WTSStopUtils.GetTargetStopInfo(platforms, buildingId).FirstOrDefault().NextStopBuildingId).Name));

            case VariableBuildingSubType.PrevStopLine:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetBuilding(WTSStopUtils.GetTargetStopInfo(platforms, buildingId).FirstOrDefault().PrevStopBuildingId).Name));

            case VariableBuildingSubType.LastStopLine:
                return(varWrapper.TryFormat(WTSCacheSingleton.instance.GetBuilding(WTSStopUtils.GetTargetStopInfo(platforms, buildingId).FirstOrDefault().DestinationBuildingId).Name));

            case VariableBuildingSubType.PlatformNumber:
                return(varWrapper.TryFormat(platforms.FirstOrDefault() + 1));

            default:
                return(null);
            }
        }