mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Created 3 new submenu folders
Created folders for Settings, LoadGame, and AddCharacter submenus
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
#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: = ""
|
||||
|
||||
var tempToggle = 0
|
||||
|
||||
func _on_But_NewGame_button_up():
|
||||
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,15 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=1]
|
||||
|
||||
[node name="But_ChangeScene" type="Button"]
|
||||
margin_right = 130.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_vertical = 3
|
||||
text = "New Game"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="button_up" from="." to="." method="_on_But_NewGame_button_up"]
|
@ -0,0 +1,34 @@
|
||||
#BUT_QUIT:
|
||||
# Unique script for ending a game. Will additionally perform or call needed
|
||||
# shut down and close-out functionality.
|
||||
|
||||
extends Button
|
||||
|
||||
var history_JSON = "user://history.json"
|
||||
|
||||
|
||||
#DKM TEMP: save history is only here temporarily -- needs to move upstream.
|
||||
func _on_But_Quit_button_up():
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
#JSON: requires dictionaries:
|
||||
#func _saveHistory_JSON() -> void:
|
||||
# var history_screens_arr = get_node("/root/History").historyScreensSingleton.output_history_array
|
||||
# var file = File.new()
|
||||
# file.open(history_JSON, File.WRITE)
|
||||
# file.store_string(to_json(history_screens_arr))
|
||||
#
|
||||
# file.close()
|
||||
# # #DKM TEMP:
|
||||
# print("Saved history array size should be: " + str(history_screens_arr.size()))
|
||||
|
||||
|
||||
#DKM TEMP:
|
||||
#tres file:
|
||||
#func _saveHistory() -> void:
|
||||
# var history_screens = get_node("/root/History").historyScreensSingleton
|
||||
# assert(ResourceSaver.save("user://history.tres", history_screens)==OK)
|
||||
# #DKM TEMP:
|
||||
# print("Saved history array size: " + str(history_screens.output_history_array.size()))
|
||||
|
@ -0,0 +1,15 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://UserInterface/But_Quit.gd" type="Script" id=1]
|
||||
|
||||
[node name="But_Quit" type="Button"]
|
||||
margin_top = 240.0
|
||||
margin_right = 179.0
|
||||
margin_bottom = 284.0
|
||||
text = "Quit"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="button_up" from="." to="." method="_on_But_Quit_button_up"]
|
@ -0,0 +1,80 @@
|
||||
#BUT_SAVESETTINGS:
|
||||
# Unique script for saving settings on player settings scene.
|
||||
|
||||
|
||||
#Tool lets you any code in editor, such as plugins
|
||||
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: = ""
|
||||
|
||||
#Button response: save settings and move on.
|
||||
func _on_But_NewGame_button_up():
|
||||
var inputName = get_node("../../VBoxContainer/HBoxContainer/input_name")
|
||||
var inputRisk = get_node("../../VBoxContainer/HBoxContainer2/input_risk")
|
||||
_saveSettings(inputName.text, inputRisk.text)
|
||||
get_tree().change_scene(next_scene_path)
|
||||
|
||||
|
||||
#HELPER FUNCTIONS:
|
||||
func _get_configuration_warning() -> String:
|
||||
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""
|
||||
|
||||
|
||||
#CONFIG/INI SAVE:
|
||||
func _saveSettings(inputSettings : String, riskFactor : String) -> void:
|
||||
var player_settings = get_node("/root/PlayerSettings")
|
||||
player_settings.playerSettingsSingleton.inputName = inputSettings
|
||||
player_settings.playerSettingsSingleton.riskFactor = riskFactor
|
||||
var config = ConfigFile.new()
|
||||
|
||||
config.set_value("Temp player","InputSettings", inputSettings)
|
||||
config.set_value("Temp player","RiskFactor", riskFactor)
|
||||
|
||||
config.save("user://settings.cfg")
|
||||
|
||||
#JSON SAVE:
|
||||
#func _saveSettings(inputSettings : String, riskFactor : String) -> void:
|
||||
# var player_settings = get_node("/root/PlayerSettings")
|
||||
# player_settings.playerSettingsSingleton.inputName = inputSettings
|
||||
# player_settings.playerSettingsSingleton.riskFactor = riskFactor
|
||||
# #Temp:
|
||||
# var temp_manual_JSON = {
|
||||
# "playerSettingsTemplate": {
|
||||
# "inputName": inputSettings,
|
||||
# "riskFactor": riskFactor
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# #Save to file (JSON for now)
|
||||
# var settings_file = "user://testPlayerSettings.sav"
|
||||
# var file = File.new()
|
||||
# if file.open(settings_file, File.WRITE) != 0:
|
||||
# print("Cannot write temporary file to: " + settings_file)
|
||||
# else:
|
||||
# file.store_line(to_json(temp_manual_JSON))
|
||||
# file.close()
|
||||
|
||||
|
||||
#****This save Settings functions as designed; but modified to work with alternate approach of loading
|
||||
#func _saveSettings(inputSettings : String, riskFactor : String) -> void:
|
||||
#Debugging:
|
||||
# print("Input name: " + inputSettings + "; and risk factor set to : " + riskFactor)
|
||||
# var player_settings = get_node("/root/PlayerSettings")
|
||||
# player_settings.playerSettingsSingleton.inputName = inputSettings
|
||||
# player_settings.playerSettingsSingleton.riskFactor = riskFactor
|
||||
|
||||
#Save to file (for now)
|
||||
# if settings_save_file_name == "":
|
||||
# settings_save_file_name = "settings.save"
|
||||
# var settings_file = "user://" + settings_save_file_name
|
||||
# var file = File.new()
|
||||
# file.open(settings_file, File.WRITE)
|
||||
# file.store_var(player_settings.playerSettingsSingleton.inputName)
|
||||
#DKM TEMP: To save object; removed for testing
|
||||
#file.store_var(player_settings.playerSettingsSingleton, true)
|
||||
# file.close()
|
||||
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
extends VBoxContainer
|
||||
|
||||
func set_text(input: String, response: String):
|
||||
$InputHistory.text = input
|
||||
$Response.text = response
|
@ -0,0 +1,25 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://UserInterface/Response.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://UserInterface/InputResponse.gd" type="Script" id=3]
|
||||
|
||||
[node name="InputResponse" type="VBoxContainer"]
|
||||
margin_right = 984.0
|
||||
margin_bottom = 68.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="InputHistory" type="Label" parent="."]
|
||||
margin_right = 984.0
|
||||
margin_bottom = 23.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
custom_colors/font_color = Color( 0.686275, 0.658824, 0.658824, 1 )
|
||||
text = " > This is what user selected"
|
||||
autowrap = true
|
||||
|
||||
[node name="Response" parent="." instance=ExtResource( 2 )]
|
||||
margin_top = 27.0
|
||||
margin_bottom = 61.0
|
@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=2]
|
||||
|
||||
[node name="Response" type="Label"]
|
||||
margin_top = 30.0
|
||||
margin_right = 984.0
|
||||
margin_bottom = 68.0
|
||||
theme = ExtResource( 2 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Game text continues here... "
|
||||
autowrap = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://assets/base_dynamicFont_BIG.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=2]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
default_font = ExtResource( 2 )
|
||||
|
||||
[node name="Title" type="Label"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -110.5
|
||||
margin_top = 114.422
|
||||
margin_right = 110.5
|
||||
margin_bottom = 180.422
|
||||
theme = SubResource( 1 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Main Menu"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
Reference in New Issue
Block a user