From 38c9a422b686876a8825e9be5d07e9d396d21034 Mon Sep 17 00:00:00 2001 From: MacDugRPG <57243055+MacDugRPG@users.noreply.github.com> Date: Sun, 1 May 2022 14:48:03 -0400 Subject: [PATCH] New Game Updates: Creates a player character singleton (currently just a string), that's updated on load or create character, and displayed in the character pane during the game. --- .../assets/sbf_black.tres | 1 + .../assets/sbf_white.tres | 2 +- .../assets/ui_controlNode_dark_theme.tres | 11 ++++++----- .../assets/ui_controlNode_light_theme.tres | 15 ++++++++------- .../bcirpg_newGame_20220227A/gamePlay/Game.gd | 6 ++++++ .../bcirpg_newGame_20220227A/gamePlay/Game.tscn | 3 ++- .../globalScripts/PlayerCharacter.gd | 11 +++++++++++ .../globalScripts/playerCharacterTemplate.gd | 8 ++++++++ .../Doug/bcirpg_newGame_20220227A/project.godot | 9 ++++++++- .../screens/Character_Add.gd | 2 ++ .../screens/Character_Load.gd | 4 +++- 11 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/PlayerCharacter.gd create mode 100644 Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/playerCharacterTemplate.gd diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_black.tres b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_black.tres index 293918c..859abe4 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_black.tres +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_black.tres @@ -6,3 +6,4 @@ border_width_left = 1 border_width_top = 1 border_width_right = 1 border_width_bottom = 1 +border_color = Color( 0, 0, 0, 1 ) diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_white.tres b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_white.tres index 41e0cea..418e195 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_white.tres +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/sbf_white.tres @@ -6,4 +6,4 @@ border_width_left = 1 border_width_top = 1 border_width_right = 1 border_width_bottom = 1 -border_color = Color( 0, 0, 0, 1 ) +border_color = Color( 1, 1, 1, 1 ) diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_dark_theme.tres b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_dark_theme.tres index c4541e3..76d4f64 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_dark_theme.tres +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_dark_theme.tres @@ -1,8 +1,9 @@ -[gd_resource type="Theme" load_steps=4 format=2] +[gd_resource type="Theme" load_steps=5 format=2] [ext_resource path="res://assets/sbf_black.tres" type="StyleBox" id=1] [ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=2] [ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=3] +[ext_resource path="res://assets/liberation_serif.tres" type="DynamicFont" id=4] [resource] Button/colors/font_color = Color( 1, 1, 1, 1 ) @@ -37,7 +38,7 @@ Label/constants/line_spacing = 3 Label/constants/shadow_as_outline = 0 Label/constants/shadow_offset_x = 1 Label/constants/shadow_offset_y = 1 -Label/fonts/font = null +Label/fonts/font = ExtResource( 3 ) Label/styles/normal = ExtResource( 1 ) LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 1 ) LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 ) @@ -92,7 +93,7 @@ TextEdit/colors/completion_selected_color = Color( 0.26, 0.26, 0.27, 1 ) TextEdit/colors/current_line_color = Color( 0.25, 0.25, 0.26, 0.8 ) TextEdit/colors/executing_line_color = Color( 0.2, 0.8, 0.2, 0.4 ) TextEdit/colors/font_color = Color( 0.00392157, 0.00392157, 0.00392157, 1 ) -TextEdit/colors/font_color_readonly = Color( 0.88, 0.88, 0.88, 0.5 ) +TextEdit/colors/font_color_readonly = Color( 0.933333, 0.933333, 0.933333, 0.501961 ) TextEdit/colors/font_color_selected = Color( 0, 0, 0, 1 ) TextEdit/colors/function_color = Color( 0.4, 0.64, 0.81, 1 ) TextEdit/colors/line_number_color = Color( 0.67, 0.67, 0.67, 0.4 ) @@ -107,7 +108,7 @@ TextEdit/constants/completion_lines = 7 TextEdit/constants/completion_max_width = 50 TextEdit/constants/completion_scroll_width = 3 TextEdit/constants/line_spacing = 4 -TextEdit/fonts/font = ExtResource( 3 ) +TextEdit/fonts/font = ExtResource( 4 ) TextEdit/icons/fold = null TextEdit/icons/folded = null TextEdit/icons/space = null @@ -115,5 +116,5 @@ TextEdit/icons/tab = null TextEdit/styles/completion = null TextEdit/styles/focus = null TextEdit/styles/normal = ExtResource( 1 ) -TextEdit/styles/read_only = null +TextEdit/styles/read_only = ExtResource( 1 ) VBoxContainer/constants/separation = 4 diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_light_theme.tres b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_light_theme.tres index a2c76b7..7fcfd40 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_light_theme.tres +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/assets/ui_controlNode_light_theme.tres @@ -1,8 +1,9 @@ -[gd_resource type="Theme" load_steps=4 format=2] +[gd_resource type="Theme" load_steps=5 format=2] [ext_resource path="res://assets/sbf_white.tres" type="StyleBox" id=1] [ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=2] [ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=3] +[ext_resource path="res://assets/liberation_serif.tres" type="DynamicFont" id=4] [resource] Button/colors/font_color = Color( 0, 0, 0, 1 ) @@ -37,7 +38,7 @@ Label/constants/line_spacing = 3 Label/constants/shadow_as_outline = 0 Label/constants/shadow_offset_x = 1 Label/constants/shadow_offset_y = 1 -Label/fonts/font = null +Label/fonts/font = ExtResource( 3 ) Label/styles/normal = ExtResource( 1 ) LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 1 ) LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 ) @@ -92,7 +93,7 @@ TextEdit/colors/completion_selected_color = Color( 0.26, 0.26, 0.27, 1 ) TextEdit/colors/current_line_color = Color( 0.25, 0.25, 0.26, 0.8 ) TextEdit/colors/executing_line_color = Color( 0.2, 0.8, 0.2, 0.4 ) TextEdit/colors/font_color = Color( 0.00392157, 0.00392157, 0.00392157, 1 ) -TextEdit/colors/font_color_readonly = Color( 0.88, 0.88, 0.88, 0.5 ) +TextEdit/colors/font_color_readonly = Color( 0.0588235, 0.0588235, 0.0588235, 0.501961 ) TextEdit/colors/font_color_selected = Color( 0, 0, 0, 1 ) TextEdit/colors/function_color = Color( 0.4, 0.64, 0.81, 1 ) TextEdit/colors/line_number_color = Color( 0.67, 0.67, 0.67, 0.4 ) @@ -107,13 +108,13 @@ TextEdit/constants/completion_lines = 7 TextEdit/constants/completion_max_width = 50 TextEdit/constants/completion_scroll_width = 3 TextEdit/constants/line_spacing = 4 -TextEdit/fonts/font = ExtResource( 3 ) +TextEdit/fonts/font = ExtResource( 4 ) TextEdit/icons/fold = null TextEdit/icons/folded = null TextEdit/icons/space = null TextEdit/icons/tab = null -TextEdit/styles/completion = null -TextEdit/styles/focus = null +TextEdit/styles/completion = ExtResource( 1 ) +TextEdit/styles/focus = ExtResource( 1 ) TextEdit/styles/normal = ExtResource( 1 ) -TextEdit/styles/read_only = null +TextEdit/styles/read_only = ExtResource( 1 ) VBoxContainer/constants/separation = 4 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 1b5faad..b6382db 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 @@ -19,6 +19,9 @@ 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 +onready var pc = get_node("/root/PlayerCharacter") +onready var charSheet = $Con_charSheet/MarginContainer/VBoxContainer/CharacterSheet + #DKM TEMP: this is just a temp file solution for grabbing map/module, will be replaced with DB # or desired load approach @@ -35,6 +38,9 @@ func _ready() -> void: option_one.show() option_two.show() option_three.show() + + #Load character sheet: + charSheet.text = pc.playerCharacterSingleton.pcText 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.") 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 0027356..a406848 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 @@ -116,7 +116,7 @@ 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_right = 135.0 margin_bottom = 30.0 theme = ExtResource( 10 ) text = "More Options" @@ -251,6 +251,7 @@ margin_right = 292.0 margin_bottom = 404.0 size_flags_vertical = 3 readonly = true +wrap_enabled = true __meta__ = { "_edit_use_anchors_": false } diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/PlayerCharacter.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/PlayerCharacter.gd new file mode 100644 index 0000000..29beebd --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/PlayerCharacter.gd @@ -0,0 +1,11 @@ +#PLAYER CHARACTER: +# Unique handler script for root PC singleton. May be adapted for +# player loading and saving functionality + +extends Node + +var playerCharacterSingleton + +func _ready() -> void: + playerCharacterSingleton = playerCharacterTemplate.new() + diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/playerCharacterTemplate.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/playerCharacterTemplate.gd new file mode 100644 index 0000000..a8665ce --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/globalScripts/playerCharacterTemplate.gd @@ -0,0 +1,8 @@ +#PLAYER CHARACTER TEMPLATE: +# Template for holding loaded/current character + +extends Resource + +class_name playerCharacterTemplate + +var pcText = "" 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 e843e4e..cee32bf 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 @@ -18,10 +18,16 @@ _global_script_classes=[ { "class": "Locale", "language": "GDScript", "path": "res://userInterface/Locale.gd" +}, { +"base": "Resource", +"class": "playerCharacterTemplate", +"language": "GDScript", +"path": "res://globalScripts/playerCharacterTemplate.gd" } ] _global_script_class_icons={ "HistoryScreensTemplateSingleton": "", -"Locale": "" +"Locale": "", +"playerCharacterTemplate": "" } [application] @@ -33,6 +39,7 @@ config/icon="res://icon.png" [autoload] History="*res://globalScripts/history.gd" +PlayerCharacter="*res://globalScripts/PlayerCharacter.gd" [physics] diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Add.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Add.gd index 1c10474..3458911 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Add.gd +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Add.gd @@ -14,6 +14,8 @@ func _on_But_SaveChar_pressed() -> void: #DKM TEMP: just text for now from text edit 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 diff --git a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Load.gd b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Load.gd index a859d3a..55297de 100644 --- a/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Load.gd +++ b/Phase2/Godot ===(Game Code)===/NewGame/Doug/bcirpg_newGame_20220227A/screens/Character_Load.gd @@ -17,4 +17,6 @@ func _on_LoadCharacter_FileDialog_file_selected(path: String) -> void: print(path) var charFile = File.new() charFile.open(path, 1) - $TextEdit.text = charFile.get_as_text() + var pc = get_node("/root/PlayerCharacter") + pc.playerCharacterSingleton.pcText = charFile.get_as_text() + $TextEdit.text = pc.playerCharacterSingleton.pcText