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.
This commit is contained in:
MacDugRPG 2022-05-01 14:48:03 -04:00
parent 2db3306682
commit 38c9a422b6
11 changed files with 56 additions and 16 deletions

View File

@ -6,3 +6,4 @@ border_width_left = 1
border_width_top = 1 border_width_top = 1
border_width_right = 1 border_width_right = 1
border_width_bottom = 1 border_width_bottom = 1
border_color = Color( 0, 0, 0, 1 )

View File

@ -6,4 +6,4 @@ border_width_left = 1
border_width_top = 1 border_width_top = 1
border_width_right = 1 border_width_right = 1
border_width_bottom = 1 border_width_bottom = 1
border_color = Color( 0, 0, 0, 1 ) border_color = Color( 1, 1, 1, 1 )

View File

@ -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/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_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_20pt.tres" type="DynamicFont" id=3]
[ext_resource path="res://assets/liberation_serif.tres" type="DynamicFont" id=4]
[resource] [resource]
Button/colors/font_color = Color( 1, 1, 1, 1 ) 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_as_outline = 0
Label/constants/shadow_offset_x = 1 Label/constants/shadow_offset_x = 1
Label/constants/shadow_offset_y = 1 Label/constants/shadow_offset_y = 1
Label/fonts/font = null Label/fonts/font = ExtResource( 3 )
Label/styles/normal = ExtResource( 1 ) Label/styles/normal = ExtResource( 1 )
LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 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 ) 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/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/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 = 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/font_color_selected = Color( 0, 0, 0, 1 )
TextEdit/colors/function_color = Color( 0.4, 0.64, 0.81, 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 ) 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_max_width = 50
TextEdit/constants/completion_scroll_width = 3 TextEdit/constants/completion_scroll_width = 3
TextEdit/constants/line_spacing = 4 TextEdit/constants/line_spacing = 4
TextEdit/fonts/font = ExtResource( 3 ) TextEdit/fonts/font = ExtResource( 4 )
TextEdit/icons/fold = null TextEdit/icons/fold = null
TextEdit/icons/folded = null TextEdit/icons/folded = null
TextEdit/icons/space = null TextEdit/icons/space = null
@ -115,5 +116,5 @@ TextEdit/icons/tab = null
TextEdit/styles/completion = null TextEdit/styles/completion = null
TextEdit/styles/focus = null TextEdit/styles/focus = null
TextEdit/styles/normal = ExtResource( 1 ) TextEdit/styles/normal = ExtResource( 1 )
TextEdit/styles/read_only = null TextEdit/styles/read_only = ExtResource( 1 )
VBoxContainer/constants/separation = 4 VBoxContainer/constants/separation = 4

View File

@ -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/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_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_20pt.tres" type="DynamicFont" id=3]
[ext_resource path="res://assets/liberation_serif.tres" type="DynamicFont" id=4]
[resource] [resource]
Button/colors/font_color = Color( 0, 0, 0, 1 ) 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_as_outline = 0
Label/constants/shadow_offset_x = 1 Label/constants/shadow_offset_x = 1
Label/constants/shadow_offset_y = 1 Label/constants/shadow_offset_y = 1
Label/fonts/font = null Label/fonts/font = ExtResource( 3 )
Label/styles/normal = ExtResource( 1 ) Label/styles/normal = ExtResource( 1 )
LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 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 ) 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/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/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 = 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/font_color_selected = Color( 0, 0, 0, 1 )
TextEdit/colors/function_color = Color( 0.4, 0.64, 0.81, 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 ) 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_max_width = 50
TextEdit/constants/completion_scroll_width = 3 TextEdit/constants/completion_scroll_width = 3
TextEdit/constants/line_spacing = 4 TextEdit/constants/line_spacing = 4
TextEdit/fonts/font = ExtResource( 3 ) TextEdit/fonts/font = ExtResource( 4 )
TextEdit/icons/fold = null TextEdit/icons/fold = null
TextEdit/icons/folded = null TextEdit/icons/folded = null
TextEdit/icons/space = null TextEdit/icons/space = null
TextEdit/icons/tab = null TextEdit/icons/tab = null
TextEdit/styles/completion = null TextEdit/styles/completion = ExtResource( 1 )
TextEdit/styles/focus = null TextEdit/styles/focus = ExtResource( 1 )
TextEdit/styles/normal = ExtResource( 1 ) TextEdit/styles/normal = ExtResource( 1 )
TextEdit/styles/read_only = null TextEdit/styles/read_only = ExtResource( 1 )
VBoxContainer/constants/separation = 4 VBoxContainer/constants/separation = 4

View File

@ -19,6 +19,9 @@ onready var locale_manager = $LocaleManager
onready var option_one = $Background/MarginContainer/Rows/InputArea/VBoxContainer/option1 onready var option_one = $Background/MarginContainer/Rows/InputArea/VBoxContainer/option1
onready var option_two= $Background/MarginContainer/Rows/InputArea/VBoxContainer/option2 onready var option_two= $Background/MarginContainer/Rows/InputArea/VBoxContainer/option2
onready var option_three = $Background/MarginContainer/Rows/InputArea/VBoxContainer/option3 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 #DKM TEMP: this is just a temp file solution for grabbing map/module, will be replaced with DB
# or desired load approach # or desired load approach
@ -35,6 +38,9 @@ func _ready() -> void:
option_one.show() option_one.show()
option_two.show() option_two.show()
option_three.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. " 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.") #create_response("The game has begun! You can select from the available options below.")

View File

@ -116,7 +116,7 @@ margin_bottom = 40.0
rect_min_size = Vector2( 0, 40 ) rect_min_size = Vector2( 0, 40 )
[node name="But_ChangeScene" parent="Background/MarginContainer/Rows/ItemList" instance=ExtResource( 1 )] [node name="But_ChangeScene" parent="Background/MarginContainer/Rows/ItemList" instance=ExtResource( 1 )]
margin_right = 82.0 margin_right = 135.0
margin_bottom = 30.0 margin_bottom = 30.0
theme = ExtResource( 10 ) theme = ExtResource( 10 )
text = "More Options" text = "More Options"
@ -251,6 +251,7 @@ margin_right = 292.0
margin_bottom = 404.0 margin_bottom = 404.0
size_flags_vertical = 3 size_flags_vertical = 3
readonly = true readonly = true
wrap_enabled = true
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }

View File

@ -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()

View File

@ -0,0 +1,8 @@
#PLAYER CHARACTER TEMPLATE:
# Template for holding loaded/current character
extends Resource
class_name playerCharacterTemplate
var pcText = ""

View File

@ -18,10 +18,16 @@ _global_script_classes=[ {
"class": "Locale", "class": "Locale",
"language": "GDScript", "language": "GDScript",
"path": "res://userInterface/Locale.gd" "path": "res://userInterface/Locale.gd"
}, {
"base": "Resource",
"class": "playerCharacterTemplate",
"language": "GDScript",
"path": "res://globalScripts/playerCharacterTemplate.gd"
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"HistoryScreensTemplateSingleton": "", "HistoryScreensTemplateSingleton": "",
"Locale": "" "Locale": "",
"playerCharacterTemplate": ""
} }
[application] [application]
@ -33,6 +39,7 @@ config/icon="res://icon.png"
[autoload] [autoload]
History="*res://globalScripts/history.gd" History="*res://globalScripts/history.gd"
PlayerCharacter="*res://globalScripts/PlayerCharacter.gd"
[physics] [physics]

View File

@ -14,6 +14,8 @@ func _on_But_SaveChar_pressed() -> void:
#DKM TEMP: just text for now from text edit #DKM TEMP: just text for now from text edit
func _on_FileDialog_file_selected(path: String) -> void: func _on_FileDialog_file_selected(path: String) -> void:
var pc = get_node("/root/PlayerCharacter")
var newCharFile = File.new() var newCharFile = File.new()
newCharFile.open(path, 2) newCharFile.open(path, 2)
newCharFile.store_string($TextEdit.text) newCharFile.store_string($TextEdit.text)
pc.playerCharacterSingleton.pcText = $TextEdit.text

View File

@ -17,4 +17,6 @@ func _on_LoadCharacter_FileDialog_file_selected(path: String) -> void:
print(path) print(path)
var charFile = File.new() var charFile = File.new()
charFile.open(path, 1) 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