add label to see current weather
This commit is contained in:
@@ -105,6 +105,7 @@ func _ready() -> void:
|
||||
UIEvents.toggle_dust.connect(toggle_dust)
|
||||
UIEvents.toggle_blur.connect(toggle_blur)
|
||||
UIEvents.toggle_shadows.connect(toggle_shadows)
|
||||
_emit_weather_event_label()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
@@ -309,6 +310,7 @@ func toggle_wind(value: bool):
|
||||
particles_wind.emitting = is_windy
|
||||
|
||||
_apply_wind_state()
|
||||
_emit_weather_event_label()
|
||||
|
||||
#disable wind and set default values and materials
|
||||
func init_wind():
|
||||
@@ -488,6 +490,7 @@ func _apply_cloud_config() -> void:
|
||||
|
||||
func toggle_storm(value: bool):
|
||||
is_storm = value
|
||||
_emit_weather_event_label()
|
||||
|
||||
#set lightning
|
||||
func init_lightning():
|
||||
@@ -601,6 +604,7 @@ func toggle_rain(value: bool):
|
||||
is_raining = value
|
||||
|
||||
if not particles_rain:
|
||||
_emit_weather_event_label()
|
||||
return
|
||||
|
||||
if is_raining and is_snowing:
|
||||
@@ -634,6 +638,7 @@ func toggle_rain(value: bool):
|
||||
trigger_after_rain())
|
||||
puddle_tween = create_tween()
|
||||
puddle_tween.tween_method(set_puddle_amount, puddle_amount, 0.0, environment_config.puddle_dry_time)
|
||||
_emit_weather_event_label()
|
||||
|
||||
func trigger_morning() -> void:
|
||||
spawn_single_godray()
|
||||
@@ -732,6 +737,23 @@ func toggle_snow(value: bool):
|
||||
snow_tween.kill()
|
||||
snow_tween = create_tween()
|
||||
snow_tween.tween_method(init_snow_amount, actual_snow_amount, target_snow_amount, environment_config.snow_transaction_time)
|
||||
_emit_weather_event_label()
|
||||
|
||||
func _emit_weather_event_label() -> void:
|
||||
var weather_label := "Weather: Clear"
|
||||
if is_storm:
|
||||
weather_label = "Weather: Storm"
|
||||
else:
|
||||
var active_events: Array[String] = []
|
||||
if is_snowing:
|
||||
active_events.append("Snow")
|
||||
if is_raining:
|
||||
active_events.append("Rain")
|
||||
if is_windy:
|
||||
active_events.append("Wind")
|
||||
if not active_events.is_empty():
|
||||
weather_label = "Weather: %s" % " + ".join(active_events)
|
||||
UIEvents.weather_event_changed.emit(weather_label)
|
||||
|
||||
#disable snow and set default values and shader
|
||||
func init_snow(value: float = 0.0):
|
||||
|
||||
@@ -12,6 +12,8 @@ signal wind_change(value: float)
|
||||
@warning_ignore("unused_signal")
|
||||
signal trigger_random_weather(duration: float)
|
||||
@warning_ignore("unused_signal")
|
||||
signal weather_event_changed(description: String)
|
||||
@warning_ignore("unused_signal")
|
||||
signal toggle_fireflies(value: bool)
|
||||
@warning_ignore("unused_signal")
|
||||
signal toggle_storm(value: bool)
|
||||
|
||||
@@ -363,6 +363,16 @@ theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Random Weather (10\")"
|
||||
|
||||
[node name="WeatherEventLabel" type="Label" parent="Control" unique_id=641424797]
|
||||
layout_mode = 0
|
||||
offset_left = 1656.0
|
||||
offset_top = 11.0
|
||||
offset_right = 1908.0
|
||||
offset_bottom = 34.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Weather: Clear"
|
||||
|
||||
[connection signal="toggled" from="Control/Snow" to="Control" method="_on_snow_toggled"]
|
||||
[connection signal="toggled" from="Control/Rain" to="Control" method="_on_rain_toggled"]
|
||||
[connection signal="toggled" from="Control/Wind" to="Control" method="_on_wind_toggled"]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends Control
|
||||
|
||||
@onready var day_night: EnvironmentManagerRoot = $"../DayNight"
|
||||
@onready var weather_event_label: Label = $WeatherEventLabel
|
||||
@onready var day_time_label: Label = $DayTimeLabel
|
||||
@onready var day_time_slider: HSlider = $DayTimeSlider
|
||||
@onready var wind_slider: HSlider = $WindSlider
|
||||
@@ -9,9 +10,11 @@ extends Control
|
||||
func _ready() -> void:
|
||||
UIEvents.day_time_changed.connect(_on_day_time_changed)
|
||||
UIEvents.day_time_option_changed.connect(_on_day_time_option_changed)
|
||||
UIEvents.weather_event_changed.connect(_on_weather_event_changed)
|
||||
if day_night != null and day_night.environment_config != null and wind_slider != null:
|
||||
wind_slider.set_value_no_signal(day_night.environment_config.wind_strength)
|
||||
_sync_day_time_ui()
|
||||
_on_weather_event_changed("Weather: Clear")
|
||||
|
||||
func _on_rain_toggled(toggled_on: bool) -> void:
|
||||
UIEvents.toggle_rain.emit(toggled_on)
|
||||
@@ -48,6 +51,10 @@ func _on_day_time_changed(value: float, time_string: String) -> void:
|
||||
label_text = "Time %s | nt %.3f | dt %.3f" % [time_string, value, day_night.day_time]
|
||||
day_time_label.text = label_text
|
||||
|
||||
func _on_weather_event_changed(description: String) -> void:
|
||||
if weather_event_label:
|
||||
weather_event_label.text = description
|
||||
|
||||
func _on_fog_overlay_toggled(toggled_on: bool) -> void:
|
||||
UIEvents.toggle_fog_overlay.emit(toggled_on)
|
||||
|
||||
|
||||
@@ -217,6 +217,16 @@ theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Random Weather (10\")"
|
||||
|
||||
[node name="WeatherEventLabel" type="Label" parent="Control" unique_id=1030782057]
|
||||
layout_mode = 0
|
||||
offset_left = 1637.0
|
||||
offset_top = 19.0
|
||||
offset_right = 1889.0
|
||||
offset_bottom = 42.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Weather: Clear"
|
||||
|
||||
[node name="Storm" type="CheckButton" parent="Control" unique_id=936960924]
|
||||
layout_mode = 0
|
||||
offset_left = 110.0
|
||||
|
||||
Reference in New Issue
Block a user