initial commit, hope i didnt push any keys :P
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
extends MarginContainer
|
||||
|
||||
var alarm:Alarm
|
||||
var playing := false
|
||||
|
||||
onready var time_talker = $"../time talker"
|
||||
onready var weather_api_node = $"../WeatherAPINode"
|
||||
onready var snooze_timer = $"snooze timer"
|
||||
onready var snooze_button = $VBoxContainer/HBoxContainer/snooze
|
||||
onready var sleep_mode = $"../sleep_mode"
|
||||
|
||||
var _day
|
||||
var _weather
|
||||
|
||||
func popup(alarm:Alarm):
|
||||
if !alarm.active:
|
||||
return
|
||||
self.alarm = alarm
|
||||
|
||||
sleep_mode.prevent_sleep = true
|
||||
snooze_button.visible = alarm.snooze
|
||||
snooze_timer.stop()
|
||||
time_talker.stop()
|
||||
|
||||
_weather = Constants.WEATHER.UNKNOWN
|
||||
var json = yield(weather_api_node.get_forecast(),"completed")
|
||||
var temperature = json['current']['temp_c']
|
||||
if json is Dictionary:
|
||||
_weather = Constants.code_to_weather(json['current']['condition']['code'])
|
||||
_day = Time.get_date_dict_from_system()['weekday']
|
||||
show()
|
||||
_play()
|
||||
|
||||
|
||||
func _play():
|
||||
playing = true
|
||||
if !time_talker.is_playing():
|
||||
time_talker.play(alarm.moment, _day, _weather, alarm.weather_music if alarm.override_weather_music else null, alarm.play_music, alarm.speak_time)
|
||||
|
||||
func _on_snooze_timer_timeout():
|
||||
if alarm!=null and !alarm.active:
|
||||
_on_stop_pressed()
|
||||
return
|
||||
show()
|
||||
sleep_mode.prevent_sleep = true
|
||||
if alarm != null:
|
||||
_play()
|
||||
|
||||
func _on_stop_pressed():
|
||||
sleep_mode.prevent_sleep = false
|
||||
playing = false
|
||||
alarm = null
|
||||
time_talker.stop(1.5)
|
||||
snooze_timer.stop()
|
||||
self.hide()
|
||||
|
||||
func _on_snooze_pressed():
|
||||
sleep_mode.prevent_sleep = false
|
||||
print("Ya snooze...")
|
||||
playing = false
|
||||
time_talker.stop(2.5)
|
||||
snooze_timer.start(5*60)
|
||||
self.hide()
|
||||
# snooze_timer.start(5)
|
||||
|
||||
|
||||
func _on_time_talker_finished():
|
||||
if playing and alarm != null:
|
||||
_play()
|
||||
@@ -0,0 +1,135 @@
|
||||
extends MarginContainer
|
||||
|
||||
onready var tab_buttons = $"%tab_buttons"
|
||||
onready var weather_api_node = $WeatherAPINode
|
||||
|
||||
onready var backgrounds = get_tree().get_nodes_in_group("background")
|
||||
onready var foreground = $foreground
|
||||
onready var screens = $"%screens"
|
||||
onready var time_talker = $"time talker"
|
||||
onready var sleep_mode = $sleep_mode
|
||||
onready var minute_timer = $"minute timer"
|
||||
|
||||
const version := '1.0'
|
||||
const linkbacks := true
|
||||
|
||||
var audio_button
|
||||
var weather_data := []
|
||||
|
||||
func _ready():
|
||||
if not linkbacks:
|
||||
get_tree().call_group("linkbacks", "hide")
|
||||
get_tree().call_group("linkbacks", "set_text", '')
|
||||
|
||||
|
||||
if OS.get_name() in ['Android', 'IOS']:
|
||||
get_tree().set_screen_stretch( SceneTree.STRETCH_MODE_2D, SceneTree.STRETCH_ASPECT_EXPAND, Vector2(ProjectSettings.get_setting("display/window/size/width"), ProjectSettings.get_setting("display/window/size/height")))
|
||||
|
||||
Config.connect("changed", self, "_on_config_changed")
|
||||
_on_config_changed(true)
|
||||
print(screens)
|
||||
audio_button = screens.tabs_holder.get_child(0).audio
|
||||
print(audio_button)
|
||||
$WeatherAPINode.location = Config.flags.location
|
||||
_on_hourly_weather_timer_timeout()
|
||||
_on_minute_timer_timeout()
|
||||
var seconds = Time.get_time_dict_from_system()['second']
|
||||
minute_timer.start(60-seconds)
|
||||
|
||||
|
||||
func _on_config_changed(skip_api_update:=false):
|
||||
|
||||
if !skip_api_update and (weather_api_node.location != Config.flags.location or weather_api_node.api_key != Config.flags.api_key):
|
||||
weather_api_node.api_key = Config.flags.api_key
|
||||
weather_api_node.location = Config.flags.location
|
||||
_on_hourly_weather_timer_timeout()
|
||||
else:
|
||||
weather_api_node.api_key = Config.flags.api_key
|
||||
weather_api_node.location = Config.flags.location
|
||||
|
||||
_check_dark_mode(Time.get_time_dict_from_system())
|
||||
|
||||
func _on_TabContainer_tab_selected(tab):
|
||||
var x := 0
|
||||
if !tab_buttons:
|
||||
return
|
||||
for item in tab_buttons.get_children():
|
||||
item.pressed = x == tab
|
||||
x += 1
|
||||
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_WM_QUIT_REQUEST or what == NOTIFICATION_APP_PAUSED or what == NOTIFICATION_WM_FOCUS_OUT:
|
||||
Config.save_flags()
|
||||
if what == NOTIFICATION_WM_QUIT_REQUEST:
|
||||
get_tree().quit()
|
||||
|
||||
func tween_background(color:Color, duration := 0.75):
|
||||
for background in backgrounds:
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property(background, 'color', color, duration)
|
||||
tween.play()
|
||||
|
||||
func _on_hourly_weather_timer_timeout():
|
||||
weather_api_node.get_forecast()
|
||||
|
||||
func _on_WeatherAPINode_received_forecast(json):
|
||||
var WC = Constants.WEATHER.UNKNOWN
|
||||
print('weather update: ',json)
|
||||
if json != null:
|
||||
weather_data.append(json)
|
||||
WC = json['current']['condition']['code']
|
||||
get_tree().call_group("hourly_weather_updates", "hourly_weather_update", json)
|
||||
var weather = Constants.code_to_weather(WC)
|
||||
tween_background(Constants.weather_to_color(weather))
|
||||
|
||||
func set_transition(stage:float):
|
||||
foreground.material.set_shader_param('transition', stage)
|
||||
|
||||
func _on_minute_timer_timeout():
|
||||
var time = Time.get_time_dict_from_system()
|
||||
get_tree().call_group("minute_timer_updates", "minute_timer_update", time)
|
||||
_check_dark_mode(time)
|
||||
minute_timer.start(60.0)
|
||||
|
||||
func _check_dark_mode(time):
|
||||
var ctrans = foreground.material.get_shader_param('transition')
|
||||
var target = 0.0
|
||||
if Config.flags.automatic_dark_mode and (time['hour'] >= 20 or time['hour'] <= 6):
|
||||
print('go')
|
||||
target = 1.0
|
||||
if ctrans != target:
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_method(self, "set_transition", 1.0-target, target, 2.0)
|
||||
tween.play()
|
||||
|
||||
|
||||
|
||||
func _on_audio_toggled(button_pressed):
|
||||
if button_pressed:
|
||||
var weather = Constants.WEATHER.UNKNOWN
|
||||
if len(weather_data) > 0:
|
||||
weather = Constants.code_to_weather(weather_data[-1]['current']['condition']['code'])
|
||||
time_talker.play(Constants.current_moment(), Time.get_date_dict_from_system()['weekday'], weather)
|
||||
else:
|
||||
time_talker.stop(2.5)
|
||||
|
||||
|
||||
func _on_time_talker_finished():
|
||||
pass # Replace with function body.
|
||||
audio_button.pressed = false
|
||||
|
||||
|
||||
func _on_hide_sleepmode_pressed():
|
||||
sleep_mode.hide()
|
||||
|
||||
|
||||
func _on_tab_button_pressed(idx:int):
|
||||
if screens:
|
||||
screens.switch_tab(idx)
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_credits_button_pressed():
|
||||
if linkbacks:
|
||||
OS.shell_open("https://lisanne.gay/")
|
||||
@@ -0,0 +1,537 @@
|
||||
[gd_scene load_steps=37 format=2]
|
||||
|
||||
[ext_resource path="res://assets/texture/buttons/clock.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/texture/buttons/clock_on.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/texture/buttons/time.png" type="Texture" id=3]
|
||||
[ext_resource path="res://scenes/current_time_screen/current_time_screen.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://assets/texture/buttons/globe.png" type="Texture" id=5]
|
||||
[ext_resource path="res://assets/texture/buttons/globe_on.png" type="Texture" id=6]
|
||||
[ext_resource path="res://assets/texture/buttons/time_on.png" type="Texture" id=7]
|
||||
[ext_resource path="res://scenes/main/main.gd" type="Script" id=8]
|
||||
[ext_resource path="res://addons/WeatherAPI/node.gd" type="Script" id=9]
|
||||
[ext_resource path="res://scripts/AudioArrayPlayer.gd" type="Script" id=10]
|
||||
[ext_resource path="res://scenes/main/time talker.gd" type="Script" id=11]
|
||||
[ext_resource path="res://assets/texture/buttons/settings.png" type="Texture" id=12]
|
||||
[ext_resource path="res://assets/texture/buttons/settings_on.png" type="Texture" id=13]
|
||||
[ext_resource path="res://assets/texture/buttons/time_hover.png" type="Texture" id=14]
|
||||
[ext_resource path="res://assets/texture/buttons/globe_hover.png" type="Texture" id=15]
|
||||
[ext_resource path="res://assets/texture/buttons/clock_hover.png" type="Texture" id=16]
|
||||
[ext_resource path="res://assets/texture/buttons/settings_hover.png" type="Texture" id=17]
|
||||
[ext_resource path="res://assets/main.tres" type="Theme" id=18]
|
||||
[ext_resource path="res://addons/BetterTabContainer/BetterTabContainer.gd" type="Script" id=19]
|
||||
[ext_resource path="res://assets/texture/buttons/moon.png" type="Texture" id=20]
|
||||
[ext_resource path="res://scenes/alarms_screen/alarms_screen.tscn" type="PackedScene" id=21]
|
||||
[ext_resource path="res://scenes/main/sleep_mode.gd" type="Script" id=22]
|
||||
[ext_resource path="res://assets/texture/alarms/cancel.png" type="Texture" id=23]
|
||||
[ext_resource path="res://assets/texture/alarms/wakeup.png" type="Texture" id=24]
|
||||
[ext_resource path="res://scenes/main/alarm.gd" type="Script" id=25]
|
||||
[ext_resource path="res://scenes/settings_screen/settings_screen.tscn" type="PackedScene" id=26]
|
||||
[ext_resource path="res://icon.png" type="Texture" id=27]
|
||||
|
||||
[sub_resource type="VisualShaderNodeInput" id=5]
|
||||
input_name = "screen_texture"
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture" id=6]
|
||||
source = 5
|
||||
|
||||
[sub_resource type="VisualShaderNodeInput" id=7]
|
||||
input_name = "screen_uv"
|
||||
|
||||
[sub_resource type="VisualShaderNodeVectorOp" id=8]
|
||||
default_input_values = [ 0, Vector3( 1, 1, 1 ), 1, Vector3( 0, 0, 0 ) ]
|
||||
operator = 1
|
||||
|
||||
[sub_resource type="VisualShaderNodeVectorInterp" id=9]
|
||||
|
||||
[sub_resource type="VisualShaderNodeScalarConstant" id=10]
|
||||
constant = 1.0
|
||||
|
||||
[sub_resource type="VisualShaderNodeScalarUniform" id=11]
|
||||
uniform_name = "transition"
|
||||
hint = 1
|
||||
default_value_enabled = true
|
||||
|
||||
[sub_resource type="VisualShader" id=3]
|
||||
code = "shader_type canvas_item;
|
||||
uniform float transition : hint_range(0, 1) = 0;
|
||||
|
||||
|
||||
|
||||
void vertex() {
|
||||
// Output:0
|
||||
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Input:4
|
||||
vec3 n_out4p0 = vec3(SCREEN_UV, 0.0);
|
||||
|
||||
// Input:2
|
||||
|
||||
// Texture:3
|
||||
vec3 n_out3p0;
|
||||
float n_out3p1;
|
||||
{
|
||||
vec4 SCREEN_TEXTURE_tex_read = texture(SCREEN_TEXTURE, n_out4p0.xy);
|
||||
n_out3p0 = SCREEN_TEXTURE_tex_read.rgb;
|
||||
n_out3p1 = SCREEN_TEXTURE_tex_read.a;
|
||||
}
|
||||
|
||||
// Scalar:7
|
||||
float n_out7p0 = 1.000000;
|
||||
|
||||
// VectorOp:5
|
||||
vec3 n_out5p0 = vec3(n_out7p0) - n_out3p0;
|
||||
|
||||
// ScalarUniform:8
|
||||
float n_out8p0 = transition;
|
||||
|
||||
// VectorMix:6
|
||||
vec3 n_out6p0 = mix(n_out3p0, n_out5p0, vec3(n_out8p0));
|
||||
|
||||
// Output:0
|
||||
COLOR.rgb = n_out6p0;
|
||||
|
||||
}
|
||||
|
||||
void light() {
|
||||
// Output:0
|
||||
|
||||
}
|
||||
"
|
||||
graph_offset = Vector2( -259.29, 244.334 )
|
||||
mode = 1
|
||||
flags/light_only = false
|
||||
nodes/fragment/0/position = Vector2( 760, 120 )
|
||||
nodes/fragment/2/node = SubResource( 5 )
|
||||
nodes/fragment/2/position = Vector2( -180, 200 )
|
||||
nodes/fragment/3/node = SubResource( 6 )
|
||||
nodes/fragment/3/position = Vector2( 80, 120 )
|
||||
nodes/fragment/4/node = SubResource( 7 )
|
||||
nodes/fragment/4/position = Vector2( -180, 140 )
|
||||
nodes/fragment/5/node = SubResource( 8 )
|
||||
nodes/fragment/5/position = Vector2( 280, 100 )
|
||||
nodes/fragment/6/node = SubResource( 9 )
|
||||
nodes/fragment/6/position = Vector2( 520, 140 )
|
||||
nodes/fragment/7/node = SubResource( 10 )
|
||||
nodes/fragment/7/position = Vector2( 80, 60 )
|
||||
nodes/fragment/8/node = SubResource( 11 )
|
||||
nodes/fragment/8/position = Vector2( 200, 260 )
|
||||
nodes/fragment/connections = PoolIntArray( 2, 0, 3, 2, 4, 0, 3, 0, 3, 0, 5, 1, 7, 0, 5, 0, 6, 0, 0, 0, 8, 0, 6, 2, 5, 0, 6, 1, 3, 0, 6, 0 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=4]
|
||||
shader = SubResource( 3 )
|
||||
shader_param/transition = 0.0
|
||||
|
||||
[node name="main" type="MarginContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
theme = ExtResource( 18 )
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="background" type="ColorRect" parent="." groups=["background"]]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
mouse_filter = 2
|
||||
color = Color( 0.815686, 0.815686, 0.815686, 1 )
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="."]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
tabs_visible = false
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="screens" type="ScrollContainer" parent="TabContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 350.0
|
||||
margin_bottom = 582.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 19 )
|
||||
swipe_threshold = 32.0
|
||||
|
||||
[node name="current_time_screen" parent="TabContainer/VBoxContainer/screens" instance=ExtResource( 4 )]
|
||||
margin_bottom = 582.0
|
||||
|
||||
[node name="Control3" parent="TabContainer/VBoxContainer/screens/current_time_screen" index="0"]
|
||||
margin_bottom = 582.0
|
||||
|
||||
[node name="VBoxContainer" parent="TabContainer/VBoxContainer/screens/current_time_screen" index="1"]
|
||||
margin_bottom = 582.0
|
||||
|
||||
[node name="Control" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="0"]
|
||||
margin_bottom = 56.0
|
||||
|
||||
[node name="time_display" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="1"]
|
||||
margin_top = 60.0
|
||||
margin_bottom = 149.0
|
||||
|
||||
[node name="weather_display" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="2"]
|
||||
margin_top = 153.0
|
||||
margin_bottom = 353.0
|
||||
|
||||
[node name="location_display" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="3"]
|
||||
margin_top = 357.0
|
||||
margin_bottom = 377.0
|
||||
|
||||
[node name="temperature_display" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="4"]
|
||||
margin_top = 381.0
|
||||
margin_bottom = 417.0
|
||||
|
||||
[node name="Control2" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="5"]
|
||||
margin_top = 421.0
|
||||
margin_bottom = 477.0
|
||||
|
||||
[node name="audio" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="6"]
|
||||
margin_top = 481.0
|
||||
margin_bottom = 521.0
|
||||
|
||||
[node name="Control3" parent="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer" index="7"]
|
||||
margin_top = 525.0
|
||||
margin_bottom = 582.0
|
||||
|
||||
[node name="Control4" parent="TabContainer/VBoxContainer/screens/current_time_screen" index="2"]
|
||||
margin_bottom = 582.0
|
||||
|
||||
[node name="alarms_screen" parent="TabContainer/VBoxContainer/screens" instance=ExtResource( 21 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 582.0
|
||||
|
||||
[node name="globe_screen" type="ScrollContainer" parent="TabContainer/VBoxContainer/screens"]
|
||||
margin_right = 304.0
|
||||
mouse_filter = 2
|
||||
scroll_horizontal_enabled = false
|
||||
|
||||
[node name="globe_screen" type="VBoxContainer" parent="TabContainer/VBoxContainer/screens/globe_screen"]
|
||||
margin_right = 288.0
|
||||
margin_bottom = 528.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="TabContainer/VBoxContainer/screens/globe_screen/globe_screen"]
|
||||
margin_right = 288.0
|
||||
margin_bottom = 300.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/margin_right = 25
|
||||
custom_constants/margin_left = 25
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="TabContainer/VBoxContainer/screens/globe_screen/globe_screen/MarginContainer"]
|
||||
margin_left = 25.0
|
||||
margin_right = 263.0
|
||||
margin_bottom = 300.0
|
||||
rect_min_size = Vector2( 0, 300 )
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
texture = ExtResource( 27 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="version" type="Label" parent="TabContainer/VBoxContainer/screens/globe_screen/globe_screen"]
|
||||
margin_top = 304.0
|
||||
margin_right = 288.0
|
||||
margin_bottom = 326.0
|
||||
text = "UNIQLONE v1.0"
|
||||
align = 1
|
||||
|
||||
[node name="credits" type="Label" parent="TabContainer/VBoxContainer/screens/globe_screen/globe_screen" groups=["linkbacks"]]
|
||||
margin_top = 330.0
|
||||
margin_right = 288.0
|
||||
margin_bottom = 502.0
|
||||
text = "
|
||||
Made by (lis)anne
|
||||
Original app & assets by UNIQLO
|
||||
Created in Godot engine
|
||||
Name by @Sneakilli
|
||||
BetterTabContainer by Ucrash
|
||||
"
|
||||
align = 1
|
||||
|
||||
[node name="credits_button" type="LinkButton" parent="TabContainer/VBoxContainer/screens/globe_screen/globe_screen" groups=["linkbacks"]]
|
||||
margin_left = 30.0
|
||||
margin_top = 506.0
|
||||
margin_right = 257.0
|
||||
margin_bottom = 528.0
|
||||
size_flags_horizontal = 4
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
text = "Check out my other stuff"
|
||||
|
||||
[node name="settings_screen" parent="TabContainer/VBoxContainer/screens" instance=ExtResource( 26 )]
|
||||
margin_bottom = 582.0
|
||||
|
||||
[node name="tab_buttons" type="HBoxContainer" parent="TabContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 586.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 636.0
|
||||
rect_min_size = Vector2( 0, 50 )
|
||||
|
||||
[node name="current_button" type="TextureButton" parent="TabContainer/VBoxContainer/tab_buttons"]
|
||||
margin_right = 84.0
|
||||
margin_bottom = 50.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
texture_normal = ExtResource( 3 )
|
||||
texture_pressed = ExtResource( 7 )
|
||||
texture_hover = ExtResource( 14 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="alarms_button" type="TextureButton" parent="TabContainer/VBoxContainer/tab_buttons"]
|
||||
margin_left = 88.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 50.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
texture_normal = ExtResource( 1 )
|
||||
texture_pressed = ExtResource( 2 )
|
||||
texture_hover = ExtResource( 16 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="globe_button" type="TextureButton" parent="TabContainer/VBoxContainer/tab_buttons"]
|
||||
margin_left = 177.0
|
||||
margin_right = 261.0
|
||||
margin_bottom = 50.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
texture_normal = ExtResource( 5 )
|
||||
texture_pressed = ExtResource( 6 )
|
||||
texture_hover = ExtResource( 15 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="settings_button" type="TextureButton" parent="TabContainer/VBoxContainer/tab_buttons"]
|
||||
margin_left = 265.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 50.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
texture_normal = ExtResource( 12 )
|
||||
texture_pressed = ExtResource( 13 )
|
||||
texture_hover = ExtResource( 17 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Control" type="Control" parent="TabContainer/VBoxContainer"]
|
||||
margin_top = 640.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
rect_min_size = Vector2( 0, 10 )
|
||||
|
||||
[node name="alarm" type="MarginContainer" parent="."]
|
||||
visible = false
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
script = ExtResource( 25 )
|
||||
|
||||
[node name="background" type="ColorRect" parent="alarm" groups=["background"]]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
mouse_filter = 2
|
||||
color = Color( 0.815686, 0.815686, 0.815686, 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="alarm"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
|
||||
[node name="current_time_screen" parent="alarm/VBoxContainer" instance=ExtResource( 4 )]
|
||||
margin_bottom = 532.0
|
||||
|
||||
[node name="Control3" parent="alarm/VBoxContainer/current_time_screen" index="0"]
|
||||
margin_bottom = 532.0
|
||||
|
||||
[node name="VBoxContainer" parent="alarm/VBoxContainer/current_time_screen" index="1"]
|
||||
margin_bottom = 532.0
|
||||
|
||||
[node name="Control" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="0"]
|
||||
margin_bottom = 72.0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="1"]
|
||||
margin_top = 76.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 76.0
|
||||
|
||||
[node name="time_display" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="2"]
|
||||
margin_top = 80.0
|
||||
margin_bottom = 169.0
|
||||
|
||||
[node name="weather_display" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="3"]
|
||||
margin_top = 173.0
|
||||
margin_bottom = 391.0
|
||||
|
||||
[node name="location_display" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="4"]
|
||||
margin_top = 395.0
|
||||
margin_bottom = 415.0
|
||||
|
||||
[node name="temperature_display" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="5"]
|
||||
margin_top = 419.0
|
||||
margin_bottom = 455.0
|
||||
|
||||
[node name="Control2" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="6"]
|
||||
margin_top = 459.0
|
||||
margin_bottom = 532.0
|
||||
|
||||
[node name="audio" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="7"]
|
||||
visible = false
|
||||
|
||||
[node name="Control3" parent="alarm/VBoxContainer/current_time_screen/VBoxContainer" index="8"]
|
||||
visible = false
|
||||
margin_top = 528.0
|
||||
|
||||
[node name="Control4" parent="alarm/VBoxContainer/current_time_screen" index="2"]
|
||||
margin_bottom = 532.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="alarm/VBoxContainer"]
|
||||
margin_top = 536.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 600.0
|
||||
rect_min_size = Vector2( 0, 64 )
|
||||
|
||||
[node name="snooze" type="TextureButton" parent="alarm/VBoxContainer/HBoxContainer"]
|
||||
margin_right = 173.0
|
||||
margin_bottom = 64.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture_normal = ExtResource( 23 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="stop" type="TextureButton" parent="alarm/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 177.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 64.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture_normal = ExtResource( 24 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="snooze timer" type="Timer" parent="alarm"]
|
||||
wait_time = 300.0
|
||||
one_shot = true
|
||||
|
||||
[node name="foreground" type="ColorRect" parent="."]
|
||||
material = SubResource( 4 )
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="sleep_mode" type="MarginContainer" parent="." groups=["minute_timer_updates"]]
|
||||
visible = false
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
mouse_default_cursor_shape = 2
|
||||
script = ExtResource( 22 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="sleep_mode"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="sleep_mode"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="sleep_mode/CenterContainer"]
|
||||
modulate = Color( 1, 1, 1, 0.47451 )
|
||||
margin_left = 128.0
|
||||
margin_top = 267.0
|
||||
margin_right = 221.0
|
||||
margin_bottom = 383.0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="sleep_mode/CenterContainer/VBoxContainer"]
|
||||
margin_right = 93.0
|
||||
margin_bottom = 64.0
|
||||
rect_min_size = Vector2( 64, 64 )
|
||||
texture = ExtResource( 20 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="Label" type="Label" parent="sleep_mode/CenterContainer/VBoxContainer"]
|
||||
margin_top = 68.0
|
||||
margin_right = 93.0
|
||||
margin_bottom = 90.0
|
||||
text = "Good night"
|
||||
align = 1
|
||||
|
||||
[node name="time" type="Label" parent="sleep_mode/CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 94.0
|
||||
margin_right = 93.0
|
||||
margin_bottom = 116.0
|
||||
text = "7 AM"
|
||||
align = 1
|
||||
|
||||
[node name="hide_sleepmode" type="Button" parent="sleep_mode"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 650.0
|
||||
mouse_default_cursor_shape = 2
|
||||
flat = true
|
||||
|
||||
[node name="sleep_timer" type="Timer" parent="sleep_mode"]
|
||||
one_shot = true
|
||||
|
||||
[node name="time talker" type="Node" parent="."]
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="speech" type="AudioStreamPlayer" parent="time talker"]
|
||||
script = ExtResource( 10 )
|
||||
|
||||
[node name="music" type="AudioStreamPlayer" parent="time talker"]
|
||||
|
||||
[node name="WeatherAPINode" type="Node" parent="."]
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="minute timer" type="Timer" parent="."]
|
||||
|
||||
[node name="hourly weather timer" type="Timer" parent="."]
|
||||
wait_time = 3600.0
|
||||
autostart = true
|
||||
|
||||
[connection signal="tab_switched" from="TabContainer/VBoxContainer/screens" to="." method="_on_TabContainer_tab_selected"]
|
||||
[connection signal="toggled" from="TabContainer/VBoxContainer/screens/current_time_screen/VBoxContainer/audio" to="." method="_on_audio_toggled"]
|
||||
[connection signal="pressed" from="TabContainer/VBoxContainer/screens/globe_screen/globe_screen/credits_button" to="." method="_on_credits_button_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/VBoxContainer/tab_buttons/current_button" to="." method="_on_tab_button_pressed" binds= [ 0 ]]
|
||||
[connection signal="pressed" from="TabContainer/VBoxContainer/tab_buttons/alarms_button" to="." method="_on_tab_button_pressed" binds= [ 1 ]]
|
||||
[connection signal="pressed" from="TabContainer/VBoxContainer/tab_buttons/globe_button" to="." method="_on_tab_button_pressed" binds= [ 2 ]]
|
||||
[connection signal="pressed" from="TabContainer/VBoxContainer/tab_buttons/settings_button" to="." method="_on_tab_button_pressed" binds= [ 3 ]]
|
||||
[connection signal="pressed" from="alarm/VBoxContainer/HBoxContainer/snooze" to="alarm" method="_on_snooze_pressed"]
|
||||
[connection signal="pressed" from="alarm/VBoxContainer/HBoxContainer/stop" to="alarm" method="_on_stop_pressed"]
|
||||
[connection signal="timeout" from="alarm/snooze timer" to="alarm" method="_on_snooze_timer_timeout"]
|
||||
[connection signal="pressed" from="sleep_mode/hide_sleepmode" to="." method="_on_hide_sleepmode_pressed"]
|
||||
[connection signal="timeout" from="sleep_mode/sleep_timer" to="sleep_mode" method="_on_sleep_timer_timeout"]
|
||||
[connection signal="finished" from="time talker" to="." method="_on_time_talker_finished"]
|
||||
[connection signal="finished" from="time talker" to="alarm" method="_on_time_talker_finished"]
|
||||
[connection signal="all_finished" from="time talker/speech" to="time talker" method="_on_speech_all_finished"]
|
||||
[connection signal="finished" from="time talker/music" to="time talker" method="_on_music_finished"]
|
||||
[connection signal="received_forecast" from="WeatherAPINode" to="." method="_on_WeatherAPINode_received_forecast"]
|
||||
[connection signal="timeout" from="minute timer" to="." method="_on_minute_timer_timeout"]
|
||||
[connection signal="timeout" from="hourly weather timer" to="." method="_on_hourly_weather_timer_timeout"]
|
||||
|
||||
[editable path="TabContainer/VBoxContainer/screens/current_time_screen"]
|
||||
[editable path="alarm/VBoxContainer/current_time_screen"]
|
||||
@@ -0,0 +1,30 @@
|
||||
extends MarginContainer
|
||||
|
||||
export var auto_sleep :float = 60*2
|
||||
export var prevent_sleep := false setget set_prevent_sleep
|
||||
#export var auto_sleep :float = 6
|
||||
|
||||
onready var sleep_timer = $sleep_timer
|
||||
|
||||
|
||||
func _ready():
|
||||
sleep_timer.start(auto_sleep)
|
||||
|
||||
func set_prevent_sleep(new:bool):
|
||||
if new or Config.flags.prevent_sleep_mode:
|
||||
hide()
|
||||
sleep_timer.stop()
|
||||
else:
|
||||
sleep_timer.start(auto_sleep)
|
||||
prevent_sleep = new
|
||||
|
||||
func _input(event):
|
||||
if not visible and not (prevent_sleep or Config.flags.prevent_sleep_mode):
|
||||
sleep_timer.start(auto_sleep)
|
||||
|
||||
func _on_sleep_timer_timeout():
|
||||
if !prevent_sleep and !Config.flags.prevent_sleep_mode:
|
||||
show()
|
||||
|
||||
func minute_timer_update(time):
|
||||
$"%time".text = '{0}:{1}'.format([str(time['hour']).pad_zeros(2), str(time['minute']).pad_zeros(2)])
|
||||
@@ -0,0 +1,96 @@
|
||||
extends Node
|
||||
|
||||
signal finished
|
||||
|
||||
onready var node_speech = $speech
|
||||
onready var node_music = $music
|
||||
|
||||
const greet := [preload("res://assets/audio/clips/greet/voc_en_greet_goodmorning.mp3"), preload("res://assets/audio/clips/greet/voc_en_greet_hello.mp3")]
|
||||
const its := preload("res://assets/audio/clips/misc/voc_en_its.mp3")
|
||||
const minutes := ["res://assets/audio/clips/time/minute/voc_en_min_00.mp3", "res://assets/audio/clips/time/minute/voc_en_min_01.mp3", "res://assets/audio/clips/time/minute/voc_en_min_02.mp3", "res://assets/audio/clips/time/minute/voc_en_min_03.mp3", "res://assets/audio/clips/time/minute/voc_en_min_04.mp3", "res://assets/audio/clips/time/minute/voc_en_min_05.mp3", "res://assets/audio/clips/time/minute/voc_en_min_06.mp3", "res://assets/audio/clips/time/minute/voc_en_min_07.mp3", "res://assets/audio/clips/time/minute/voc_en_min_08.mp3", "res://assets/audio/clips/time/minute/voc_en_min_09.mp3", "res://assets/audio/clips/time/minute/voc_en_min_10.mp3", "res://assets/audio/clips/time/minute/voc_en_min_11.mp3", "res://assets/audio/clips/time/minute/voc_en_min_12.mp3", "res://assets/audio/clips/time/minute/voc_en_min_13.mp3", "res://assets/audio/clips/time/minute/voc_en_min_14.mp3", "res://assets/audio/clips/time/minute/voc_en_min_15.mp3", "res://assets/audio/clips/time/minute/voc_en_min_16.mp3", "res://assets/audio/clips/time/minute/voc_en_min_17.mp3", "res://assets/audio/clips/time/minute/voc_en_min_18.mp3", "res://assets/audio/clips/time/minute/voc_en_min_19.mp3", "res://assets/audio/clips/time/minute/voc_en_min_20.mp3", "res://assets/audio/clips/time/minute/voc_en_min_21.mp3", "res://assets/audio/clips/time/minute/voc_en_min_22.mp3", "res://assets/audio/clips/time/minute/voc_en_min_23.mp3", "res://assets/audio/clips/time/minute/voc_en_min_24.mp3", "res://assets/audio/clips/time/minute/voc_en_min_25.mp3", "res://assets/audio/clips/time/minute/voc_en_min_26.mp3", "res://assets/audio/clips/time/minute/voc_en_min_27.mp3", "res://assets/audio/clips/time/minute/voc_en_min_28.mp3", "res://assets/audio/clips/time/minute/voc_en_min_29.mp3", "res://assets/audio/clips/time/minute/voc_en_min_30.mp3", "res://assets/audio/clips/time/minute/voc_en_min_31.mp3", "res://assets/audio/clips/time/minute/voc_en_min_32.mp3", "res://assets/audio/clips/time/minute/voc_en_min_33.mp3", "res://assets/audio/clips/time/minute/voc_en_min_34.mp3", "res://assets/audio/clips/time/minute/voc_en_min_35.mp3", "res://assets/audio/clips/time/minute/voc_en_min_36.mp3", "res://assets/audio/clips/time/minute/voc_en_min_37.mp3", "res://assets/audio/clips/time/minute/voc_en_min_38.mp3", "res://assets/audio/clips/time/minute/voc_en_min_39.mp3", "res://assets/audio/clips/time/minute/voc_en_min_40.mp3", "res://assets/audio/clips/time/minute/voc_en_min_41.mp3", "res://assets/audio/clips/time/minute/voc_en_min_42.mp3", "res://assets/audio/clips/time/minute/voc_en_min_43.mp3", "res://assets/audio/clips/time/minute/voc_en_min_44.mp3", "res://assets/audio/clips/time/minute/voc_en_min_45.mp3", "res://assets/audio/clips/time/minute/voc_en_min_46.mp3", "res://assets/audio/clips/time/minute/voc_en_min_47.mp3", "res://assets/audio/clips/time/minute/voc_en_min_48.mp3", "res://assets/audio/clips/time/minute/voc_en_min_49.mp3", "res://assets/audio/clips/time/minute/voc_en_min_50.mp3", "res://assets/audio/clips/time/minute/voc_en_min_51.mp3", "res://assets/audio/clips/time/minute/voc_en_min_52.mp3", "res://assets/audio/clips/time/minute/voc_en_min_53.mp3", "res://assets/audio/clips/time/minute/voc_en_min_54.mp3", "res://assets/audio/clips/time/minute/voc_en_min_55.mp3", "res://assets/audio/clips/time/minute/voc_en_min_56.mp3", "res://assets/audio/clips/time/minute/voc_en_min_57.mp3", "res://assets/audio/clips/time/minute/voc_en_min_58.mp3", "res://assets/audio/clips/time/minute/voc_en_min_59.mp3"]
|
||||
const hours := ["res://assets/audio/clips/time/hour/voc_en_hour_01.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_02.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_03.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_04.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_05.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_06.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_07.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_08.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_09.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_10.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_11.mp3", "res://assets/audio/clips/time/hour/voc_en_hour_12.mp3"]
|
||||
const am_pm := [preload("res://assets/audio/clips/time/am pm/voc_en_ampm_am.mp3"), preload("res://assets/audio/clips/time/am pm/voc_en_ampm_pm.mp3")]
|
||||
const weekday := [preload("res://assets/audio/clips/time/weekday/voc_en_week_0.mp3"), preload("res://assets/audio/clips/time/weekday/voc_en_week_1.mp3"), preload("res://assets/audio/clips/time/weekday/voc_en_week_2.mp3"), preload("res://assets/audio/clips/time/weekday/voc_en_week_3.mp3"), preload("res://assets/audio/clips/time/weekday/voc_en_week_4.mp3"), preload("res://assets/audio/clips/time/weekday/voc_en_week_5.mp3"), preload("res://assets/audio/clips/time/weekday/voc_en_week_6.mp3")]
|
||||
const weather := [preload("res://assets/audio/clips/weather/voc_en_weather_cloudy.mp3"), preload("res://assets/audio/clips/weather/voc_en_weather_foggy.mp3"), preload("res://assets/audio/clips/weather/voc_en_weather_partlycloudy.mp3"), preload("res://assets/audio/clips/weather/voc_en_weather_rainy.mp3"), preload("res://assets/audio/clips/weather/voc_en_weather_snowy.mp3"), preload("res://assets/audio/clips/weather/voc_en_weather_stormy.mp3"), preload("res://assets/audio/clips/weather/voc_en_weather_sunny.mp3")]
|
||||
|
||||
const music := [preload("res://assets/audio/clips/music/music_cloudy.wav"), preload("res://assets/audio/clips/music/music_foggy.wav"), preload("res://assets/audio/clips/music/music_partlycloudy.wav"), preload("res://assets/audio/clips/music/music_rainy.wav"), preload("res://assets/audio/clips/music/music_snowy.wav"), preload("res://assets/audio/clips/music/music_stormy.wav"), preload("res://assets/audio/clips/music/music_sunny.wav"), preload("res://assets/audio/clips/music/music_unknown.wav")]
|
||||
|
||||
var tween:SceneTreeTween
|
||||
|
||||
var A_finished = true
|
||||
var B_finished = true
|
||||
|
||||
func play(moment:Moment, day:int, weather:int, music_weather_override=null, play_music := true, speak_time := true):
|
||||
stop()
|
||||
if tween:
|
||||
tween.kill()
|
||||
node_speech.volume_db = 0
|
||||
node_music.volume_db = 0
|
||||
A_finished = !speak_time
|
||||
B_finished = !play_music
|
||||
var out := []
|
||||
if speak_time:
|
||||
out = [
|
||||
1.0, # sleep for 1 second
|
||||
greet[0] if moment.is_morning() else greet[1],
|
||||
its,
|
||||
load(hours[int(moment.hour-1) % 12]),
|
||||
load(minutes[moment.minute]),
|
||||
am_pm[0 if moment.is_am() else 1],
|
||||
weekday[day],
|
||||
]
|
||||
var tune = music[Constants.WEATHER.UNKNOWN]
|
||||
if weather < Constants.WEATHER.UNKNOWN:
|
||||
out.append(self.weather[weather])
|
||||
tune = music[weather]
|
||||
|
||||
if music_weather_override != null:
|
||||
tune = music[music_weather_override]
|
||||
|
||||
if speak_time:
|
||||
node_speech.play_all(out)
|
||||
if play_music:
|
||||
node_music.stream = tune
|
||||
node_music.play()
|
||||
|
||||
if A_finished and B_finished:
|
||||
emit_signal("finished")
|
||||
|
||||
func stop(fadeout:=0.0):
|
||||
if tween:
|
||||
tween.kill()
|
||||
if fadeout > 0:
|
||||
print("fadeout ",fadeout)
|
||||
tween = get_tree().create_tween()
|
||||
tween.set_parallel(true)
|
||||
tween.tween_property(node_music, "volume_db", -60.0, fadeout)
|
||||
tween.tween_property(node_speech, "volume_db", -60.0, fadeout)
|
||||
tween.set_parallel(false)
|
||||
tween.tween_interval(fadeout)
|
||||
tween.play()
|
||||
yield(tween, 'finished')
|
||||
# tween.connect("finished", self, "stop")
|
||||
# return
|
||||
node_music.stop()
|
||||
node_speech.stop()
|
||||
|
||||
node_speech.volume_db = 0
|
||||
node_music.volume_db = 0
|
||||
|
||||
func is_playing():
|
||||
return !(A_finished and B_finished)
|
||||
|
||||
func _on_speech_all_finished():
|
||||
A_finished = true
|
||||
# print("a_finished")
|
||||
if A_finished and B_finished:
|
||||
# print('boop')
|
||||
emit_signal("finished")
|
||||
|
||||
|
||||
func _on_music_finished():
|
||||
B_finished = true
|
||||
# print("b_finished")
|
||||
if A_finished and B_finished:
|
||||
# print('boop')
|
||||
emit_signal("finished")
|
||||
Reference in New Issue
Block a user