Sneaking survey into game before quitting

This commit is contained in:
bleeptrack 2021-01-28 11:55:53 +01:00
parent 4b8c57ccbe
commit 7903a8d9f3
9 changed files with 159 additions and 5 deletions

View file

@ -57,9 +57,9 @@ boot_splash/bg_color=Color( 0, 0, 0, 1 )
[autoload]
game="*res://scenes/game.gd"
helpers="*res://scenes/helpers.gd"
levels="*res://scenes/levels.gd"
game="*res://scenes/game.tscn"
[display]

View file

@ -15,6 +15,9 @@ var _file = "user://savegame.json"
var state = {}
func _ready():
if OS.has_feature("standalone"):
get_tree().set_auto_accept_quit(false)
global_shell = Shell.new()
create_file_in_game_env(".gitconfig", helpers.read_file("res://scripts/gitconfig"))
@ -24,6 +27,12 @@ func _ready():
load_state()
func _notification(what):
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
#get_tree().quit() # default behavio
get_tree().change_scene("res://scenes/survey.tscn")
func copy_script_to_game_env(name):
create_file_in_game_env(name, helpers.read_file("res://scripts/%s" % name))
global_shell.run("chmod u+x '%s'" % (tmp_prefix + name))
@ -73,3 +82,6 @@ func notify(text, target=null, hint_slug=null):
if hint_slug:
state["received_hints"].push_back(hint_slug)
save_state()
func open_survey():
OS.shell_open("https://docs.google.com/forms/d/e/1FAIpQLSehHVcYfELT59h6plcn2ilbuqBcmDX3TH0qzB4jCgFIFOy_qg/viewform")

6
scenes/game.tscn Normal file
View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/game.gd" type="Script" id=1]
[node name="Node" type="Node"]
script = ExtResource( 1 )

View file

@ -59,5 +59,4 @@ func reload():
chapter_id += 1
func onSurveyPressed():
OS.shell_open("https://docs.google.com/forms/d/e/1FAIpQLSehHVcYfELT59h6plcn2ilbuqBcmDX3TH0qzB4jCgFIFOy_qg/viewform")

View file

@ -66,6 +66,7 @@ margin_right = 40.0
margin_bottom = 40.0
[node name="HelpLabel" type="Label" parent="."]
visible = false
margin_left = 63.0
margin_top = 159.0
margin_right = 378.0
@ -77,9 +78,9 @@ __meta__ = {
}
[node name="Button3" type="Button" parent="HelpLabel"]
margin_left = -1.0
margin_left = -2.0
margin_top = 68.0
margin_right = 314.0
margin_right = 313.0
margin_bottom = 118.0
custom_styles/hover = SubResource( 1 )
custom_styles/focus = ExtResource( 3 )

14
scenes/survey.gd Normal file
View file

@ -0,0 +1,14 @@
extends Control
func _ready():
get_tree().set_auto_accept_quit(true)
func quit():
get_tree().quit()
func levels():
get_tree().change_scene("res://scenes/level_select.tscn")
func on_survey_pressed():
game.open_survey()

110
scenes/survey.tscn Normal file
View file

@ -0,0 +1,110 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://styles/theme.tres" type="Theme" id=1]
[ext_resource path="res://nodes/head.svg" type="Texture" id=2]
[ext_resource path="res://scenes/survey.gd" type="Script" id=3]
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=4]
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=5]
[ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=6]
[ext_resource path="res://styles/alert_button_hover.tres" type="StyleBox" id=7]
[node name="Title" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 1 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorRect" type="ColorRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0, 0, 0, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."]
margin_left = 854.463
margin_top = 234.592
margin_right = 1034.46
margin_bottom = 290.592
custom_fonts/font = ExtResource( 4 )
text = "git-hydra"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label2" type="Label" parent="."]
margin_left = 774.698
margin_top = 297.059
margin_right = 1115.7
margin_bottom = 353.059
custom_fonts/font = ExtResource( 5 )
custom_colors/font_color = Color( 0.533333, 0.392157, 0.392157, 1 )
text = "by bleeptrack & blinry"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="head" type="Sprite" parent="."]
position = Vector2( 946.624, 163.148 )
texture = ExtResource( 2 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -175.997
margin_top = -183.0
margin_right = 175.997
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button2" type="Button" parent="VBoxContainer"]
margin_right = 351.0
margin_bottom = 39.0
text = "Quit"
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -233.0
margin_top = -175.0
margin_right = 233.0
margin_bottom = 175.0
custom_constants/separation = 24
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="VBoxContainer2"]
margin_right = 466.0
margin_bottom = 93.0
text = "Thank you very much for playing!
Please help us improve git-hydra
by filling out this survey:"
align = 1
[node name="Button" type="Button" parent="VBoxContainer2"]
margin_top = 117.0
margin_right = 466.0
margin_bottom = 156.0
focus_mode = 0
custom_styles/hover = ExtResource( 7 )
custom_styles/pressed = ExtResource( 7 )
custom_styles/focus = ExtResource( 7 )
custom_styles/normal = ExtResource( 6 )
enabled_focus_mode = 0
text = "To the survey /o/"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="VBoxContainer/Button2" to="." method="quit"]
[connection signal="pressed" from="VBoxContainer2/Button" to="." method="on_survey_pressed"]

View file

@ -8,3 +8,7 @@ func quit():
func levels():
get_tree().change_scene("res://scenes/level_select.tscn")
func on_survey_pressed():
game.open_survey()

View file

@ -0,0 +1,8 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
bg_color = Color( 0.631373, 0.0745098, 0.0745098, 1 )
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4