diff --git a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/But_StartNewGame.gd b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/But_StartNewGame.gd new file mode 100644 index 0000000..d402870 --- /dev/null +++ b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/But_StartNewGame.gd @@ -0,0 +1,28 @@ +#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: = "" + +onready var pSingleton = get_node("/root/PlayerCharacter").pc + +var tempToggle = 0 + +func _on_But_NewGame_button_up(): + if(pSingleton.pcText.length() < 1): + #print("GOT IT! Popup msg: " + $PopupDialog/WarnText.text) + var alertPopup = get_node("../../PopupDialog") + var alertPopupText = get_node("../../PopupDialog/WarnText") + alertPopupText.text = "No player was loaded! Please load a character to begin game." + alertPopup.popup_centered() + return + else: + var _changeResponse = 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/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.gd b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.gd index bc9d1b2..dd12d54 100644 --- a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.gd +++ b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.gd @@ -5,6 +5,7 @@ extends Control onready var settings = get_node("/root/GlobalSaveInstance").settingsInstance +onready var pSingleton = get_node("/root/PlayerCharacter").pc func _ready() -> void: theme=load(settings.themeFile) @@ -13,10 +14,16 @@ func _ready() -> void: func _on_But_SaveChar_pressed() -> void: $Title/FileDialog.popup() -#DKM TEMP: just text for now from text edit +#DKM TEMP: this code was inherited and it needs pretty substantial +# overhaul for use in the module, depending on toolset use. +# For now all the labels are individual lineEdits we need to grab. func _on_FileDialog_file_selected(path: String) -> void: var pc = get_node("/root/PlayerCharacter") var newCharFile = File.new() newCharFile.open(path, 2) - newCharFile.store_string($TextEdit.text) - pc.playerCharacterSingleton.pcText = $TextEdit.text + + #DKM TEMP: getting something to work with as text + var newCharStr = $Title/VBoxContainer/LabelName/LE_Name.text + newCharFile.store_string(newCharStr) + pSingleton.pcText = "Name: " + newCharStr + print("PC text: " + pSingleton.pcText ) diff --git a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.tscn b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.tscn index 0f1da53..631565a 100644 --- a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.tscn +++ b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/Screens/Character_Add.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] +[ext_resource path="res://Screens/But_StartNewGame.gd" type="Script" id=1] [ext_resource path="res://Screens/Character_Add.gd" type="Script" id=3] [ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=4] @@ -8,6 +9,15 @@ anchor_right = 1.0 anchor_bottom = 1.0 script = ExtResource( 3 ) +[node name="PopupDialog" type="PopupDialog" parent="."] +anchor_top = 0.5 +anchor_bottom = 0.5 + +[node name="WarnText" type="Label" parent="PopupDialog"] +margin_right = 40.0 +margin_bottom = 14.0 +text = "Example" + [node name="TextEdit" type="TextEdit" parent="."] margin_left = 215.0 margin_top = 23.0 @@ -41,9 +51,8 @@ margin_right = 159.0 margin_bottom = 122.0 size_flags_vertical = 3 text = "Temp: Start New Game" -__meta__ = { -"_edit_use_anchors_": false -} +script = ExtResource( 1 ) +next_scene_path = "res://gamePlay/Game.tscn" [node name="FileDialog" type="FileDialog" parent="Title"] margin_left = 164.0 @@ -51,7 +60,7 @@ margin_top = 35.0 margin_right = 741.0 margin_bottom = 426.0 rect_min_size = Vector2( 400, 140 ) -access = 1 +access = 2 [node name="VBoxContainer" type="VBoxContainer" parent="Title"] anchor_left = 0.5 @@ -67,7 +76,7 @@ margin_bottom = 31.0 text = "NAME " -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelName"] +[node name="LE_Name" type="LineEdit" parent="Title/VBoxContainer/LabelName"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 diff --git a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/_userFiles/game_01.tscn b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/_userFiles/game_01.tscn new file mode 100644 index 0000000..32131cf --- /dev/null +++ b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/_userFiles/game_01.tscn @@ -0,0 +1,200 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://gamePlay/But_MoreOptions.gd" type="Script" id=1] +[ext_resource path="res://gamePlay/Game.gd" type="Script" id=2] +[ext_resource path="res://gamePlay/But_Option.tscn" type="PackedScene" id=3] +[ext_resource path="res://assets/ui_controlNode_dark_theme.tres" type="Theme" id=4] +[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=5] + +[node name="Game" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 4 ) +script = ExtResource( 2 ) + +[node name="Background" type="PanelContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = -274.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="Background"] +margin_left = 1.0 +margin_top = 1.0 +margin_right = 749.0 +margin_bottom = 599.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 = 728.0 +margin_bottom = 578.0 +custom_constants/separation = 10 + +[node name="ItemList" type="ItemList" parent="Background/MarginContainer/Rows"] +margin_right = 708.0 +margin_bottom = 40.0 +rect_min_size = Vector2( 0, 40 ) + +[node name="But_MoreOptions" type="Button" parent="Background/MarginContainer/Rows/ItemList"] +margin_right = 197.0 +margin_bottom = 36.0 +text = "More Options" +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} +next_scene_path = "res://Screens/MoreOptions.tscn" + +[node name="GameInfo" type="PanelContainer" parent="Background/MarginContainer/Rows"] +margin_top = 50.0 +margin_right = 708.0 +margin_bottom = 438.0 +size_flags_vertical = 3 + +[node name="CurrentText" 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 +margin_bottom = 568.0 +rect_min_size = Vector2( 0, 120 ) + +[node name="ScrollContainer" type="ScrollContainer" parent="Background/MarginContainer/Rows/InputArea"] +margin_left = 1.0 +margin_top = 1.0 +margin_right = 707.0 +margin_bottom = 119.0 + +[node name="OptionsContainer" type="VBoxContainer" parent="Background/MarginContainer/Rows/InputArea/ScrollContainer"] +margin_right = 108.0 +margin_bottom = 36.0 +custom_constants/separation = 5 + +[node name="option1" type="Button" parent="Background/MarginContainer/Rows/InputArea/ScrollContainer/OptionsContainer" instance=ExtResource( 3 )] +margin_right = 108.0 +margin_bottom = 36.0 +custom_fonts/font = ExtResource( 5 ) +text = "Option 1" +align = 0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Con_charSheet" type="PanelContainer" parent="."] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -294.0 +margin_bottom = 406.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="Con_charSheet"] +margin_left = 1.0 +margin_top = 1.0 +margin_right = 293.0 +margin_bottom = 405.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="Con_charSheet/MarginContainer"] +margin_right = 292.0 +margin_bottom = 404.0 + +[node name="IL_cs_label" type="ItemList" parent="Con_charSheet/MarginContainer/VBoxContainer"] +margin_right = 292.0 +margin_bottom = 40.0 +rect_min_size = Vector2( 0, 40 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="Con_charSheet/MarginContainer/VBoxContainer/IL_cs_label"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -141.0 +margin_right = 141.0 +margin_bottom = 43.0 +text = "Character Sheet" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CharacterSheet" type="TextEdit" parent="Con_charSheet/MarginContainer/VBoxContainer"] +margin_top = 44.0 +margin_right = 292.0 +margin_bottom = 404.0 +size_flags_vertical = 3 +readonly = true +wrap_enabled = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Con_chatScreen" type="PanelContainer" parent="."] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -292.0 +margin_top = -196.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="Con_chatScreen"] +margin_left = 1.0 +margin_top = 1.0 +margin_right = 291.0 +margin_bottom = 195.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="IL_cs_label" type="ItemList" parent="Con_chatScreen/VBoxContainer"] +margin_right = 290.0 +margin_bottom = 40.0 +rect_min_size = Vector2( 0, 40 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="Con_chatScreen/VBoxContainer/IL_cs_label"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -142.0 +margin_right = 142.0 +margin_bottom = 43.0 +text = "Chat" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ChatScreen" type="TextEdit" parent="Con_chatScreen/VBoxContainer"] +margin_top = 44.0 +margin_right = 290.0 +margin_bottom = 194.0 +size_flags_vertical = 3 +text = "Nothing yet +" +readonly = true +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="button_up" from="Background/MarginContainer/Rows/ItemList/But_MoreOptions" to="Background/MarginContainer/Rows/ItemList/But_MoreOptions" method="_on_But_MoreOptions_button_up"] diff --git a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/export_presets.cfg b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/export_presets.cfg index 4b27b69..3ff3f55 100644 --- a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/export_presets.cfg +++ b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/export_presets.cfg @@ -5,7 +5,7 @@ platform="HTML5" runnable=true custom_features="" export_filter="all_resources" -include_filter="" +include_filter="*.json, *.csv" exclude_filter="" export_path="../../Godot_Outputs/Godot_35_Outputs/Web/Web_Demo_Game_Base_2023_0806/index.html" script_export_mode=1 diff --git a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/gamePlay/Game.gd b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/gamePlay/Game.gd index 2bb5b87..c4fd4f0 100644 --- a/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/gamePlay/Game.gd +++ b/Phase2/Godot_GameCode/MergedDemo/Doug/bcirpg_mergedDemo_web_2023_0806A/gamePlay/Game.gd @@ -157,8 +157,10 @@ func change_node(destinationNode: String, _destinationParams: Array = []) -> voi elif target_Locale.locale_action == "TestDieRollAction" && target_Locale.destinations_array.size() == 1: print("Running test action " + target_Locale.locale_action + "; with parameters of: ") var nodeParameters = [] + var outputText = "Die types to be rolled: " for param in target_Locale.locale_action_params: print(param) + outputText = outputText + str(param) + " sided; " nodeParameters.append(param) #DKM TEST: testing the die roller with Andrew's code; randomly assigning percentage to pass. # Should this param be optional if you purely want to roll dice? @@ -167,7 +169,8 @@ func change_node(destinationNode: String, _destinationParams: Array = []) -> voi DiceRoller.dieManager.setDieManager(dieParams, 0.5) var result = DiceRoller.dieManager.rollDice() print("Rolled values: " + str(result[0])) - + outputText = outputText + "with values: " + str(result[0]) + create_response(outputText) #DKM TEMP: Andrew's code for ref: #assigning variable names to each of them for better clarity # var rolledValues = result[0] @@ -177,7 +180,7 @@ func change_node(destinationNode: String, _destinationParams: Array = []) -> voi # var degreeOfSuccess = result[4] # var dice = result[5] - change_node(target_Locale.destinations_array[0]) + #change_node(target_Locale.destinations_array[0]) options_container.get_child(0).grab_focus()