Added some changes to the CSV system for Add Character

This commit is contained in:
PersonGuyGit 2022-10-02 12:51:55 -06:00
parent 1b55da71e9
commit 733195593d
9 changed files with 103 additions and 25 deletions

View File

@ -0,0 +1,3 @@
source_md5="3b37741efaad37471d3be79926341120"
dest_md5="6703f1e11659db139e8690f3df1a5a0d"

View File

@ -0,0 +1,9 @@
Name,
Profession,
Strength,
Intellegence,
Willpower,
Charm,
Weapon,
Armor,
Quote,
1 Name
2 Profession
3 Strength
4 Intellegence
5 Willpower
6 Charm
7 Weapon
8 Armor
9 Quote

View File

@ -0,0 +1,13 @@
[remap]
importer="csv_translation"
type="Translation"
valid=false
[deps]
source_file="res://_userFiles/CharacterOutput.csv"
[params]
compress=true
delimiter=0

View File

@ -0,0 +1,10 @@
keys,en
Name,Thickly Goes
Profession,Brawler
Strength,Excessive
Intellect,Diminished
Willpower,Variable
Charm,Lacking
Weapon,Meaty Fists
Armor,Leather Jacket and Chaps
A Quote,You talkin to me?!
1 keys en
2 Name Thickly Goes
3 Profession Brawler
4 Strength Excessive
5 Intellect Diminished
6 Willpower Variable
7 Charm Lacking
8 Weapon Meaty Fists
9 Armor Leather Jacket and Chaps
10 A Quote You talkin to me?!

View File

@ -0,0 +1,16 @@
[remap]
importer="csv_translation"
type="Translation"
[deps]
files=[ "res://_userFiles/characterFiles/Template.en.translation" ]
source_file="res://_userFiles/characterFiles/Template.csv"
dest_files=[ "res://_userFiles/characterFiles/Template.en.translation" ]
[params]
compress=true
delimiter=0

View File

@ -3,31 +3,51 @@
# it into the character object # it into the character object
extends Control extends Control
var originalPath = "res://_userFiles/Template.csv"
var rows
onready var settings = get_node("/root/GlobalSaveInstance").settingsInstance onready var settings = get_node("/root/GlobalSaveInstance").settingsInstance
onready var SaveButton = get_node("HBoxContainer/VBoxContainer/SaveButton")
onready var nameVar = get_node("HBoxContainer/VBoxContainer/LabelName/LineEditName") onready var nameVar = get_node("HBoxContainer/VBoxContainer/LabelName/LineEditName")
onready var profVar = get_node("HBoxContainer/VBoxContainer/LabelProf/LineEditProf") onready var profVar = get_node("HBoxContainer/VBoxContainer/LabelProfession/LineEditProf")
onready var strengthVar = get_node("HBoxContainer/VBoxContainer/LabelStrength/LineEditStrength") onready var strengthVar = get_node("HBoxContainer/VBoxContainer/LabelStrength/LineEditStrength")
onready var intelVar = get_node("HBoxContainer/VBoxContainer/LabelIntellect/LineEditIntel") onready var intelVar = get_node("HBoxContainer/VBoxContainer/LabelIntellect/LineEditIntel")
onready var willpowerVar = get_node("HBoxContainer/VBoxContainer2/LabelWillpower/LineEditWill") onready var willpowerVar = get_node("HBoxContainer/VBoxContainer2/LabelWillpower/LineEditWill")
onready var charmVar = get_node("HBoxContainer/VBoxContainer2/LabelCharm/LineEditCharm") onready var charmVar = get_node("HBoxContainer/VBoxContainer2/LabelCharm/LineEditCharm")
onready var weaponVar = get_node("HBoxContainer/VBoxContainer2/LabelWeapon/LineEditWeapon") onready var weaponVar = get_node("HBoxContainer/VBoxContainer2/LabelWeapon/LineEditWeapon")
onready var armorVar = get_node("HBoxContainer/VBoxContainer2/LabelArmor/LineEditArmor") onready var armorVar = get_node("HBoxContainer/VBoxContainer2/LabelArmor/LineEditArmor")
onready var quoteVar = get_node("HBoxContainer/VBoxContainer/LabelQuote/LineEditQuote") onready var quoteVar = get_node("HBoxContainer/VBoxContainer2/LabelQuote/LineEditQuote")
func writeToCSV(nameV, profV, strengthV, intelV, willpowerV, charmV, weaponV, armorV, quoteV): func writeToCSV(nameV, profV, strengthV, intelV, willpowerV, charmV, weaponV, armorV, quoteV):
pass var f = File.new()
f.open("res://_userFiles/CharacterOutput.csv", File.WRITE)
var ArrayStrings = [PoolStringArray()]
f.store_csv_line(["Name", nameV])
f.store_csv_line(["Profession", profV])
f.store_csv_line(["Strength", strengthV])
f.store_csv_line(["Intellegence", intelV])
f.store_csv_line(["Willpower", willpowerV])
f.store_csv_line(["Charm", charmV])
f.store_csv_line(["Weapon", weaponV])
f.store_csv_line(["Armor", armorV])
f.store_csv_line(["Quote", quoteV])
f.close()
func _process(delta):
if SaveButton.pressed == true:
$Title/FileDialog.popup()
writeToCSV(nameVar.get_text(), profVar.get_text(),
strengthVar.get_text(), intelVar.get_text(), willpowerVar.get_text(),
charmVar.get_text(), weaponVar.get_text(), armorVar.get_text(), quoteVar.get_text())
func _ready() -> void: func _ready() -> void:
theme=load(settings.themeFile) theme=load(settings.themeFile)
$Title/But_SaveChar.grab_focus()
func _on_But_SaveChar_pressed() -> void:
$Title/FileDialog.popup()
#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 pc = get_node("/root/PlayerCharacter")

View File

@ -63,12 +63,12 @@ margin_bottom = 388.0
custom_constants/separation = 40 custom_constants/separation = 40
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
margin_right = 81.0 margin_right = 105.0
margin_bottom = 358.0 margin_bottom = 358.0
custom_constants/separation = 20 custom_constants/separation = 20
[node name="LabelName" type="Label" parent="HBoxContainer/VBoxContainer"] [node name="LabelName" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_right = 81.0 margin_right = 105.0
margin_bottom = 31.0 margin_bottom = 31.0
text = "NAME text = "NAME
" "
@ -79,8 +79,8 @@ margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="LabelProfession" type="Label" parent="HBoxContainer/VBoxContainer"] [node name="LabelProfession" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_top = 60.0 margin_top = 51.0
margin_right = 81.0 margin_right = 105.0
margin_bottom = 82.0 margin_bottom = 82.0
text = "PROFESSION text = "PROFESSION
" "
@ -91,8 +91,8 @@ margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="LabelStrength" type="Label" parent="HBoxContainer/VBoxContainer"] [node name="LabelStrength" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_top = 120.0 margin_top = 102.0
margin_right = 81.0 margin_right = 105.0
margin_bottom = 133.0 margin_bottom = 133.0
text = "STRENGTH text = "STRENGTH
" "
@ -103,8 +103,8 @@ margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="LabelIntellect" type="Label" parent="HBoxContainer/VBoxContainer"] [node name="LabelIntellect" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_top = 180.0 margin_top = 153.0
margin_right = 81.0 margin_right = 105.0
margin_bottom = 184.0 margin_bottom = 184.0
text = "INTELLECT text = "INTELLECT
" "
@ -114,9 +114,15 @@ margin_top = 25.0
margin_right = 58.0 margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="SaveButton" type="Button" parent="HBoxContainer/VBoxContainer"]
margin_top = 204.0
margin_right = 105.0
margin_bottom = 224.0
text = "Save Character"
[node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer"] [node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer"]
margin_left = 121.0 margin_left = 145.0
margin_right = 200.0 margin_right = 224.0
margin_bottom = 358.0 margin_bottom = 358.0
custom_constants/separation = 30 custom_constants/separation = 30
@ -132,7 +138,7 @@ margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="LabelCharm" type="Label" parent="HBoxContainer/VBoxContainer2"] [node name="LabelCharm" type="Label" parent="HBoxContainer/VBoxContainer2"]
margin_top = 60.0 margin_top = 61.0
margin_right = 79.0 margin_right = 79.0
margin_bottom = 75.0 margin_bottom = 75.0
text = "CHARM" text = "CHARM"
@ -143,7 +149,7 @@ margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="LabelWeapon" type="Label" parent="HBoxContainer/VBoxContainer2"] [node name="LabelWeapon" type="Label" parent="HBoxContainer/VBoxContainer2"]
margin_top = 120.0 margin_top = 105.0
margin_right = 79.0 margin_right = 79.0
margin_bottom = 136.0 margin_bottom = 136.0
text = "WEAPON text = "WEAPON
@ -155,7 +161,7 @@ margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="LabelArmor" type="Label" parent="HBoxContainer/VBoxContainer2"] [node name="LabelArmor" type="Label" parent="HBoxContainer/VBoxContainer2"]
margin_top = 180.0 margin_top = 166.0
margin_right = 79.0 margin_right = 79.0
margin_bottom = 180.0 margin_bottom = 180.0
text = "ARMOR" text = "ARMOR"
@ -166,7 +172,7 @@ margin_right = 58.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="LabelQuote" type="Label" parent="HBoxContainer/VBoxContainer2"] [node name="LabelQuote" type="Label" parent="HBoxContainer/VBoxContainer2"]
margin_top = 240.0 margin_top = 210.0
margin_right = 79.0 margin_right = 79.0
margin_bottom = 224.0 margin_bottom = 224.0
text = "QUOTE" text = "QUOTE"