BCIRPG Menu

The following changes done here:
1. Stripped down to the main menu, and that pushed as erpg\Godot\MainMenu\GodotUserInterface_Doug bcirpg_mainMenu_[date]

2. Relocated all other project work to: erpg\Godot\Experiments\Doug\
This commit is contained in:
MacDugRPG
2022-02-20 14:33:15 -05:00
parent 4637338b87
commit ef5c824b00
239 changed files with 685 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#Tool lets you any code in editor, such as plugins
tool
extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = ""
func _on_But_NewGame_button_up():
get_tree().change_scene(next_scene_path)
func _get_configuration_warning() -> String:
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=1]
[node name="But_ChangeScene" type="Button"]
margin_right = 130.0
margin_bottom = 24.0
size_flags_vertical = 3
text = "New Game"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_up" from="." to="." method="_on_But_NewGame_button_up"]

View File

@ -0,0 +1,6 @@
extends Button
func _on_But_Quit_button_up():
get_tree().quit()

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_Quit.gd" type="Script" id=1]
[node name="But_Quit" type="Button"]
margin_top = 240.0
margin_right = 179.0
margin_bottom = 284.0
text = "Quit"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_up" from="." to="." method="_on_But_Quit_button_up"]

View File

@ -0,0 +1,64 @@
#Script for settings save button
#Tool lets you any code in editor, such as plugins
tool
extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = ""
#Button response: save settings and move on.
func _on_But_NewGame_button_up():
var inputName = get_node("../../VBoxContainer/HBoxContainer/input_name")
var inputRisk = get_node("../../VBoxContainer/HBoxContainer2/input_risk")
_saveSettings(inputName.text, inputRisk.text)
get_tree().change_scene(next_scene_path)
#HELPER FUNCTIONS:
func _get_configuration_warning() -> String:
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""
func _saveSettings(inputSettings : String, riskFactor : String) -> void:
var player_settings = get_node("/root/PlayerSettings")
player_settings.playerSettingsSingleton.inputName = inputSettings
player_settings.playerSettingsSingleton.riskFactor = riskFactor
#Temp:
var temp_manual_JSON = {
"playerSettingsTemplate": {
"inputName": inputSettings,
"riskFactor": riskFactor
}
}
#Save to file (JSON for now)
var settings_file = "user://testPlayerSettings.sav"
var file = File.new()
if file.open(settings_file, File.WRITE) != 0:
print("Cannot write temporary file to: " + settings_file)
else:
file.store_line(to_json(temp_manual_JSON))
file.close()
#****This save Settings functions as designed; but modified to work with alternate approach of loading
#func _saveSettings(inputSettings : String, riskFactor : String) -> void:
#Debugging:
# print("Input name: " + inputSettings + "; and risk factor set to : " + riskFactor)
# var player_settings = get_node("/root/PlayerSettings")
# player_settings.playerSettingsSingleton.inputName = inputSettings
# player_settings.playerSettingsSingleton.riskFactor = riskFactor
#Save to file (for now)
# if settings_save_file_name == "":
# settings_save_file_name = "settings.save"
# var settings_file = "user://" + settings_save_file_name
# var file = File.new()
# file.open(settings_file, File.WRITE)
# file.store_var(player_settings.playerSettingsSingleton.inputName)
#DKM TEMP: To save object; removed for testing
#file.store_var(player_settings.playerSettingsSingleton, true)
# file.close()

View File

@ -0,0 +1,5 @@
extends VBoxContainer
func set_text(input: String, response: String):
$InputHistory.text = input
$Response.text = response

View File

@ -0,0 +1,27 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/base_dynamicfont_16.tres" type="DynamicFont" id=1]
[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=2]
[ext_resource path="res://UserInterface/InputResponse.gd" type="Script" id=3]
[node name="InputResponse" type="VBoxContainer"]
margin_right = 984.0
margin_bottom = 68.0
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="InputHistory" type="Label" parent="."]
margin_right = 984.0
margin_bottom = 26.0
custom_fonts/font = ExtResource( 1 )
custom_colors/font_color = Color( 0.686275, 0.658824, 0.658824, 1 )
text = " > This is what user selected"
[node name="Response" type="Label" parent="."]
margin_top = 30.0
margin_right = 984.0
margin_bottom = 68.0
custom_fonts/font = ExtResource( 2 )
text = "Game text continues here... "

View File

@ -0,0 +1,17 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/base_dynamicFont_BIG.tres" type="DynamicFont" id=1]
[node name="Title" type="Label"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -110.5
margin_top = 114.422
margin_right = 110.5
margin_bottom = 180.422
custom_fonts/font = ExtResource( 1 )
text = "Main Menu"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}