public override void Open() { // make new MapDriver _vehicle = new MapDriver(Annotations); _vehicles.Add(_vehicle); Demo.SelectedVehicle = _vehicle; // marks as obstacles map cells adjacent to the path _usePathFences = true; // scatter random rock clumps over map _useRandomRocks = true; // init Demo camera _initCamDist = 30; _initCamElev = 15; Demo.Init2dCamera(_vehicle, _initCamDist, _initCamElev); // "look straight down at vehicle" camera mode parameters Demo.Camera.LookDownDistance = 50; // "static" camera mode parameters Demo.Camera.FixedPosition = new Vector3(145); Demo.Camera.FixedTarget.X = 40; Demo.Camera.FixedTarget.Y = 0; Demo.Camera.FixedTarget.Z = 40; Demo.Camera.FixedUp = Vector3.UnitY; // reset this plugin Reset(); }
public object Retrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type propertyType) { if (string.IsNullOrWhiteSpace(keyValuePair.Value)) { throw new NotSupportedException($"Table row column '{keyValuePair.Key}' does not support empty entry."); } if (MapDriver.IsNotSet(keyValuePair.Value)) { return(0M); } var isPercentageRepresentation = keyValuePair.Value.Contains("%"); var stringValue = keyValuePair.Value; if (isPercentageRepresentation) { stringValue = stringValue.Replace("%", "").Trim(); } var value = decimal.Parse(stringValue); if (isPercentageRepresentation) { value *= 0.01M; } return(value); }
private static IEnumerable <T> GetValue(string value) { var values = value.Split(';'); var enumerable = values.Where(v => MapDriver.IsSet(v.Trim())).Select(ChangeType).ToList(); return(enumerable.Any() ? enumerable : null); }
public decimal?NullableDecimalTransformation(string value) { if (MapDriver.IsNotSet(value)) { return(null); } return(decimal.Parse(value)); }
public DateTimeOffset TransformDateTimeOffset(string value) { if (MapDriver.IsNotSet(value)) { throw new NotSupportedException("'Empty' entry to 'DateTimeOffset' transformation is not supported."); } return(DateConverter.GetDateOffset(value).Value); }
public bool GetValue(KeyValuePair <string, string> keyValuePair) { if (string.IsNullOrWhiteSpace(keyValuePair.Value)) { throw new NotSupportedException($"Table row column '{keyValuePair.Key}' does not support empty entry."); } return(MapDriver.MapToBool(keyValuePair.Value)); }
public string[] TransformStringToMultiple(string value) { if (string.IsNullOrWhiteSpace(value)) { throw new NotSupportedException("'Empty' entry to 'string[]' transformation is not supported."); } return(MapDriver.MapSingleRowCellEntryToMultiple(value).ToArray()); }
public bool BoolTransform(string result) { if (string.IsNullOrWhiteSpace(result)) { throw new NotSupportedException("'Empty' entry to 'bool' transformation is not supported."); } return(MapDriver.MapToBool(result)); }
public short[] TransformToShortArray(string value) { if (string.IsNullOrWhiteSpace(value)) { throw new NotSupportedException($"'Empty' entry to '{nameof(Int16)}[]' transformation is not supported."); } return(value.Split(',') .Select(s => s.TrimToNull()) .Select(s => MapDriver.IsSet(s) ? short.Parse(s) : default)
public static string ReplaceMagicStrings(this string value) { if (MapDriver.IsNotSet(value)) { return(null); } var result = ReplaceMagicStringOfLength(value); result = DateConverter.ReplaceDate(result); return(result); }
public object GetValue(KeyValuePair <string, string> keyValuePair, Type enumType) { if (EnumConverter.IsNotNullableEnum(enumType) && string.IsNullOrWhiteSpace(keyValuePair.Value)) { throw new NotSupportedException($"Table row column '{keyValuePair.Key}' does not support empty entries."); } try { return(MapDriver.MapToEnum(keyValuePair.Value, enumType)); } catch (Exception exception) { throw new InvalidOperationException($"No enum with value '{keyValuePair.Value}' found for Table row column '{keyValuePair.Key}'.", exception); } }
private static DateTimeOffset GetValue(KeyValuePair <string, string> keyValuePair) { return(MapDriver.IsNotSet(keyValuePair.Value) ? default : DateConverter.GetDateOffset(keyValuePair.Value).Value); }
public object Retrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type propertyType) { return(MapDriver.IsNotSet(keyValuePair.Value) ? (int?)null : int.Parse(keyValuePair.Value.Replace(".", "").Replace(" ", ""))); }
public object Retrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type propertyType) { return(MapDriver.IsNotSet(keyValuePair.Value) ? null : _retriever.Retrieve(keyValuePair, targetType, propertyType)); }