mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Worked with doug to figure out how to use Mode 2 of the File Dialog Class
This commit is contained in:
parent
b8742dc922
commit
47a0a46b5b
@ -9,7 +9,6 @@ var rows
|
||||
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 profVar = get_node("HBoxContainer/VBoxContainer/LabelProfession/LineEditProf")
|
||||
onready var strengthVar = get_node("HBoxContainer/VBoxContainer/LabelStrength/LineEditStrength")
|
||||
@ -20,38 +19,29 @@ onready var weaponVar = get_node("HBoxContainer/VBoxContainer2/LabelWeapon/LineE
|
||||
onready var armorVar = get_node("HBoxContainer/VBoxContainer2/LabelArmor/LineEditArmor")
|
||||
onready var quoteVar = get_node("HBoxContainer/VBoxContainer2/LabelQuote/LineEditQuote")
|
||||
|
||||
func writeToCSV(nameV, profV, strengthV, intelV, willpowerV, charmV, weaponV, armorV, quoteV):
|
||||
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:
|
||||
theme=load(settings.themeFile)
|
||||
|
||||
#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
|
||||
var f = File.new()
|
||||
|
||||
f.store_csv_line(["Name", nameVar.get_text()])
|
||||
f.store_csv_line(["Profession", profVar.get_text()])
|
||||
f.store_csv_line(["Strength", strengthVar.get_text()])
|
||||
f.store_csv_line(["Intellegence", intelVar.get_text()])
|
||||
f.store_csv_line(["Willpower", willpowerVar.get_text()])
|
||||
f.store_csv_line(["Charm", charmVar.get_text()])
|
||||
f.store_csv_line(["Weapon", weaponVar.get_text()])
|
||||
f.store_csv_line(["Armor", armorVar.get_text()])
|
||||
f.store_csv_line(["Quote", quoteVar.get_text()])
|
||||
f.close()
|
||||
|
||||
|
@ -12,9 +12,6 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 6 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Background" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
|
Loading…
Reference in New Issue
Block a user