started work on user screen

This commit is contained in:
Jaap Marsman 2022-08-03 09:01:10 +08:00
parent 73cb93534b
commit 76014b5f10
9 changed files with 89 additions and 54 deletions

View File

@ -1,6 +0,0 @@
<Project Sdk="Godot.NET.Sdk/3.3.0">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<RootNamespace>WellbeingApp</RootNamespace>
</PropertyGroup>
</Project>

View File

@ -1,19 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wellbeing App", "Wellbeing App.csproj", "{D7C38C84-2B97-4842-B86C-55CA66888418}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
ExportDebug|Any CPU = ExportDebug|Any CPU
ExportRelease|Any CPU = ExportRelease|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D7C38C84-2B97-4842-B86C-55CA66888418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7C38C84-2B97-4842-B86C-55CA66888418}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7C38C84-2B97-4842-B86C-55CA66888418}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
{D7C38C84-2B97-4842-B86C-55CA66888418}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
{D7C38C84-2B97-4842-B86C-55CA66888418}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
{D7C38C84-2B97-4842-B86C-55CA66888418}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
EndGlobalSection
EndGlobal

25
godot/button_user_save.gd Normal file
View File

@ -0,0 +1,25 @@
extends Button
var config = ConfigFile.new()
onready var user_name = get_node("user_details/textbox_user_name")
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_button_user_save_pressed():
# Store some values.
config.set_value("User", "player_name", "Steve")
config.set_value("Player1", "best_score", 10)
config.set_value("Player2", "player_name", "V3geta")
config.set_value("Player2", "best_score", 9001)
# Save it to a file (overwrite if already exists).
config.save("user://user.ini")

21
godot/main_screen.gd Normal file
View File

@ -0,0 +1,21 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var main_screen = get_node("/root/main_screen")
onready var start_menu = get_node("/root/main_screen/start_menu")
onready var user_menu = get_node("/root/main_screen/user_details")
# Called when the node enters the scene tree for the first time.
func _ready():
# Set starting state visibility
main_screen.visible = true
start_menu.visible = true
user_menu.visible = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -14,6 +14,10 @@ config/name="Wellbeing App"
run/main_scene="res://start_screen.tscn" run/main_scene="res://start_screen.tscn"
config/icon="res://icon.png" config/icon="res://icon.png"
[autoload]
UserValues="*res://user_values.gd"
[gui] [gui]
theme/use_hidpi=true theme/use_hidpi=true

16
godot/start_menu.gd Normal file
View File

@ -0,0 +1,16 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var user_info = get_node("/root/UserValues")
# Called when the node enters the scene tree for the first time.
func _ready():
$welcome_title.text = "Good morning " + user_info.user_first_name + "!"
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -1,21 +0,0 @@
using Godot;
using System;
public class start_screen : Node2D
{
// Declare member variables here. Examples:
// private int a = 2;
// private string b = "text";
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// // Called every frame. 'delta' is the elapsed time since the previous frame.
// public override void _Process(float delta)
// {
//
// }
}

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://start_screen.cs" type="Script" id=1] [ext_resource path="res://main_screen.gd" type="Script" id=1]
[ext_resource path="res://button_open_github.gd" type="Script" id=2] [ext_resource path="res://button_open_github.gd" type="Script" id=2]
[ext_resource path="res://button_email_feedback.gd" type="Script" id=3] [ext_resource path="res://button_email_feedback.gd" type="Script" id=3]
[ext_resource path="res://initialising.gd" type="Script" id=4] [ext_resource path="res://start_menu.gd" type="Script" id=4]
[ext_resource path="res://button_name.gd" type="Script" id=5] [ext_resource path="res://button_name.gd" type="Script" id=5]
[ext_resource path="res://button_user_save.gd" type="Script" id=6]
[node name="main_screen" type="Node2D"] [node name="main_screen" type="Node2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )
@ -13,6 +14,7 @@ __meta__ = {
} }
[node name="start_menu" type="Node2D" parent="."] [node name="start_menu" type="Node2D" parent="."]
visible = false
script = ExtResource( 4 ) script = ExtResource( 4 )
[node name="button_daily_action" type="Button" parent="start_menu"] [node name="button_daily_action" type="Button" parent="start_menu"]
@ -56,15 +58,29 @@ text = "Name"
script = ExtResource( 5 ) script = ExtResource( 5 )
[node name="user_details" type="Node2D" parent="."] [node name="user_details" type="Node2D" parent="."]
visible = false
[node name="Button" type="Button" parent="user_details"] [node name="button_user_ok" type="Button" parent="user_details"]
margin_left = 444.0 margin_left = 444.0
margin_top = 279.0 margin_top = 279.0
margin_right = 500.0 margin_right = 500.0
margin_bottom = 316.0 margin_bottom = 316.0
text = "OK" text = "OK"
[node name="button_user_save" type="Button" parent="user_details"]
margin_left = 540.0
margin_top = 280.0
margin_right = 615.0
margin_bottom = 317.0
text = "Save"
script = ExtResource( 6 )
[node name="textbox_user_name" type="LineEdit" parent="user_details"]
margin_left = 244.0
margin_top = 205.0
margin_right = 794.0
margin_bottom = 250.0
[connection signal="pressed" from="start_menu/button_open_github" to="start_menu/button_open_github" method="_on_button_open_github_pressed"] [connection signal="pressed" from="start_menu/button_open_github" to="start_menu/button_open_github" method="_on_button_open_github_pressed"]
[connection signal="pressed" from="start_menu/button_email_feedback" to="start_menu/button_email_feedback" method="_on_button_email_feedback_pressed"] [connection signal="pressed" from="start_menu/button_email_feedback" to="start_menu/button_email_feedback" method="_on_button_email_feedback_pressed"]
[connection signal="pressed" from="start_menu/button_name" to="start_menu/button_name" method="_on_button_name_pressed"] [connection signal="pressed" from="start_menu/button_name" to="start_menu/button_name" method="_on_button_name_pressed"]
[connection signal="pressed" from="user_details/button_user_save" to="user_details/button_user_save" method="_on_button_user_save_pressed"]

View File

@ -1,4 +1,4 @@
extends Node2D extends Node
# Declare member variables here. Examples: # Declare member variables here. Examples:
@ -6,10 +6,9 @@ extends Node2D
# var b = "text" # var b = "text"
var user_first_name = "No name" var user_first_name = "No name"
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
$welcome_title.text = "Good morning " + user_first_name + "!" pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.