private static bool Patch_WeatherDataSnapshot_SetAmbientLerped_Prefix(ref WeatherDataSnapshot __instance, WeatherPattern left, WeatherPattern right, float w, float addFogDensity = 0f) { var num = GameMath.Clamp(1f - (float)Math.Pow(1.1 - __instance.climateCond.Rainfall, 4.0), 0f, 1f); if (Settings.AllowFog) { __instance.Ambient.FlatFogDensity.Value = (right.State.nowMistDensity * w + left.State.nowMistDensity * (1f - w)) / 250f; __instance.Ambient.FlatFogDensity.Weight = 1f; __instance.Ambient.FlatFogDensity.Weight *= num; __instance.Ambient.FlatFogYPos.Value = right.State.nowMistYPos * w + left.State.nowMistYPos * (1f - w); __instance.Ambient.FlatFogYPos.Weight = 1f; __instance.Ambient.FogDensity.Value = (addFogDensity + right.State.nowFogDensity * w + left.State.nowFogDensity * (1f - w)) / 1000f; __instance.Ambient.FogDensity.Weight = num; __instance.Ambient.FogBrightness.Value = right.State.nowFogBrightness * w + left.State.nowFogBrightness * (1f - w); __instance.Ambient.FogBrightness.Weight = 1f; } else { __instance.Ambient.FlatFogDensity.Value = 0f; __instance.Ambient.FlatFogDensity.Weight = 0f; __instance.Ambient.FlatFogYPos.Value = 0f; __instance.Ambient.FlatFogYPos.Weight = 0f; __instance.Ambient.FogDensity.Value = 0f; __instance.Ambient.FogDensity.Weight = 0f; __instance.Ambient.FogBrightness.Value = 0f; __instance.Ambient.FogBrightness.Weight = 0f; } if (Settings.AllowClouds) { } else { __instance.Ambient.CloudBrightness.Value = 0f; __instance.Ambient.CloudBrightness.Weight = 0f; __instance.Ambient.CloudDensity.Value = 0f; __instance.Ambient.CloudDensity.Weight = 0f; } __instance.Ambient.CloudBrightness.Value = right.State.nowCloudBrightness * w + left.State.nowCloudBrightness * (1f - w); __instance.Ambient.CloudBrightness.Weight = 1f; __instance.Ambient.CloudDensity.Value = right.State.nowbaseThickness * w + left.State.nowbaseThickness * (1f - w); __instance.Ambient.CloudDensity.Weight = 1f; __instance.Ambient.SceneBrightness.Value = left.State.nowSceneBrightness; __instance.Ambient.SceneBrightness.Weight = 1f; return(false); }
/// <summary> /// 天候パターンを構文解析する /// </summary> /// <param name="lexer">字句解析器</param> /// <returns>天候パターン</returns> private static WeatherPattern ParseWeatherPattern(TextLexer lexer) { // = Token token = lexer.GetToken(); if (token.Type != TokenType.Equal) { Log.InvalidToken(LogCategory, token, lexer); return null; } // { token = lexer.GetToken(); if (token.Type != TokenType.OpenBrace) { Log.InvalidToken(LogCategory, token, lexer); return null; } WeatherPattern pattern = new WeatherPattern(); while (true) { token = lexer.GetToken(); // ファイルの終端 if (token == null) { break; } // } (セクション終端) if (token.Type == TokenType.CloseBrace) { break; } // 無効なトークン if (token.Type != TokenType.Identifier) { Log.InvalidToken(LogCategory, token, lexer); lexer.SkipLine(); continue; } string keyword = token.Value as string; if (string.IsNullOrEmpty(keyword)) { continue; } keyword = keyword.ToLower(); // id if (keyword.Equals("id")) { TypeId id = ParseTypeId(lexer); if (id == null) { Log.InvalidSection(LogCategory, "id", lexer); continue; } // typeとidの組 pattern.Id = id; continue; } // provinces if (keyword.Equals("provinces")) { IEnumerable<int> list = ParseIdList(lexer); if (list == null) { Log.InvalidSection(LogCategory, "provinces", lexer); continue; } // プロヴィンスリスト pattern.Provinces.AddRange(list); continue; } // centre if (keyword.Equals("centre")) { int? n = ParseInt(lexer); if (!n.HasValue) { Log.InvalidClause(LogCategory, "centre", lexer); continue; } // 中央プロヴィンス pattern.Centre = (int) n; continue; } // speed if (keyword.Equals("speed")) { int? n = ParseInt(lexer); if (!n.HasValue) { Log.InvalidClause(LogCategory, "speed", lexer); continue; } // 速度 pattern.Speed = (int) n; continue; } // heading if (keyword.Equals("heading")) { string s = ParseString(lexer); if (s == null) { Log.InvalidClause(LogCategory, "heading", lexer); continue; } // 方向 pattern.Heading = s; continue; } // 無効なトークン Log.InvalidToken(LogCategory, token, lexer); lexer.SkipLine(); } return pattern; }