Change 2 for cleanup

This commit is contained in:
PersonGuyGit
2023-07-09 12:28:09 -06:00
parent 707e8a5b16
commit 2c971b6e7c
1741 changed files with 0 additions and 0 deletions

View File

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

View File

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

View File

@ -0,0 +1,39 @@
#BUT_HISTORY:
# Unique script attached to the But_History to hide/show history versus
# current game page.
tool
extends Button
onready var game_history_array = get_node("/root/History").historyScreensSingleton.output_history_array
var is_history = false
func _on_But_History_button_up():
var history_pager_button = get_node("../../ItemList/But_History_Page")
var history_rows_node = get_node("../../GameInfo/HistoryRows")
var current_text_node = get_node("../../GameInfo/CurrentText")
var option_one = get_node("../../InputArea/VBoxContainer/option1")
var option_two = get_node("../../InputArea/VBoxContainer/option2")
var option_three = get_node("../../InputArea/VBoxContainer/option3")
if(!is_history):
if(game_history_array != null):
history_rows_node.add_child(game_history_array[0])
history_pager_button.show()
history_rows_node.show()
current_text_node.hide()
option_one.hide()
option_two.hide()
option_three.hide()
is_history = true
else:
history_pager_button.hide()
history_rows_node.hide()
current_text_node.show()
option_one.show()
option_two.show()
option_three.show()
is_history = false

View File

@ -0,0 +1,21 @@
#BUT_HISTORY_PAGE:
# Unique paging script for showing next page in the history game's history
# array.
tool
extends Button
var current_page = 0
func _on_But_History_Page_button_up():
var game_history_array = get_node("/root/History").historyScreensSingleton.output_history_array
var history_rows_node = get_node("../../GameInfo/HistoryRows")
if(current_page < game_history_array.size()-1):
current_page += 1
else:
current_page = 0
history_rows_node.remove_child(history_rows_node.get_child(0))
history_rows_node.add_child(game_history_array[current_page])

View File

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

View File

@ -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()))

View File

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

View File

@ -0,0 +1,14 @@
tool
extends Button
func _on_But_ResumeGame_button_up():
var root = get_node("/root")
var thisScene = get_node("/root/MoreOptions")
var gameSingleton = get_node("/root/GameCurrent")
var gameScene = gameSingleton.gameCurrent_scene
root.remove_child(thisScene)
#DKM TEMP: cleanup this scene!
thisScene.queue_free()
root.add_child(gameScene)

View File

@ -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()

View File

@ -0,0 +1,5 @@
extends VBoxContainer
func set_text(input: String, response: String):
$InputHistory.text = input
$Response.text = response

View File

@ -0,0 +1,22 @@
[gd_scene load_steps=3 format=2]
[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 = 14.0
text = " > This is what user selected"
autowrap = true
[node name="Response" parent="." instance=ExtResource( 2 )]
margin_top = 18.0
margin_bottom = 32.0

View File

@ -0,0 +1,49 @@
#LOCALE CLASS:
# Template script for the Locale scene; allows for connecting exits, and also
# maintains a visited bool (currently un-used) and takes additional
# options via the GUI:
# 1. Name
# 2. Description
# 3. The 3 option strings available at the location
#
extends PanelContainer
#Allows Godot to handle autocomplete and 'register' class
class_name Locale
var locale_name = "Location Name"
var locale_description = "This is the description of the location."
var locale_action = "Default action"
var locale_action_params = []
var options_array = []
var destinations_array = []
var visited = false;
var exits: Dictionary = {}
#DKM TEMP: right now connects both directions, but can make an alt func that c
# connects just one way for example (for one-way-doors)
# currently not in use, but the override defaults false but if passed can let
# you apply custom direction
func connect_exit(direction: String, locale: Locale, override_direction: bool = false):
if(!override_direction):
match direction:
"west":
exits[direction] = locale
locale.exits["east"] = self
"east":
exits[direction] = locale
locale.exits["west"] = self
"north":
exits[direction] = locale
locale.exits["south"] = self
"south":
exits[direction] = locale
locale.exits["north"] = self
_:
printerr("Tried to connect invalid direction: %s", direction)
else:
exits[direction] = locale

View File

@ -0,0 +1,35 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://userInterface/Locale.gd" type="Script" id=3]
[node name="Locale" type="PanelContainer"]
margin_right = 250.001
margin_bottom = 200.0
rect_min_size = Vector2( 250, 200 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_left = 7.0
margin_top = 7.0
margin_right = 243.001
margin_bottom = 193.0
[node name="Rows" type="VBoxContainer" parent="MarginContainer"]
margin_right = 236.0
margin_bottom = 186.0
[node name="LocaleName" type="Label" parent="MarginContainer/Rows"]
margin_right = 236.0
margin_bottom = 14.0
text = "Locale Name"
align = 1
[node name="LocaleDescription" type="Label" parent="MarginContainer/Rows"]
margin_top = 18.0
margin_right = 236.0
margin_bottom = 49.0
text = "This is the description text for the locale. "
autowrap = true

View File

@ -0,0 +1,10 @@
extends Button
signal option_pressed(destinationLabel)
var destinationLabel
#DKM TEMP: test
func _on_Option_button_up() -> void:
print("Button pushed!")
emit_signal("option_pressed", destinationLabel)

View File

@ -0,0 +1,16 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://userInterface/Option.gd" type="Script" id=1]
[node name="Option" type="Button"]
margin_top = 30.0
margin_right = 984.0
margin_bottom = 68.0
text = "Option # "
align = 0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_up" from="." to="." method="_on_Option_button_up"]

View File

@ -0,0 +1,11 @@
[gd_scene format=2]
[node name="Response" type="Label"]
margin_top = 30.0
margin_right = 984.0
margin_bottom = 68.0
text = "Game text continues here... "
autowrap = true
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,14 @@
[gd_scene format=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
text = "Main Menu"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}