diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/But_MoreOptions.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/But_MoreOptions.gd new file mode 100644 index 0000000..227136c --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/But_MoreOptions.gd @@ -0,0 +1,25 @@ +#But_MoreOptions: +# For these options, we leave the game object active and manually add and remove +# the scenes as needed. + +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_MoreOptions_button_up(): + var root = get_node("/root") + var gameCurrent = get_node("/root/Game") + var gameSingleton = get_node("/root/GameCurrent") + var nextScene = load(next_scene_path) + + gameSingleton.gameCurrent_scene = gameCurrent + root.remove_child(gameCurrent) + nextScene = nextScene.instance() + root.add_child(nextScene) + + +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/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.gd index b6382db..46f0037 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.gd +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.gd @@ -12,8 +12,6 @@ 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_on= $Background/MarginContainer/Rows/ItemList/But_History 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 @@ -31,9 +29,6 @@ func _ready() -> void: #DKM TEMP: for testing only -- this will be set in settings save_module() theme=load("res://assets/ui_controlNode_dark_theme.tres") - history_pager.hide() - history_rows.hide() - history_on.hide() current_text.show() option_one.show() option_two.show() @@ -66,17 +61,19 @@ func create_response(response_text: String): #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) + add_response_to_history(response) if(current_text.get_child_count() > 0): current_text.remove_child(current_text.get_child(0)) current_text.add_child(response) +func add_response_to_history(response: Control) -> void: + #DKM TEMP: so here we + #1. var response_history = response.duplicate() + #2. get the history array from the singleton, + #3. Add this to the history array + # + pass + func _on_option1_button_down() -> void: var option1 = get_node("Background/MarginContainer/Rows/InputArea/VBoxContainer/option1") diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.tscn b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.tscn index a406848..ee11388 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.tscn +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/gamePlay/Game.tscn @@ -1,14 +1,11 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=8 format=2] -[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1] [ext_resource path="res://gamePlay/Game.gd" type="Script" id=2] [ext_resource path="res://assets/ui_controlNode_dark_theme.tres" type="Theme" id=3] [ext_resource path="res://gamePlay/CommandProcessor.gd" type="Script" id=4] [ext_resource path="res://userInterface/Locale.tscn" type="PackedScene" id=5] [ext_resource path="res://gamePlay/LocaleManager.gd" type="Script" id=6] -[ext_resource path="res://userInterface/But_History.gd" type="Script" id=7] -[ext_resource path="res://userInterface/But_History_Page.gd" type="Script" id=8] -[ext_resource path="res://_toArchive/ui_gameplay_theme.tres" type="Theme" id=10] +[ext_resource path="res://gamePlay/But_MoreOptions.gd" type="Script" id=9] [ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=11] [node name="Game" type="Control"] @@ -115,36 +112,16 @@ margin_right = 708.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 = 135.0 -margin_bottom = 30.0 -theme = ExtResource( 10 ) +[node name="But_MoreOptions" type="Button" parent="Background/MarginContainer/Rows/ItemList"] +margin_right = 170.0 +margin_bottom = 36.0 text = "More Options" +script = ExtResource( 9 ) +__meta__ = { +"_edit_use_anchors_": false +} next_scene_path = "res://Screens/MoreOptions.tscn" -[node name="But_History" type="Button" parent="Background/MarginContainer/Rows/ItemList"] -margin_left = 148.756 -margin_right = 273.756 -margin_bottom = 30.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 = 30.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 = 708.0 @@ -160,15 +137,6 @@ size_flags_horizontal = 3 size_flags_vertical = 3 custom_constants/separation = 20 -[node name="HistoryRows" type="VBoxContainer" parent="Background/MarginContainer/Rows/GameInfo"] -margin_left = 1.0 -margin_top = 1.0 -margin_right = 707.0 -margin_bottom = 387.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -custom_constants/separation = 20 - [node name="InputArea" type="PanelContainer" parent="Background/MarginContainer/Rows"] margin_top = 448.0 margin_right = 708.0 @@ -309,8 +277,7 @@ __meta__ = { "_edit_use_anchors_": false } -[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_up" from="Background/MarginContainer/Rows/ItemList/But_MoreOptions" to="Background/MarginContainer/Rows/ItemList/But_MoreOptions" method="_on_But_MoreOptions_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/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/gameCurrent.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/gameCurrent.gd new file mode 100644 index 0000000..cbb8d02 --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/gameCurrent.gd @@ -0,0 +1,10 @@ +#gameCurrent: +# Simple singleton script for storing persistent game cene paths. +# These must then not be destroyed, but manually removed as a child of the +# node and they can always be re-added as needed. + +extends Node + +var gameCurrent_scene + + diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/project.godot b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/project.godot index cee32bf..9ff3098 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/project.godot +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/project.godot @@ -40,6 +40,7 @@ config/icon="res://icon.png" History="*res://globalScripts/history.gd" PlayerCharacter="*res://globalScripts/PlayerCharacter.gd" +GameCurrent="*res://globalScripts/gameCurrent.gd" [physics] diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/MoreOptions.tscn b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/MoreOptions.tscn index 9d81f30..5d8d51b 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/MoreOptions.tscn +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/MoreOptions.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1] [ext_resource path="res://screens/MoreOptions.gd" type="Script" id=2] +[ext_resource path="res://userInterface/But_ResumeGame.gd" type="Script" id=3] [ext_resource path="res://assets/ui_controlNode_dark_theme.tres" type="Theme" id=6] [node name="MoreOptions" type="Control"] @@ -34,28 +35,31 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="But_ResumeGame" parent="VBoxContainer" instance=ExtResource( 1 )] +[node name="But_ResumeGame" type="Button" parent="VBoxContainer"] margin_right = 238.0 -margin_bottom = 73.0 +margin_bottom = 36.0 text = "Resume Game" -next_scene_path = "res://gamePlay/Game.tscn" +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} [node name="But_ShowHistory" parent="VBoxContainer" instance=ExtResource( 1 )] -margin_top = 77.0 +margin_top = 40.0 margin_right = 238.0 -margin_bottom = 150.0 +margin_bottom = 125.0 text = "Show History" -next_scene_path = "res://gamePlay/Game.tscn" +next_scene_path = "res://screens/MenuScreen.tscn" [node name="But_Chat" parent="VBoxContainer" instance=ExtResource( 1 )] -margin_top = 154.0 +margin_top = 129.0 margin_right = 238.0 -margin_bottom = 227.0 +margin_bottom = 214.0 text = "Chat" -next_scene_path = "res://Screens/MenuScreen.tscn" +next_scene_path = "res://screens/MenuScreen.tscn" [node name="But_MainMenu" parent="VBoxContainer" instance=ExtResource( 1 )] -margin_top = 231.0 +margin_top = 218.0 margin_right = 238.0 margin_bottom = 304.0 text = "Main Menu" @@ -74,3 +78,5 @@ text = "Version: 0.0.0" __meta__ = { "_edit_use_anchors_": false } + +[connection signal="button_up" from="VBoxContainer/But_ResumeGame" to="VBoxContainer/But_ResumeGame" method="_on_But_ResumeGame_button_up"] diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/userInterface/But_ResumeGame.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/userInterface/But_ResumeGame.gd new file mode 100644 index 0000000..9d21fcd --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/userInterface/But_ResumeGame.gd @@ -0,0 +1,13 @@ +tool +extends Button + + +func _on_But_ResumeGame_button_up(): + var root = get_node("/root") + var thisScene = get_node("/root/MoreOptions") + var gameSingleton = get_node("/root/GameCurrent") + var gameScene = gameSingleton.gameCurrent_scene + root.remove_child(thisScene) + thisScene.queue_free() + root.add_child(gameScene) +