mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Import Player and Settings Updates
Additional updates as follows: mods to dark and light themes for text edits, modification to import for CSV parsing and saving to the player singleton text file, adds an alert popup for import in cases where no character has been loaded (won't allow start game), replaces the select character within game to use this import character option, also adds testing files directory overall to Github
This commit is contained in:
parent
baa4ee34d4
commit
935da98638
@ -0,0 +1,23 @@
|
||||
[player_preferences]
|
||||
|
||||
player_name="Tester the Bold!"
|
||||
risk_threshold=2.0
|
||||
|
||||
[visual_controls]
|
||||
|
||||
font_size=3.0
|
||||
brightness=5.0
|
||||
|
||||
[general_settings]
|
||||
|
||||
volume=0.0
|
||||
closed_captions=false
|
||||
dev_console=true
|
||||
|
||||
[virtual_keyboard]
|
||||
|
||||
keyboard_layout=2
|
||||
|
||||
[theme]
|
||||
|
||||
theme_selection=0
|
@ -0,0 +1,3 @@
|
||||
Files for testing only. On deployment, these should be put at the appropriate user:// location for your operating system. For windows this is:
|
||||
|
||||
C:\Users\{username}\AppData\Roaming\Godot\app_userdata\BCIRPGR_mergedDemo
|
@ -0,0 +1,9 @@
|
||||
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?!
|
|
@ -92,9 +92,9 @@ TextEdit/colors/completion_scroll_color = Color( 1, 1, 1, 1 )
|
||||
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 = Color( 1, 1, 1, 1 )
|
||||
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( 1, 1, 1, 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/mark_color = Color( 1, 0.4, 0.4, 0.4 )
|
||||
@ -113,8 +113,8 @@ 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 = ExtResource( 1 )
|
||||
VBoxContainer/constants/separation = 4
|
||||
|
@ -18,7 +18,7 @@ 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 pSingleton = get_node("/root/PlayerCharacter")
|
||||
onready var charSheet = $Con_charSheet/MarginContainer/VBoxContainer/CharacterSheet
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ func _ready() -> void:
|
||||
option_three.show()
|
||||
|
||||
#Load character sheet:
|
||||
charSheet.text = pc.playerCharacterSingleton.pcText
|
||||
charSheet.text = pSingleton.pc.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.")
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
extends Node
|
||||
|
||||
var playerCharacterSingleton
|
||||
var pc
|
||||
|
||||
func _ready() -> void:
|
||||
playerCharacterSingleton = playerCharacterTemplate.new()
|
||||
pc = playerCharacterTemplate.new()
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
extends Control
|
||||
|
||||
onready var settings = get_node("/root/GlobalSaveInstance").settingsInstance
|
||||
onready var pSingleton = get_node("/root/PlayerCharacter").pc
|
||||
|
||||
var charFilePath
|
||||
var a
|
||||
@ -13,30 +14,35 @@ func _ready() -> void:
|
||||
theme=load(settings.themeFile)
|
||||
|
||||
func _on_Button_pressed():
|
||||
$VBoxContainer2/VBoxContainer/FileDialog.popup()
|
||||
$FileDialog.popup()
|
||||
|
||||
#this is going to take information from the file the player chose and put the individul parts into textboxes so it can be edited and then saved
|
||||
func _on_FileDialog_file_selected(path):
|
||||
var file = File.new()
|
||||
#read the text in the file, save it in the variable a
|
||||
file.open(path, File.READ)
|
||||
# a = int(file.get_line())
|
||||
a = file.get_as_text()
|
||||
|
||||
#split by the spaces so the individual pieces can be separated into textboxes
|
||||
var b = a.split(";")
|
||||
# for i in b.size():
|
||||
while file.eof_reached() == false:
|
||||
var csvStrArray = file.get_csv_line()
|
||||
var i = 0
|
||||
while i < b.size():
|
||||
var c = b[i]
|
||||
var d = c.split(":")
|
||||
var isLabel = true
|
||||
while i < csvStrArray.size():
|
||||
var csvStr = csvStrArray[i]
|
||||
if(isLabel):
|
||||
#make a new textbox for each piece of information
|
||||
var textLine = Label.new()
|
||||
$VBoxContainer2/VBoxContainer.add_child(textLine)
|
||||
var lineLabel = d[0]
|
||||
textLine.text = lineLabel
|
||||
$ScrollContainer/VBoxContainer.add_child(textLine)
|
||||
textLine.text = csvStr.to_upper()
|
||||
isLabel = false
|
||||
#DKM TEMP: save this unformatted to the singleton text string
|
||||
pSingleton.pcText += csvStr.to_upper() + ": "
|
||||
else:
|
||||
isLabel = true
|
||||
var textBox = LineEdit.new()
|
||||
$VBoxContainer2/VBoxContainer.add_child(textBox)
|
||||
if(d.size() > 1):
|
||||
textBox.text = d[1]
|
||||
$ScrollContainer/VBoxContainer.add_child(textBox)
|
||||
textBox.text = csvStr
|
||||
#DKM TEMP: save this unformatted to the singleton text string
|
||||
pSingleton.pcText += csvStr + "\n"
|
||||
i += 1
|
||||
file.close()
|
||||
|
@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://screens/ImportCharacter.gd" type="Script" id=3]
|
||||
[ext_resource path="res://userInterface/But_PlayButton.gd" type="Script" id=4]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@ -12,6 +13,15 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[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="Background" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -19,6 +29,20 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="FileDialog" type="FileDialog" parent="."]
|
||||
margin_left = 113.0
|
||||
margin_top = 24.0
|
||||
margin_right = 886.0
|
||||
margin_bottom = 480.0
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
access = 1
|
||||
current_dir = "user://characterFiles"
|
||||
current_path = "user://characterFiles/"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="." instance=ExtResource( 1 )]
|
||||
margin_left = -164.0
|
||||
margin_top = 0.0
|
||||
@ -26,70 +50,77 @@ margin_right = 164.0
|
||||
margin_bottom = 14.0
|
||||
text = "Import Character"
|
||||
|
||||
[node name="But_ChangeScene" parent="." instance=ExtResource( 2 )]
|
||||
margin_right = 92.0
|
||||
margin_bottom = 37.0
|
||||
[node name="But_Play" parent="." instance=ExtResource( 2 )]
|
||||
margin_left = 1.0
|
||||
margin_top = 34.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 71.0
|
||||
text = "Start Game"
|
||||
script = ExtResource( 4 )
|
||||
next_scene_path = "res://gamePlay/Game.tscn"
|
||||
|
||||
[node name="But_Cancel" parent="." instance=ExtResource( 2 )]
|
||||
margin_left = 1.0
|
||||
margin_top = 78.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 115.0
|
||||
text = "Back"
|
||||
next_scene_path = "res://Screens/MenuScreen.tscn"
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -164.0
|
||||
margin_top = -167.0
|
||||
margin_right = 164.0
|
||||
margin_bottom = 167.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2"]
|
||||
margin_right = 328.0
|
||||
anchor_left = 0.0634766
|
||||
anchor_top = 0.0583333
|
||||
anchor_right = 0.103516
|
||||
anchor_bottom = 0.0583333
|
||||
margin_left = 107.0
|
||||
margin_right = 435.0
|
||||
margin_bottom = 44.0
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
|
||||
[node name="But_OpenFile" type="Button" parent="VBoxContainer2/VBoxContainer"]
|
||||
margin_right = 328.0
|
||||
[node name="But_OpenFile" type="Button" parent="VBoxContainer2"]
|
||||
margin_right = 369.0
|
||||
margin_bottom = 20.0
|
||||
text = "Open Character File"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="FileDialog" type="FileDialog" parent="VBoxContainer2/VBoxContainer"]
|
||||
[node name="Save_Button" type="Button" parent="VBoxContainer2"]
|
||||
margin_top = 24.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 374.0
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
access = 1
|
||||
current_dir = "user://characterFiles"
|
||||
current_path = "user://characterFiles/"
|
||||
margin_right = 369.0
|
||||
margin_bottom = 44.0
|
||||
text = "Save"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -336.0
|
||||
margin_top = -173.0
|
||||
margin_right = 432.0
|
||||
margin_bottom = 286.0
|
||||
follow_focus = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="NameLabel" type="Label" parent="VBoxContainer2/VBoxContainer"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="NameLabel" type="Label" parent="ScrollContainer/VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 38.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="VBoxContainer2/VBoxContainer"]
|
||||
[node name="LineEdit" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 48.0
|
||||
margin_right = 58.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Save_Button" type="Button" parent="VBoxContainer2/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 328.0
|
||||
margin_bottom = 44.0
|
||||
text = "Save"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer2/VBoxContainer/But_OpenFile" to="." method="_on_Button_pressed"]
|
||||
[connection signal="file_selected" from="VBoxContainer2/VBoxContainer/FileDialog" to="." method="_on_FileDialog_file_selected"]
|
||||
[connection signal="file_selected" from="FileDialog" to="." method="_on_FileDialog_file_selected"]
|
||||
[connection signal="pressed" from="VBoxContainer2/But_OpenFile" to="." method="_on_Button_pressed"]
|
||||
|
@ -37,8 +37,8 @@ __meta__ = {
|
||||
[node name="But_ChoosePlayer" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_right = 238.0
|
||||
margin_bottom = 98.0
|
||||
text = "Select Character"
|
||||
next_scene_path = "res://screens/Character_Load.tscn"
|
||||
text = "Import Character"
|
||||
next_scene_path = "res://screens/ImportCharacter.tscn"
|
||||
|
||||
[node name="But_AddChar" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 102.0
|
||||
|
@ -7,7 +7,7 @@ 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: = ""
|
||||
|
||||
var tempToggle = 0
|
||||
|
||||
|
||||
func _on_But_NewGame_button_up():
|
||||
get_tree().change_scene(next_scene_path)
|
||||
|
@ -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:
|
||||
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 ""
|
||||
|
Loading…
Reference in New Issue
Block a user