Skip to content

Commit

Permalink
Added subfolder for Charcter code for the MVP
Browse files Browse the repository at this point in the history
  • Loading branch information
PersonGuyGit committed Mar 17, 2024
1 parent 116d706 commit 8d3f317
Show file tree
Hide file tree
Showing 126 changed files with 4,137 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Phase2/Documentation/ToDoForCharacterMVP.txt
@@ -0,0 +1,11 @@
To Do

1: Get the saving and loading code for CSV from Suwhan.

2: Make that code work with the UI of the MVP project.

3: Similar to the method of saving the Game Settings, to a .CFG file by using a singleton; I will need to save the character information to the player singleton for use.

4: Then save the singleton data to a CSV

5: Figure out the issues with CSV like doug mentioned.
@@ -0,0 +1 @@

@@ -0,0 +1,3 @@
source_md5="79d2b9a5284e50d91a97c2dd565f2fa4"
dest_md5="ab01d4eeab6e15a95fc10ee1b4e02967"

Binary file not shown.
@@ -0,0 +1,3 @@
source_md5="79d2b9a5284e50d91a97c2dd565f2fa4"
dest_md5="ab01d4eeab6e15a95fc10ee1b4e02967"

Binary file not shown.
@@ -0,0 +1,3 @@
source_md5="13a1e728def8fb06bd8e797fcc392604"
dest_md5="b396169339b2e8d769e9830c387050ad"

Binary file not shown.
@@ -0,0 +1,3 @@
source_md5="13a1e728def8fb06bd8e797fcc392604"
dest_md5="b396169339b2e8d769e9830c387050ad"

Binary file not shown.
@@ -0,0 +1,3 @@
source_md5="266f789a4e895911161321092c2c2429"
dest_md5="a08a6dcf169f683724bfd5cd82e23fe6"

Binary file not shown.
@@ -0,0 +1,3 @@
source_md5="266f789a4e895911161321092c2c2429"
dest_md5="a08a6dcf169f683724bfd5cd82e23fe6"

Binary file not shown.
@@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

Binary file not shown.
@@ -0,0 +1 @@
source_md5="cfb2a27b25dace2544a35a8ec7d50081"
@@ -0,0 +1,3 @@
source_md5="3b37741efaad37471d3be79926341120"
dest_md5="f4ff30e73b46c5029908e5376b2e69b5"

@@ -0,0 +1 @@
source_md5="fe8dea03f3f241ec8c3f199dcd974cbe"
@@ -0,0 +1,8 @@
[gd_scene format=2]

[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
@@ -0,0 +1,43 @@
****************************
README.TXT:
****************************
Author: Doug McCord
Date: 4-Feb-2024

****************************
Intro notes:
This project updates the RPGR BCI merged demo game from August 6, 2023 for
the Modgodtoolset and associated updates. Draws game from XML, and adds
numerous missing features.

The roadmap for this file can be found in the project Github:
Phase2/Documentation



****************************
Project file structure:
Surface Layer:
Default Godot files remain at this level

_toArchive:
Directory to serve as reference-only; precursor to trash

assets:
Images, fonts, themes and styles (TRES text resource data files). Note that all fonts and styles are defined in
the following themes: ui_controlNode_light_theme.tres and ui_controlNode_dark_theme.tres. Any style changes
should be made in those theme files to assure propagation throughout.

gamePlay:
Scenes and scripts specific to the gameplay section

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:
Planned to include 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
@@ -0,0 +1,13 @@
#BUT_HISTORYPAGER:
# Iterates the page number and calls HistoryViewer script to display
# stored page and response fro the history array
#

extends Button

onready var historyViewerScript = get_node("/root/HistoryViewer")

#DKM TEMP: this needs refactoring -- too much being calculated as needed/repeated
func _on_But_HistoryPager_button_up() -> void:
historyViewerScript.update_pager()

@@ -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 ""

@@ -0,0 +1,29 @@
#CHARACTER_ADD:
# Script for adding a new character and both saving it to file and loading
# it into the character object

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)
$Title/But_SaveChar.grab_focus()

func _on_But_SaveChar_pressed() -> void:
$Title/FileDialog.popup()

#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)

#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 )
@@ -0,0 +1,180 @@
[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]

[node name="Control" type="Control"]
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
margin_right = 997.0
margin_bottom = 447.0

[node name="Title" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
text = "Create Character (temp)"
align = 1

[node name="But_SaveChar" type="Button" parent="Title"]
margin_right = 12.0
margin_bottom = 20.0
text = "Save Character"

[node name="But_ChangeScene" type="Button" parent="Title"]
margin_left = -1.0
margin_top = 48.0
margin_right = 142.0
margin_bottom = 72.0
size_flags_vertical = 3
text = "Temp: Main Menu"
script = ExtResource( 4 )
next_scene_path = "res://Screens/MenuScreen.tscn"

[node name="But_StartNewGame" type="Button" parent="Title"]
margin_top = 98.0
margin_right = 159.0
margin_bottom = 122.0
size_flags_vertical = 3
text = "Temp: Start New Game"
script = ExtResource( 1 )
next_scene_path = "res://gamePlay/Game.tscn"

[node name="FileDialog" type="FileDialog" parent="Title"]
margin_left = 164.0
margin_top = 35.0
margin_right = 741.0
margin_bottom = 426.0
rect_min_size = Vector2( 400, 140 )
access = 2

[node name="VBoxContainer" type="VBoxContainer" parent="Title"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -20.0
margin_top = 50.0
margin_right = 20.0
margin_bottom = 140.0

[node name="LabelName" type="Label" parent="Title/VBoxContainer"]
margin_right = 81.0
margin_bottom = 31.0
text = "NAME
"

[node name="LE_Name" type="LineEdit" parent="Title/VBoxContainer/LabelName"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelProfession" type="Label" parent="Title/VBoxContainer"]
margin_top = 35.0
margin_right = 81.0
margin_bottom = 66.0
text = "PROFESSION
"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelProfession"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelStrength" type="Label" parent="Title/VBoxContainer"]
margin_top = 70.0
margin_right = 81.0
margin_bottom = 101.0
text = "STRENGTH
"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelStrength"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelIntellect" type="Label" parent="Title/VBoxContainer"]
margin_top = 105.0
margin_right = 81.0
margin_bottom = 136.0
text = "INTELLECT
"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelIntellect"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelWillpower" type="Label" parent="Title/VBoxContainer"]
margin_top = 140.0
margin_right = 81.0
margin_bottom = 171.0
text = "WILLPOWER
"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelWillpower"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelCharm" type="Label" parent="Title/VBoxContainer"]
margin_top = 175.0
margin_right = 81.0
margin_bottom = 189.0
text = "CHARM"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelCharm"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelWeapon" type="Label" parent="Title/VBoxContainer"]
margin_top = 193.0
margin_right = 81.0
margin_bottom = 224.0
text = "WEAPON
"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelWeapon"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelArmor" type="Label" parent="Title/VBoxContainer"]
margin_top = 228.0
margin_right = 81.0
margin_bottom = 242.0
text = "ARMOR"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelArmor"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[node name="LabelQuote" type="Label" parent="Title/VBoxContainer"]
margin_top = 246.0
margin_right = 81.0
margin_bottom = 260.0
text = "QUOTE"

[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelQuote"]
margin_top = 15.0
margin_right = 58.0
margin_bottom = 24.0

[connection signal="pressed" from="Title/But_SaveChar" to="." method="_on_But_SaveChar_pressed"]
[connection signal="button_up" from="Title/But_ChangeScene" to="Title/But_ChangeScene" method="_on_But_NewGame_button_up"]
[connection signal="button_up" from="Title/But_StartNewGame" to="Title/But_StartNewGame" method="_on_But_NewGame_button_up"]
[connection signal="file_selected" from="Title/FileDialog" to="." method="_on_FileDialog_file_selected"]
@@ -0,0 +1,24 @@
#CHARACTER_LOAD:
# Script for loading a character file into the character object from file

extends Control

onready var settings = get_node("/root/GlobalSaveInstance").settingsInstance

func _ready() -> void:
theme=load(settings.themeFile)
$Title/But_loadCharacter.grab_focus()


func _on_But_loadCharacter_pressed() -> void:
$LoadCharacter_FileDialog.popup()


#DKM TEMP: we need to load the character item, not display to field
func _on_LoadCharacter_FileDialog_file_selected(path: String) -> void:
print(path)
var charFile = File.new()
charFile.open(path, 1)
var pc = get_node("/root/PlayerCharacter")
pc.playerCharacterSingleton.pcText = charFile.get_as_text()
$TextEdit.text = pc.playerCharacterSingleton.pcText

0 comments on commit 8d3f317

Please sign in to comment.