public override int GetHashCode() { int hash = 1; if (CloudLevel != 0) { hash ^= CloudLevel.GetHashCode(); } if (RainLevel != 0) { hash ^= RainLevel.GetHashCode(); } if (WindLevel != 0) { hash ^= WindLevel.GetHashCode(); } if (SnowLevel != 0) { hash ^= SnowLevel.GetHashCode(); } if (FogLevel != 0) { hash ^= FogLevel.GetHashCode(); } if (WindDirection != 0) { hash ^= WindDirection.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(WindLevel state) { Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave(); switch (state) { case WindLevel.Level1: newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "WindSprite.Texture Left", Type = "int", Value = WindSprite.TextureLeft + 423 } ); break; case WindLevel.Level2: newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "WindSprite.Texture Left", Type = "int", Value = WindSprite.TextureLeft + 488 } ); break; case WindLevel.Level3: newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "WindSprite.Texture Left", Type = "int", Value = WindSprite.TextureLeft + 553 } ); break; case WindLevel.Level4: newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "WindSprite.Texture Left", Type = "int", Value = WindSprite.TextureLeft + 618 } ); break; } return(newState); }
public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateToRelative(WindLevel toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing, object owner = null) { Gum.DataTypes.Variables.StateSave current = GetCurrentValuesOnState(toState); Gum.DataTypes.Variables.StateSave toAsStateSave = AddToCurrentValuesWithState(toState); FlatRedBall.Glue.StateInterpolation.Tweener tweener = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing); if (owner == null) { tweener.Owner = this; } else { tweener.Owner = owner; } tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition); tweener.Ended += () => this.CurrentWindLevelState = toState; tweener.Start(); StateInterpolationPlugin.TweenerManager.Self.Add(tweener); return(tweener); }
public void ReadXml(XmlReader reader) { for (int attInd = 0; attInd < reader.AttributeCount; attInd++) { reader.MoveToAttribute(attInd); string temp; switch (reader.Name) { case "Level": temp = reader.Value; WindLevel level = WindLevel.Calm; if (Enum.TryParse(temp, out level)) { Level = level; } break; case "Direction": temp = reader.Value; WindDirection direction = WindDirection.NE; if (Enum.TryParse(temp, out direction)) { Direction = direction; } break; case "Speed": temp = reader.Value; double speed = 0; if (double.TryParse(temp, out speed)) { Speed = speed; } break; } //Console.WriteLine("\t\t\t<" + reader.Name + "=\"" + reader.Value + "\"/>"); } }
public List <WindLevel> FindAll() { List <WindLevel> windLevels = new List <WindLevel>(); using (connection = new SQLiteConnection("Data Source =" + databaseFile)) { connection.Open(); using (command = connection.CreateCommand()){ command.CommandText = "SELECT * FROM M_WIND_LV;"; using (dataReader = command.ExecuteReader()){ while (dataReader.Read()) { WindLevel windLevel = new WindLevel(); windLevel.windLevelId = dataReader["WIND_LV_ID"].ToString(); windLevel.windLevelName = dataReader["WIND_LV_NAME"].ToString(); windLevels.Add(windLevel); } } } } return(windLevels); }
public override void ApplyState(Gum.DataTypes.Variables.StateSave state) { bool matches = this.ElementSave.AllStates.Contains(state); if (matches) { var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state)); if (category == null) { if (state.Name == "Default") { this.mCurrentVariableState = VariableState.Default; } } else if (category.Name == "WindLevel") { if (state.Name == "Level1") { this.mCurrentWindLevelState = WindLevel.Level1; } if (state.Name == "Level2") { this.mCurrentWindLevelState = WindLevel.Level2; } if (state.Name == "Level3") { this.mCurrentWindLevelState = WindLevel.Level3; } if (state.Name == "Level4") { this.mCurrentWindLevelState = WindLevel.Level4; } } } base.ApplyState(state); }
private IReadOnlyDictionary <string, string> GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string weatherImageUrl) { var weather = Translator.Instance.GetWeather(GameplayCondition); var weatherKey = $"weather_{Convert.ToInt32(GameplayCondition)}"; var weatherEmoji = MasterFile.Instance.Emojis.ContainsKey(weatherKey) && GameplayCondition != WeatherCondition.None ? GameplayCondition.GetWeatherEmojiIcon() : string.Empty; var hasWeather = GameplayCondition != WeatherCondition.None; var gmapsLink = string.Format(Strings.GoogleMaps, Latitude, Longitude); var appleMapsLink = string.Format(Strings.AppleMaps, Latitude, Longitude); var wazeMapsLink = string.Format(Strings.WazeMaps, Latitude, Longitude); var scannerMapsLink = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude); var staticMapLink = StaticMap.GetUrl(whConfig.Urls.StaticMap, whConfig.StaticMaps["weather"], Latitude, Longitude, weatherImageUrl, PokemonTeam.All, null, Polygon); var gmapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink); var appleMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink); var wazeMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink); var scannerMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink); var address = new Location(null, city, Latitude, Longitude).GetAddress(whConfig); //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink); const string defaultMissingValue = "?"; var dict = new Dictionary <string, string> { //Main properties { "id", Id.ToString() }, { "weather_condition", weather }, { "has_weather", Convert.ToString(hasWeather) }, { "weather", weather ?? defaultMissingValue }, { "weather_emoji", weatherEmoji ?? defaultMissingValue }, { "weather_img_url", weatherImageUrl }, { "wind_direction", WindDirection.ToString() }, { "wind_level", WindLevel.ToString() }, { "raid_level", RainLevel.ToString() }, { "cloud_level", CloudLevel.ToString() }, { "fog_level", FogLevel.ToString() }, { "snow_level", SnowLevel.ToString() }, { "warn_weather", Convert.ToString(WarnWeather ?? false) }, { "special_effect_level", SpecialEffectLevel.ToString() }, { "severity", Severity.ToString() }, //Location properties { "geofence", city ?? defaultMissingValue }, { "lat", Latitude.ToString() }, { "lng", Longitude.ToString() }, { "lat_5", Latitude.ToString("0.00000") }, { "lng_5", Longitude.ToString("0.00000") }, //Location links { "tilemaps_url", staticMapLink }, { "gmaps_url", gmapsLocationLink }, { "applemaps_url", appleMapsLocationLink }, { "wazemaps_url", wazeMapsLocationLink }, { "scanmaps_url", scannerMapsLocationLink }, { "address", address?.Address }, // Discord Guild properties { "guild_name", guild?.Name }, { "guild_img_url", guild?.IconUrl }, { "date_time", DateTime.Now.ToString() }, //Misc properties { "br", "\r\n" } }; return(dict); }
public void InterpolateBetween(WindLevel firstState, WindLevel secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif bool setWindSpriteTextureLeftFirstValue = false; bool setWindSpriteTextureLeftSecondValue = false; int WindSpriteTextureLeftFirstValue = 0; int WindSpriteTextureLeftSecondValue = 0; switch (firstState) { case WindLevel.Level1: setWindSpriteTextureLeftFirstValue = true; WindSpriteTextureLeftFirstValue = 423; break; case WindLevel.Level2: setWindSpriteTextureLeftFirstValue = true; WindSpriteTextureLeftFirstValue = 488; break; case WindLevel.Level3: setWindSpriteTextureLeftFirstValue = true; WindSpriteTextureLeftFirstValue = 553; break; case WindLevel.Level4: setWindSpriteTextureLeftFirstValue = true; WindSpriteTextureLeftFirstValue = 618; break; } switch (secondState) { case WindLevel.Level1: setWindSpriteTextureLeftSecondValue = true; WindSpriteTextureLeftSecondValue = 423; break; case WindLevel.Level2: setWindSpriteTextureLeftSecondValue = true; WindSpriteTextureLeftSecondValue = 488; break; case WindLevel.Level3: setWindSpriteTextureLeftSecondValue = true; WindSpriteTextureLeftSecondValue = 553; break; case WindLevel.Level4: setWindSpriteTextureLeftSecondValue = true; WindSpriteTextureLeftSecondValue = 618; break; } if (setWindSpriteTextureLeftFirstValue && setWindSpriteTextureLeftSecondValue) { WindSprite.TextureLeft = FlatRedBall.Math.MathFunctions.RoundToInt(WindSpriteTextureLeftFirstValue * (1 - interpolationValue) + WindSpriteTextureLeftSecondValue * interpolationValue); } if (interpolationValue < 1) { mCurrentWindLevelState = firstState; } else { mCurrentWindLevelState = secondState; } }
private IReadOnlyDictionary <string, string> GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string weatherImageUrl) { var weather = Translator.Instance.GetWeather(GameplayCondition); var weatherKey = $"weather_{Convert.ToInt32(GameplayCondition)}"; var weatherEmoji = MasterFile.Instance.Emojis.ContainsKey(weatherKey) && GameplayCondition != WeatherType.None ? GameplayCondition.GetWeatherEmojiIcon() : string.Empty; var hasWeather = GameplayCondition != WeatherType.None; var gmapsLink = string.Format(Strings.GoogleMaps, Latitude, Longitude); var appleMapsLink = string.Format(Strings.AppleMaps, Latitude, Longitude); var wazeMapsLink = string.Format(Strings.WazeMaps, Latitude, Longitude); var scannerMapsLink = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude); var templatePath = Path.Combine(whConfig.StaticMaps.TemplatesFolder, whConfig.StaticMaps.Weather.TemplateFile); var staticMapLink = Utils.GetStaticMapsUrl(templatePath, whConfig.Urls.StaticMap, whConfig.StaticMaps.Weather.ZoomLevel, Latitude, Longitude, weatherImageUrl, null); var gmapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? gmapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink); var appleMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? appleMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink); var wazeMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? wazeMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink); var scannerMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? scannerMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink); Geofence.Location address = null; if (!string.IsNullOrEmpty(whConfig.GoogleMapsKey)) { address = Utils.GetGoogleAddress(city, Latitude, Longitude, whConfig.GoogleMapsKey); } else if (!string.IsNullOrEmpty(whConfig.NominatimEndpoint)) { address = Utils.GetNominatimAddress(city, Latitude, Longitude, whConfig.NominatimEndpoint); } //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink); const string defaultMissingValue = "?"; var dict = new Dictionary <string, string> { //Main properties { "id", Id.ToString() }, { "weather_condition", weather }, { "has_weather", Convert.ToString(hasWeather) }, { "weather", weather ?? defaultMissingValue }, { "weather_emoji", weatherEmoji ?? defaultMissingValue }, { "weather_img_url", weatherImageUrl }, { "wind_direction", WindDirection.ToString() }, { "wind_level", WindLevel.ToString() }, { "raid_level", RainLevel.ToString() }, { "cloud_level", CloudLevel.ToString() }, { "fog_level", FogLevel.ToString() }, { "snow_level", SnowLevel.ToString() }, { "warn_weather", Convert.ToString(WarnWeather ?? false) }, { "special_effect_level", SpecialEffectLevel.ToString() }, { "severity", Severity.ToString() }, //Location properties { "geofence", city ?? defaultMissingValue }, { "lat", Latitude.ToString() }, { "lng", Longitude.ToString() }, { "lat_5", Math.Round(Latitude, 5).ToString() }, { "lng_5", Math.Round(Longitude, 5).ToString() }, //Location links { "tilemaps_url", staticMapLink }, { "gmaps_url", gmapsLocationLink }, { "applemaps_url", appleMapsLocationLink }, { "wazemaps_url", wazeMapsLocationLink }, { "scanmaps_url", scannerMapsLocationLink }, { "address", address?.Address }, // Discord Guild properties { "guild_name", guild?.Name }, { "guild_img_url", guild?.IconUrl }, { "date_time", DateTime.Now.ToString() }, //Misc properties { "br", "\r\n" } }; return(dict); }