diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.md5 b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.md5 new file mode 100644 index 0000000..5719088 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.md5 @@ -0,0 +1,3 @@ +source_md5="266f789a4e895911161321092c2c2429" +dest_md5="a08a6dcf169f683724bfd5cd82e23fe6" + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex new file mode 100644 index 0000000..fffc668 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 new file mode 100644 index 0000000..7b61c3e --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 @@ -0,0 +1,3 @@ +source_md5="47313fa4c47a9963fddd764e1ec6e4a8" +dest_md5="2ded9e7f9060e2b530aab678b135fc5b" + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex new file mode 100644 index 0000000..3ca6461 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/But_History.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/But_History.gd new file mode 100644 index 0000000..6406e14 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/But_History.gd @@ -0,0 +1,39 @@ +#BUT_HISTORY: +# Unique script attached to the But_History to hide/show history versus +# current game page. + +tool +extends Button + +onready var game_history_array = get_node("/root/History").historyScreensSingleton.output_history_array + +var is_history = false + + +func _on_But_History_button_up(): + var history_pager_button = get_node("../../ItemList/But_History_Page") + var history_rows_node = get_node("../../GameInfo/HistoryRows") + var current_text_node = get_node("../../GameInfo/CurrentText") + var option_one = get_node("../../InputArea/VBoxContainer/option1") + var option_two = get_node("../../InputArea/VBoxContainer/option2") + var option_three = get_node("../../InputArea/VBoxContainer/option3") + + if(!is_history): + if(game_history_array != null): + history_rows_node.add_child(game_history_array[0]) + history_pager_button.show() + history_rows_node.show() + current_text_node.hide() + option_one.hide() + option_two.hide() + option_three.hide() + is_history = true + else: + history_pager_button.hide() + history_rows_node.hide() + current_text_node.show() + option_one.show() + option_two.show() + option_three.show() + is_history = false + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/But_History_Page.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/But_History_Page.gd new file mode 100644 index 0000000..136da2e --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/But_History_Page.gd @@ -0,0 +1,22 @@ +#BUT_HISTORY_PAGE: +# Unique paging script for showing next page in the history game's history +# array. + + +tool +extends Button + +onready var game_history_array = get_node("/root/History").historyScreensSingleton.output_history_array + +var current_page = 0 + +func _on_But_History_Page_button_up(): + var history_rows_node = get_node("../../GameInfo/HistoryRows") + if(current_page < game_history_array.size()-1): + current_page += 1 + else: + current_page = 0 + history_rows_node.remove_child(history_rows_node.get_child(0)) + history_rows_node.add_child(game_history_array[current_page]) + + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/CommandProcessor.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/CommandProcessor.gd new file mode 100644 index 0000000..3804dfd --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/CommandProcessor.gd @@ -0,0 +1,72 @@ +#COMMAND PROCESSOR: +# Handles player input, including navigation on the map + +extends Node + + +var current_locale = null +var current_opt1 = null +var current_opt2 = null +var current_opt3 = null + +#Allows us to pass in the starting location +func initialize(starting_locale) -> String: + current_opt1 = get_node("../Background/MarginContainer/Rows/InputArea/VBoxContainer/option1") + current_opt2 = get_node("../Background/MarginContainer/Rows/InputArea/VBoxContainer/option2") + current_opt3 = get_node("../Background/MarginContainer/Rows/InputArea/VBoxContainer/option3") + + current_opt1.grab_focus() + return change_room(starting_locale) + +#DKM TEMP: this must load from files written by toolset +#Function that loads response from the option string chosen +func process_command(option: String) -> String: + var optCmd_Action = option.split(": ", false) + if (optCmd_Action.size() < 2): + return "Error: no valid command and action in option!" + match optCmd_Action[0]: + "Go": + return go(optCmd_Action[1]) + "Wait": + return "You rest a bit. Now what?" + "Talk": + return talk(optCmd_Action[1]) + "Examine": + return examine(optCmd_Action[1]) + "Scream": + return "You yell :'" + optCmd_Action[1].to_upper() +"'!!" + _: + return "Nothing happens! Command word was: " + optCmd_Action[0] + + + +func go(action: String) -> String: + var destination = action.split(" ", false)[0] + if current_locale.exits.keys().has(destination): + var change_response = change_room(current_locale.exits[destination]) + return PoolStringArray(["You go %s." % destination, change_response]).join("\n") + else: + return "That is not a valid place to go!" + +#DKM TEMP: do an examination dictionary lookup here? +func examine(action: String) -> String: + return action.to_upper() + " looks about how you'd expect. [Dictionary lookup forthcoming]" + +#DKM TEMP: dialog entry needed -- temp +func talk(action: String) -> String: + var target = action.split("to ", false)[0].to_upper() + return target + " has little to say! [Dialog forthcoming]" + +#Helper: +func change_room(new_room: Locale) -> String: + current_locale = new_room + current_opt1.text = new_room.option1 + current_opt2.text = new_room.option2 + current_opt3.text = new_room.option3 + var exit_string = PoolStringArray(new_room.exits.keys()).join(" ") + var strings = PoolStringArray([ + "You are now in: " + new_room.locale_name + ". " + + new_room.locale_description, + "Exits: " + exit_string + ]).join("\n") + return strings; diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Control.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Control.tscn new file mode 100644 index 0000000..00a6290 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Control.tscn @@ -0,0 +1,5 @@ +[gd_scene format=2] + +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Game.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Game.gd new file mode 100644 index 0000000..3475548 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Game.gd @@ -0,0 +1,80 @@ +#GAME: +# Controls output space, loading descriptions and options for each locale and +# appending to the history array. + +extends Control + +onready var history_source = get_node("/root/History").historyScreensSingleton + +#Abstract class we instance when wanted in game as child of HistoryReference +const TextOutput = preload("res://UserInterface/Response.tscn") +const InputResponse = preload("res://UserInterface/InputResponse.tscn") + + +onready var command_processor = $CommandProcessor +onready var current_text = $Background/MarginContainer/Rows/GameInfo/CurrentText +onready var history_rows = $Background/MarginContainer/Rows/GameInfo/HistoryRows +onready var history_pager = $Background/MarginContainer/Rows/ItemList/But_History_Page +onready var locale_manager = $LocaleManager +onready var option_one = $Background/MarginContainer/Rows/InputArea/VBoxContainer/option1 +onready var option_two= $Background/MarginContainer/Rows/InputArea/VBoxContainer/option2 +onready var option_three = $Background/MarginContainer/Rows/InputArea/VBoxContainer/option3 + + +func _ready() -> void: + history_pager.hide() + history_rows.hide() + current_text.show() + option_one.show() + option_two.show() + option_three.show() + + var opening_text = "The game has begun! You can select from the available options below. " + #create_response("The game has begun! You can select from the available options below.") + + var starting_locale_response = command_processor.initialize(locale_manager.get_child(0)) + create_response(opening_text + " " + starting_locale_response) + +#Below temporarily takes user selection and appends it to responses; adding new instances +# of our input row with an input and response pair for each +func handleUserInput(user_choice: String) -> void: + var input_response = InputResponse.instance() + var inputText = "User selected: " + user_choice + var response = command_processor.process_command(user_choice) + input_response.set_text(inputText, response) + add_response_to_game(input_response) + +#Handles input text +func create_response(response_text: String): + var response = TextOutput.instance() + response.text = response_text + add_response_to_game(response) + +#Copies the response output to add to both current game output, and the +# history array. +func add_response_to_game(response: Control): + var response_history = response.duplicate() + + #DKM TEMP: stopped here, trying to add page number to history text + #var history_page_number = HISTORY_SOURCE.output_history_array.size() + 1 + #var history_string = "Page " + str(history_page_number) + "; " + if(history_source.output_history_array != null): + history_source.output_history_array.append(response_history) + if(current_text.get_child_count() > 0): + current_text.remove_child(current_text.get_child(0)) + current_text.add_child(response) + + +func _on_option1_button_down() -> void: + var option1 = get_node("Background/MarginContainer/Rows/InputArea/VBoxContainer/option1") + handleUserInput(option1.get_text()) + + +func _on_option2_button_down() -> void: + var option2 = get_node("Background/MarginContainer/Rows/InputArea/VBoxContainer/option2") + handleUserInput(option2.get_text()) + + +func _on_option3_button_down() -> void: + var option3 = get_node("Background/MarginContainer/Rows/InputArea/VBoxContainer/option3") + handleUserInput(option3.get_text()) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Game.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Game.tscn new file mode 100644 index 0000000..29aff62 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Game.tscn @@ -0,0 +1,227 @@ +[gd_scene load_steps=14 format=2] + +[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1] +[ext_resource path="res://Game.gd" type="Script" id=2] +[ext_resource path="res://CommandProcessor.gd" type="Script" id=4] +[ext_resource path="res://Locale.tscn" type="PackedScene" id=5] +[ext_resource path="res://LocaleManager.gd" type="Script" id=6] +[ext_resource path="res://But_History.gd" type="Script" id=7] +[ext_resource path="res://But_History_Page.gd" type="Script" id=8] +[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=9] +[ext_resource path="res://assets/ui_gameplay_theme.tres" type="Theme" id=10] +[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=11] + +[sub_resource type="StyleBoxFlat" id=1] +bg_color = Color( 0.117647, 0.117647, 0.117647, 1 ) + +[sub_resource type="StyleBoxFlat" id=2] +bg_color = Color( 0.243137, 0.235294, 0.235294, 1 ) + +[sub_resource type="StyleBoxFlat" id=3] +bg_color = Color( 0.286275, 0.286275, 0.286275, 1 ) + +[node name="Game" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CommandProcessor" type="Node" parent="."] +script = ExtResource( 4 ) + +[node name="LocaleManager" type="Node" parent="."] +script = ExtResource( 6 ) + +[node name="Loc_Boat" parent="LocaleManager" instance=ExtResource( 5 )] +margin_left = 41.38 +margin_top = -513.913 +margin_right = 291.381 +margin_bottom = -313.913 +locale_name = "a boat" +locale_description = "You have been shipwrecked." +option1 = "Go: east off the boat" +option2 = "Examine: this boat" +option3 = "Wait: a while" + +[node name="Loc_Shore" parent="LocaleManager" instance=ExtResource( 5 )] +margin_left = 509.38 +margin_top = -512.913 +margin_right = 759.381 +margin_bottom = -312.913 +locale_name = "the beach outside the wrecked ship" +locale_description = "You are standing on a white sand beach beside the crashing waves. You can go west, back onto the boat, or go north into the woods." +option1 = "Go: west to boat" +option2 = "Go: north to woods" +option3 = "Talk: to yourself" + +[node name="Loc_WoodsA1" parent="LocaleManager" instance=ExtResource( 5 )] +margin_left = 510.439 +margin_top = -806.384 +margin_right = 760.44 +margin_bottom = -606.384 +locale_name = "the island woods" +locale_description = "These woods get thick!" +option1 = "Go: south back to the beach" +option2 = "Go: north deeper in" +option3 = "Scream: for help" + +[node name="Loc_WoodsA2" parent="LocaleManager" instance=ExtResource( 5 )] +margin_left = 509.439 +margin_top = -1083.38 +margin_right = 759.44 +margin_bottom = -883.384 +locale_name = "deeper into the woods" +locale_description = "The woods are very thick. You feel like someone -- or something, may be watching you." +option1 = "Go: south back in the direction of the beach" +option2 = "Go: east into the thicket" +option3 = "Examine: the woods" + +[node name="Loc_WoodsA3" parent="LocaleManager" instance=ExtResource( 5 )] +margin_left = 882.439 +margin_top = -1084.38 +margin_right = 1132.44 +margin_bottom = -884.38 +locale_name = "a clearing" +locale_description = "There is a clearing here in the woods. You hear strange sounds, and musics. Something skitters north into the woods" +option1 = "Go: north after the creature" +option2 = "Go: west back into the thicket" +option3 = "Listen: to the sounds" + +[node name="Loc_WoodsA4" parent="LocaleManager" instance=ExtResource( 5 )] +margin_left = 878.439 +margin_top = -1361.38 +margin_right = 1128.44 +margin_bottom = -1161.38 +locale_name = "a cliff top" +locale_description = "The strange animal darts through and vanishes in front of you. There is a serious drop off here, plunging a long ways to rocks below. A figure moves along the rocks, moaning and cursing, grumpily." +option1 = "Go: south back to the clearing " +option2 = "Talk: to the grumpy figure" +option3 = "Examine: the grumpy figure" + +[node name="Background" type="PanelContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +custom_styles/panel = SubResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="Background"] +margin_right = 1024.0 +margin_bottom = 600.0 +custom_constants/margin_right = 20 +custom_constants/margin_top = 10 +custom_constants/margin_left = 20 +custom_constants/margin_bottom = 20 + +[node name="Rows" type="VBoxContainer" parent="Background/MarginContainer"] +margin_left = 20.0 +margin_top = 10.0 +margin_right = 1004.0 +margin_bottom = 580.0 +custom_constants/separation = 10 + +[node name="ItemList" type="ItemList" parent="Background/MarginContainer/Rows"] +margin_right = 984.0 +margin_bottom = 40.0 +rect_min_size = Vector2( 0, 40 ) + +[node name="But_ChangeScene" parent="Background/MarginContainer/Rows/ItemList" instance=ExtResource( 1 )] +margin_right = 82.0 +margin_bottom = 30.0 +theme = ExtResource( 10 ) +text = "Menu" +next_scene_path = "res://Screens/MenuScreen.tscn" + +[node name="But_History" type="Button" parent="Background/MarginContainer/Rows/ItemList"] +margin_left = 96.0 +margin_right = 167.0 +margin_bottom = 33.0 +theme = ExtResource( 10 ) +text = "Toggle History" +script = ExtResource( 7 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="But_History_Page" type="Button" parent="Background/MarginContainer/Rows/ItemList"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -103.0 +margin_bottom = 33.0 +theme = ExtResource( 10 ) +text = "Next Page" +script = ExtResource( 8 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="GameInfo" type="PanelContainer" parent="Background/MarginContainer/Rows"] +margin_top = 50.0 +margin_right = 984.0 +margin_bottom = 430.0 +size_flags_vertical = 3 +theme = ExtResource( 9 ) +custom_styles/panel = SubResource( 2 ) + +[node name="CurrentText" type="VBoxContainer" parent="Background/MarginContainer/Rows/GameInfo"] +margin_right = 984.0 +margin_bottom = 380.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme = ExtResource( 9 ) +custom_constants/separation = 20 + +[node name="HistoryRows" type="VBoxContainer" parent="Background/MarginContainer/Rows/GameInfo"] +margin_right = 984.0 +margin_bottom = 380.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/separation = 20 + +[node name="InputArea" type="PanelContainer" parent="Background/MarginContainer/Rows"] +margin_top = 440.0 +margin_right = 984.0 +margin_bottom = 570.0 +rect_min_size = Vector2( 0, 120 ) +custom_styles/panel = SubResource( 3 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="Background/MarginContainer/Rows/InputArea"] +margin_right = 984.0 +margin_bottom = 130.0 +theme = ExtResource( 9 ) +custom_constants/separation = 5 + +[node name="option1" type="Button" parent="Background/MarginContainer/Rows/InputArea/VBoxContainer"] +margin_right = 984.0 +margin_bottom = 40.0 +theme = ExtResource( 9 ) +custom_fonts/font = ExtResource( 11 ) +text = "Option 1" +align = 0 + +[node name="option2" type="Button" parent="Background/MarginContainer/Rows/InputArea/VBoxContainer"] +margin_top = 45.0 +margin_right = 984.0 +margin_bottom = 85.0 +theme = ExtResource( 9 ) +custom_fonts/font = ExtResource( 11 ) +text = "Option 2" +align = 0 + +[node name="option3" type="Button" parent="Background/MarginContainer/Rows/InputArea/VBoxContainer"] +margin_top = 90.0 +margin_right = 984.0 +margin_bottom = 130.0 +theme = ExtResource( 9 ) +custom_fonts/font = ExtResource( 11 ) +text = "Option 3" +align = 0 + +[connection signal="button_up" from="Background/MarginContainer/Rows/ItemList/But_History" to="Background/MarginContainer/Rows/ItemList/But_History" method="_on_But_History_button_up"] +[connection signal="button_up" from="Background/MarginContainer/Rows/ItemList/But_History_Page" to="Background/MarginContainer/Rows/ItemList/But_History_Page" method="_on_But_History_Page_button_up"] +[connection signal="button_down" from="Background/MarginContainer/Rows/InputArea/VBoxContainer/option1" to="." method="_on_option1_button_down"] +[connection signal="button_down" from="Background/MarginContainer/Rows/InputArea/VBoxContainer/option2" to="." method="_on_option2_button_down"] +[connection signal="button_down" from="Background/MarginContainer/Rows/InputArea/VBoxContainer/option3" to="." method="_on_option3_button_down"] diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Locale.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Locale.gd new file mode 100644 index 0000000..850accd --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Locale.gd @@ -0,0 +1,49 @@ +#LOCALE CLASS: +# Template script for the Locale scene; allows for connecting exits, and also +# maintains a visited bool (currently un-used) and takes additional +# options via the GUI: +# 1. Name +# 2. Description +# 3. The 3 option strings available at the location +# + + +extends PanelContainer +#Allows Godot to handle autocomplete and 'register' class +class_name Locale + +export (String) var locale_name = "Location Name" +export (String) var locale_description = "This is the description of the location." + +#DKM TEMP: assuming this gets set here +export (String) var option1 = "Option 1" +export (String) var option2 = "Option 2" +export (String) var option3 = "Option 3" + +var visited = false; + +var exits: Dictionary = {} + +#DKM TEMP: right now connects both directions, but can make an alt func that c +# connects just one way for example (for one-way-doors) +# currently not in use, but the override defaults false but if passed can let +# you apply custom direction +func connect_exit(direction: String, locale: Locale, override_direction: bool = false): + if(!override_direction): + match direction: + "west": + exits[direction] = locale + locale.exits["east"] = self + "east": + exits[direction] = locale + locale.exits["west"] = self + "north": + exits[direction] = locale + locale.exits["south"] = self + "south": + exits[direction] = locale + locale.exits["north"] = self + _: + printerr("Tried to connect invalid direction: %s", direction) + else: + exits[direction] = locale diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Locale.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Locale.tscn new file mode 100644 index 0000000..f59dd62 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Locale.tscn @@ -0,0 +1,42 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=1] +[ext_resource path="res://assets/base_dynamicfont_16.tres" type="DynamicFont" id=2] +[ext_resource path="res://Locale.gd" type="Script" id=3] +[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=4] + +[node name="Locale" type="PanelContainer"] +margin_right = 250.001 +margin_bottom = 200.0 +rect_min_size = Vector2( 250, 200 ) +theme = ExtResource( 4 ) +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="."] +margin_left = 7.0 +margin_top = 7.0 +margin_right = 243.001 +margin_bottom = 193.0 + +[node name="Rows" type="VBoxContainer" parent="MarginContainer"] +margin_right = 236.0 +margin_bottom = 186.0 +theme = ExtResource( 4 ) + +[node name="LocaleName" type="Label" parent="MarginContainer/Rows"] +margin_right = 236.0 +margin_bottom = 38.0 +custom_fonts/font = ExtResource( 1 ) +text = "Locale Name" +align = 1 + +[node name="LocaleDescription" type="Label" parent="MarginContainer/Rows"] +margin_top = 42.0 +margin_right = 236.0 +margin_bottom = 97.0 +custom_fonts/font = ExtResource( 2 ) +text = "This is the description text for the locale. " +autowrap = true diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/LocaleManager.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/LocaleManager.gd new file mode 100644 index 0000000..0917933 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/LocaleManager.gd @@ -0,0 +1,17 @@ +#LOCALE MANAGER: +# Temporary script holds connections between map items, using the two-way +# connect_exit script available on Location class to wire up map. + +extends Node + + +#DKM TEMP: must load from toolset +func _ready() -> void: + $Loc_Boat.connect_exit("east", $Loc_Shore) + $Loc_Shore.connect_exit("north", $Loc_WoodsA1) + $Loc_WoodsA1.connect_exit("north", $Loc_WoodsA2) + $Loc_WoodsA2.connect_exit("east", $Loc_WoodsA3) + $Loc_WoodsA3.connect_exit("north", $Loc_WoodsA4) + + + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/README.txt b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/README.txt new file mode 100644 index 0000000..005612b --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/README.txt @@ -0,0 +1,34 @@ +**************************** + README.TXT: +**************************** +Author: Doug McCord +Date: 30-Jan-2022 + +**************************** +Intro notes: + I created this to help explain the current Godot file structure I'm using. An + effort has been made to use a consistent organization, though it can most + definitely be improved/made more consistent. + +**************************** +Project file structure: + Surface Layer: + Game scripts are located at this level, included unique history scripts + and the Game.gd script itself. + _toArchive: + Directory to serve as reference-only; precursor to trash + + assets: + Images, fonts, TRES text resource data files + + globalScripts: + For project-wide use, or scripts that are not either: + A. attached to a template scene, intended to go with all instances of that, or + B. unique, scene-specific scripts. + + Screens: + Additional scenes that are not the main game; includes both .tscn scene files and + their associated scripts. + + UserInterface: (note misnomer for text-based game) + Re-useable UI elements and their scripts, such as change-scene, input-response diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/AddCharacter_temp.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/AddCharacter_temp.tscn new file mode 100644 index 0000000..6dbb14c --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/AddCharacter_temp.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1] +[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=2] + +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Title" parent="." instance=ExtResource( 1 )] +anchor_left = 0.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 0.0 +margin_top = 0.0 +margin_right = 0.0 +margin_bottom = 0.0 +text = "Add Character (temp)" + +[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )] +text = "Temp: back to menu" +next_scene_path = "res://Screens/MenuScreen.tscn" diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/LoadGame_temp.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/LoadGame_temp.tscn new file mode 100644 index 0000000..761fa78 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/LoadGame_temp.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1] + +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Title" parent="." instance=ExtResource( 1 )] +text = "Load game (temp)" diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/MenuScreen.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/MenuScreen.gd new file mode 100644 index 0000000..98fb1ca --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/MenuScreen.gd @@ -0,0 +1,9 @@ +#MENUSCREEN: +# Script purely to grab focus for tabbing control + +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + $VBoxContainer/But_NewGame.grab_focus() diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/MenuScreen.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/MenuScreen.tscn new file mode 100644 index 0000000..a9a76c3 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/MenuScreen.tscn @@ -0,0 +1,98 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1] +[ext_resource path="res://Screens/MenuScreen.gd" type="Script" id=2] +[ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=3] +[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=4] +[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=5] +[ext_resource path="res://assets/background_demo.png" type="Texture" id=7] +[ext_resource path="res://UserInterface/But_Quit.tscn" type="PackedScene" id=10] + +[node name="MenuScreen" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 4 ) +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="background_demo" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 7 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Title" parent="." instance=ExtResource( 5 )] +margin_top = 51.8676 +margin_bottom = 117.868 +custom_fonts/font = ExtResource( 3 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -119.0 +margin_top = -152.0 +margin_right = 119.0 +margin_bottom = 152.0 +rect_scale = Vector2( 1.04675, 1.07389 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="But_NewGame" parent="VBoxContainer" instance=ExtResource( 1 )] +margin_right = 238.0 +margin_bottom = 48.0 +next_scene_path = "res://Game.tscn" + +[node name="But_LoadGame" parent="VBoxContainer" instance=ExtResource( 1 )] +margin_top = 52.0 +margin_right = 238.0 +margin_bottom = 101.0 +text = "Load Game" +next_scene_path = "res://Game.tscn" + +[node name="But_Multiplayer" parent="VBoxContainer" instance=ExtResource( 1 )] +margin_top = 105.0 +margin_right = 238.0 +margin_bottom = 154.0 +text = "Multiplayer" +next_scene_path = "res://Screens/Multiplayer_temp.tscn" + +[node name="But_AddChar" parent="VBoxContainer" instance=ExtResource( 1 )] +margin_top = 158.0 +margin_right = 238.0 +margin_bottom = 207.0 +text = "Add Character" +next_scene_path = "res://Screens/AddCharacter_temp.tscn" + +[node name="But_Settings" parent="VBoxContainer" instance=ExtResource( 1 )] +margin_top = 211.0 +margin_right = 238.0 +margin_bottom = 259.0 +text = "Settings" +next_scene_path = "res://Screens/Settings.tscn" + +[node name="But_Quit" parent="VBoxContainer" instance=ExtResource( 10 )] +margin_top = 263.0 +margin_right = 238.0 +margin_bottom = 303.0 + +[node name="Version" type="Label" parent="."] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -177.0 +margin_top = -44.0 +margin_right = -5.0 +margin_bottom = -6.0 +text = "Version: 0.0.0" +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/Multiplayer_temp.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/Multiplayer_temp.tscn new file mode 100644 index 0000000..e4e4654 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/Multiplayer_temp.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1] +[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=2] + +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Title" parent="." instance=ExtResource( 1 )] +anchor_left = 0.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 0.0 +margin_top = 0.0 +margin_right = 0.0 +margin_bottom = 0.0 +text = "Multiplayer (temp)" + +[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )] +text = "Temp: back to menu" +next_scene_path = "res://Screens/MenuScreen.tscn" diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/NewGame_temp.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/NewGame_temp.tscn new file mode 100644 index 0000000..24626c0 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/NewGame_temp.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1] + +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="newGameTextTemp" parent="." instance=ExtResource( 1 )] +text = "Start new game (temp)" diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/Settings.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/Settings.tscn new file mode 100644 index 0000000..1e4dfb2 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/Settings.tscn @@ -0,0 +1,130 @@ +[gd_scene load_steps=10 format=2] + +[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1] +[ext_resource path="res://assets/background_demo.png" type="Texture" id=2] +[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=3] +[ext_resource path="res://assets/ui_title_theme.tres" type="Theme" id=4] +[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=5] +[ext_resource path="res://Screens/inputText.gd" type="Script" id=6] +[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=7] +[ext_resource path="res://UserInterface/But_SaveSettings.gd" type="Script" id=8] +[ext_resource path="res://Screens/SettingsInitialize.gd" type="Script" id=9] + +[node name="SettingsScreen" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 3 ) +script = ExtResource( 9 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="background_demo" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 2 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Title" parent="." instance=ExtResource( 1 )] +anchor_left = 0.0 +anchor_right = 0.0 +margin_left = 0.0 +margin_top = 0.0 +margin_right = 296.0 +margin_bottom = 135.0 +theme = ExtResource( 4 ) +text = " Player Settings +" + +[node name="Hbox_buttons" type="HBoxContainer" parent="."] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -426.0 +margin_top = -67.0 +grow_vertical = 0 +rect_scale = Vector2( 1.04675, 1.07389 ) +alignment = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="But_SaveSettings" parent="Hbox_buttons" instance=ExtResource( 5 )] +margin_right = 164.0 +margin_bottom = 67.0 +text = "Save Settings" +script = ExtResource( 8 ) +next_scene_path = "res://Screens/MenuScreen.tscn" + +[node name="But_CloseWithoutSaving" parent="Hbox_buttons" instance=ExtResource( 5 )] +margin_left = 168.0 +margin_right = 426.0 +margin_bottom = 67.0 +grow_horizontal = 0 +grow_vertical = 0 +text = "Close Without Saving" +next_scene_path = "res://Screens/MenuScreen.tscn" + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_top = 0.5 +anchor_bottom = 0.5 +margin_top = -187.879 +margin_right = 605.0 +margin_bottom = -115.879 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +margin_right = 605.0 +margin_bottom = 48.0 + +[node name="label_disName" type="Label" parent="VBoxContainer/HBoxContainer"] +margin_top = 5.0 +margin_right = 175.0 +margin_bottom = 43.0 +size_flags_horizontal = 2 +text = "Display Name: " +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="input_name" type="LineEdit" parent="VBoxContainer/HBoxContainer"] +margin_left = 304.0 +margin_right = 605.0 +margin_bottom = 48.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 7 ) +max_length = 48 +script = ExtResource( 6 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 52.0 +margin_right = 605.0 +margin_bottom = 100.0 + +[node name="label_risk" type="Label" parent="VBoxContainer/HBoxContainer2"] +margin_top = 5.0 +margin_right = 300.0 +margin_bottom = 43.0 +size_flags_horizontal = 3 +text = "Risk Factor Threshold: " +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="input_risk" type="LineEdit" parent="VBoxContainer/HBoxContainer2"] +margin_left = 304.0 +margin_right = 605.0 +margin_bottom = 48.0 +size_flags_horizontal = 3 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/SettingsInitialize.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/SettingsInitialize.gd new file mode 100644 index 0000000..f2452b4 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/SettingsInitialize.gd @@ -0,0 +1,17 @@ +#SETTINGSINITIALIZE: +# Temp: manual connector between the input fields and the player settings +# singleton. +# + +extends Control + +onready var psCurrentSettings = get_node("/root/PlayerSettings") + + +func _ready() -> void: + var inputName = get_node("VBoxContainer/HBoxContainer/input_name") + var inputRisk = get_node("VBoxContainer/HBoxContainer2/input_risk") + inputName.text = psCurrentSettings.playerSettingsSingleton.inputName + inputRisk.text = psCurrentSettings.playerSettingsSingleton.riskFactor + + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/inputText.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/inputText.gd new file mode 100644 index 0000000..3423fc2 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/Screens/inputText.gd @@ -0,0 +1,7 @@ +extends LineEdit + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + grab_focus() + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_ChangeScene.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_ChangeScene.gd new file mode 100644 index 0000000..08fb66d --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_ChangeScene.gd @@ -0,0 +1,17 @@ +#BUT_CHANGESCENE: +# Generic template script allowing GUI linking of scenes by button press. + +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 "" + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_ChangeScene.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_ChangeScene.tscn new file mode 100644 index 0000000..80849fc --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_ChangeScene.tscn @@ -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"] diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_Quit.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_Quit.gd new file mode 100644 index 0000000..e33d9a7 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_Quit.gd @@ -0,0 +1,34 @@ +#BUT_QUIT: +# Unique script for ending a game. Will additionally perform or call needed +# shut down and close-out functionality. + +extends Button + +var history_JSON = "user://history.json" + + +#DKM TEMP: save history is only here temporarily -- needs to move upstream. +func _on_But_Quit_button_up(): + get_tree().quit() + + +#JSON: requires dictionaries: +#func _saveHistory_JSON() -> void: +# var history_screens_arr = get_node("/root/History").historyScreensSingleton.output_history_array +# var file = File.new() +# file.open(history_JSON, File.WRITE) +# file.store_string(to_json(history_screens_arr)) +# +# file.close() +# # #DKM TEMP: +# print("Saved history array size should be: " + str(history_screens_arr.size())) + + +#DKM TEMP: +#tres file: +#func _saveHistory() -> void: +# var history_screens = get_node("/root/History").historyScreensSingleton +# assert(ResourceSaver.save("user://history.tres", history_screens)==OK) +# #DKM TEMP: +# print("Saved history array size: " + str(history_screens.output_history_array.size())) + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_Quit.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_Quit.tscn new file mode 100644 index 0000000..e52c053 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_Quit.tscn @@ -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"] diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_SaveSettings.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_SaveSettings.gd new file mode 100644 index 0000000..0b09f53 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/But_SaveSettings.gd @@ -0,0 +1,80 @@ +#BUT_SAVESETTINGS: +# Unique script for saving settings on player settings scene. + + +#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 "" + + +#CONFIG/INI SAVE: +func _saveSettings(inputSettings : String, riskFactor : String) -> void: + var player_settings = get_node("/root/PlayerSettings") + player_settings.playerSettingsSingleton.inputName = inputSettings + player_settings.playerSettingsSingleton.riskFactor = riskFactor + var config = ConfigFile.new() + + config.set_value("Temp player","InputSettings", inputSettings) + config.set_value("Temp player","RiskFactor", riskFactor) + + config.save("user://settings.cfg") + +#JSON SAVE: +#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() + + + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/InputResponse.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/InputResponse.gd new file mode 100644 index 0000000..87f2395 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/InputResponse.gd @@ -0,0 +1,5 @@ +extends VBoxContainer + +func set_text(input: String, response: String): + $InputHistory.text = input + $Response.text = response diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/InputResponse.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/InputResponse.tscn new file mode 100644 index 0000000..a0cafa6 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/InputResponse.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=1] +[ext_resource path="res://UserInterface/Response.tscn" type="PackedScene" 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 = 23.0 +custom_fonts/font = ExtResource( 1 ) +custom_colors/font_color = Color( 0.686275, 0.658824, 0.658824, 1 ) +text = " > This is what user selected" +autowrap = true + +[node name="Response" parent="." instance=ExtResource( 2 )] +margin_top = 27.0 +margin_bottom = 61.0 diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/Response.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/Response.tscn new file mode 100644 index 0000000..fa0fe9c --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/Response.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=1] +[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=2] + +[node name="Response" type="Label"] +margin_top = 30.0 +margin_right = 984.0 +margin_bottom = 68.0 +theme = ExtResource( 2 ) +custom_fonts/font = ExtResource( 1 ) +text = "Game text continues here... " +autowrap = true +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/Title.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/Title.tscn new file mode 100644 index 0000000..5b749bd --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/UserInterface/Title.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://assets/base_dynamicFont_BIG.tres" type="DynamicFont" id=1] +[ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=2] + +[sub_resource type="Theme" id=1] +default_font = ExtResource( 2 ) + +[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 +theme = SubResource( 1 ) +custom_fonts/font = ExtResource( 1 ) +text = "Main Menu" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_AddChar.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_AddChar.tscn new file mode 100644 index 0000000..c5514ca --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_AddChar.tscn @@ -0,0 +1,11 @@ +[gd_scene format=2] + +[node name="But_AddChar" type="Button"] +margin_top = 85.0 +margin_right = 130.0 +margin_bottom = 109.0 +size_flags_vertical = 3 +text = "Add Character" +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_LoadGame.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_LoadGame.tscn new file mode 100644 index 0000000..ae476e8 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_LoadGame.tscn @@ -0,0 +1,8 @@ +[gd_scene format=2] + +[node name="But_LoadGame" type="Button"] +margin_top = 28.0 +margin_right = 130.0 +margin_bottom = 52.0 +size_flags_vertical = 3 +text = "Load Game" diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_Multiplayer.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_Multiplayer.tscn new file mode 100644 index 0000000..a35b2e7 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_Multiplayer.tscn @@ -0,0 +1,11 @@ +[gd_scene format=2] + +[node name="But_Multiplayer" type="Button"] +margin_top = 56.0 +margin_right = 130.0 +margin_bottom = 81.0 +size_flags_vertical = 3 +text = "Multiplayer" +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_Settings.tscn b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_Settings.tscn new file mode 100644 index 0000000..b9c4528 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/But_Settings.tscn @@ -0,0 +1,8 @@ +[gd_scene format=2] + +[node name="But_Settings" type="Button"] +margin_top = 113.0 +margin_right = 130.0 +margin_bottom = 138.0 +size_flags_vertical = 3 +text = "Settings" diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/HistoryRows.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/HistoryRows.gd new file mode 100644 index 0000000..762145f --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/_toArchive/HistoryRows.gd @@ -0,0 +1,9 @@ +tool +extends Button + +onready var history_rows = $Background/MarginContainer/Rows/GameInfo/ScrollContainer/HistoryRows +onready var current_text = $Background/MarginContainer/Rows/GameInfo/CurrentText + +func _on_But_History_button_up(): + print("History button pressed - temp") + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Bold.ttf b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Bold.ttf new file mode 100644 index 0000000..db3d6f3 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Bold.ttf differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-BoldItalic.ttf b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-BoldItalic.ttf new file mode 100644 index 0000000..8b21277 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-BoldItalic.ttf differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Italic.ttf b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Italic.ttf new file mode 100644 index 0000000..768b833 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Italic.ttf differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Regular.ttf b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Regular.ttf new file mode 100644 index 0000000..6fa9a59 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/LiberationSerif-Regular.ttf differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/l_10646.ttf b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/l_10646.ttf new file mode 100644 index 0000000..afb1c60 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/Fonts_source/l_10646.ttf differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/background_demo.png b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/background_demo.png new file mode 100644 index 0000000..1ac5ed2 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/background_demo.png differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/background_demo.png.import b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/background_demo.png.import new file mode 100644 index 0000000..13364f0 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/background_demo.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/background_demo.png" +dest_files=[ "res://.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicFont_BIG.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicFont_BIG.tres new file mode 100644 index 0000000..a2e2de7 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicFont_BIG.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1] + +[resource] +size = 42 +font_data = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicfont.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicfont.tres new file mode 100644 index 0000000..63243b4 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicfont.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1] + +[resource] +size = 24 +font_data = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicfont_16.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicfont_16.tres new file mode 100644 index 0000000..f9acb20 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/base_dynamicfont_16.tres @@ -0,0 +1,6 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1] + +[resource] +font_data = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif.tres new file mode 100644 index 0000000..051bc09 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif.tres @@ -0,0 +1,6 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +font_data = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_20pt.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_20pt.tres new file mode 100644 index 0000000..2953618 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_20pt.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 20 +font_data = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_30pt.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_30pt.tres new file mode 100644 index 0000000..6297862 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_30pt.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 30 +font_data = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_40pt.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_40pt.tres new file mode 100644 index 0000000..229621e --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/liberation_serif_40pt.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/Fonts_source/LiberationSerif-Regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 40 +font_data = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_gameplay_big_theme.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_gameplay_big_theme.tres new file mode 100644 index 0000000..e0452b5 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_gameplay_big_theme.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=2] + +[ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=1] + +[resource] +default_font = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_gameplay_theme.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_gameplay_theme.tres new file mode 100644 index 0000000..e0452b5 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_gameplay_theme.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=2] + +[ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=1] + +[resource] +default_font = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_theme.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_theme.tres new file mode 100644 index 0000000..b388b3e --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_theme.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=2] + +[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=1] + +[resource] +default_font = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_title_theme.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_title_theme.tres new file mode 100644 index 0000000..a2584dc --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/assets/ui_title_theme.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=2] + +[ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=1] + +[resource] +default_font = ExtResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/default_env.tres b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/history.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/history.gd new file mode 100644 index 0000000..0fe7e5a --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/history.gd @@ -0,0 +1,31 @@ +#HISTORY: +# Unique handler script for root history singleton. May be adapted for +# history loading and saving functionality + +extends Node + + +#DKM TEMP: not a cfg? +var history_file = "user://history.tres" +var historyScreensSingleton +var testing = false + +func _ready() -> void: + if(testing): + historyScreensSingleton = load_history_file() + if (historyScreensSingleton == null): + historyScreensSingleton = HistoryScreensTemplateSingleton.new() + + #DKM temp: + print("Loaded history array size is: " + str(historyScreensSingleton.output_history_array.size())) + +#DKM TEMP: tres format: +func load_history_file() -> HistoryScreensTemplateSingleton: + if ResourceLoader.exists(history_file): + var history = ResourceLoader.load(history_file) + if history is HistoryScreensTemplateSingleton: + return history + else: return null + else: + return null + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/historyScreensTemplate.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/historyScreensTemplate.gd new file mode 100644 index 0000000..6ab536f --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/historyScreensTemplate.gd @@ -0,0 +1,8 @@ +#PLAYERSETTINGSTEMPLATE: +# Class for holding history screens +extends Resource + +class_name HistoryScreensTemplateSingleton + +var output_history_array = Array() + diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/playerSettings.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/playerSettings.gd new file mode 100644 index 0000000..cd24b68 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/playerSettings.gd @@ -0,0 +1,60 @@ +#PLAYER SETTINGS: +# Unique handler script for reading from file or saving to, using the +# playerSettingsTemplateSingleton object. + +extends Node + +#DKM TEMP: JSON: +#var settings_file = "user://testPlayerSettings.sav" + +#DKM TEMP: TO DO: constant: +var settings_file = "user://settings.cfg" +var playerSettingsSingleton = PlayerSettingsTemplate.new() + +func _ready() -> void: + load_settings_file() + + +#Config/ini: +func load_settings_file(): + var config = ConfigFile.new() + # Load data from a file. + var err = config.load(settings_file) + # If the file didn't load, ignore it. + if err != OK: + return + for player in config.get_sections(): + var inputName = config.get_value(player, "InputSettings") + var riskFactor = config.get_value(player, "RiskFactor") + + print("Input name loaded as: " + inputName) + + playerSettingsSingleton.inputName = inputName + playerSettingsSingleton.riskFactor = riskFactor + +#Using JSON: +#DKM TEMP: manual JSON parsing is most certainly not the way to go -- temp testing these +# are saved and loaded correctly. +#func load_settings_file(): +# var file = File.new() +# file.open(settings_file, file.READ) +# var text = file.get_as_text() +# var parsedText = parse_json(text) +# if(parsedText != null): +# print("Input name loaded as: " + parsedText.playerSettingsTemplate.inputName) +# playerSettingsSingleton.inputName = parsedText.playerSettingsTemplate.inputName +# playerSettingsSingleton.riskFactor = parsedText.playerSettingsTemplate.riskFactor +# else: +# print("No previously existing player settings file found") +# +#DKM TEMP: +#****THIS LOADS a string successfully, but not objects +#func _loadSettings() -> void: + #DKM TEMP: we cannot hard code this here and allow user access on But_SaveS UI +# var settings_file = "user://testSettings" +# var file = File.new() +# if file.file_exists(settings_file): +# file.open(settings_file, File.READ) +# playerSettingsSingleton.inputName = file.get_var() +# file.close() +# print("name found as: " + playerSettingsSingleton.inputName) diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/playerSettingsTemplate.gd b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/playerSettingsTemplate.gd new file mode 100644 index 0000000..58a99fc --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/globalScripts/playerSettingsTemplate.gd @@ -0,0 +1,8 @@ +#PLAYERSETTINGSTEMPLATE: +# Class for holding player settings for game purposes. + +extends Node +class_name PlayerSettingsTemplate + +var inputName = "None" +var riskFactor = "0" diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/icon.png b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/icon.png new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/icon.png differ diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/icon.png.import b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/project.godot b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/project.godot new file mode 100644 index 0000000..a7d9ba7 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Doug/rpgr_gameWork_20220213A/project.godot @@ -0,0 +1,50 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ { +"base": "Resource", +"class": "HistoryScreensTemplateSingleton", +"language": "GDScript", +"path": "res://globalScripts/historyScreensTemplate.gd" +}, { +"base": "PanelContainer", +"class": "Locale", +"language": "GDScript", +"path": "res://Locale.gd" +}, { +"base": "Node", +"class": "PlayerSettingsTemplate", +"language": "GDScript", +"path": "res://globalScripts/playerSettingsTemplate.gd" +} ] +_global_script_class_icons={ +"HistoryScreensTemplateSingleton": "", +"Locale": "", +"PlayerSettingsTemplate": "" +} + +[application] + +config/name="RPGR_moduleWork_22_0213A" +run/main_scene="res://Screens/MenuScreen.tscn" +config/icon="res://icon.png" + +[autoload] + +PlayerSettings="*res://globalScripts/playerSettings.gd" +History="*res://globalScripts/history.gd" + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +environment/default_environment="res://default_env.tres"