mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Change 2 for cleanup
This commit is contained in:
@ -0,0 +1,109 @@
|
||||
[gd_scene load_steps=4 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/grabFocus.gd" type="Script" id=3]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 2.0
|
||||
margin_bottom = 2.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="VBoxContainer2" instance=ExtResource( 1 )]
|
||||
anchor_left = 0.0
|
||||
anchor_right = 0.0
|
||||
margin_left = 0.0
|
||||
margin_top = 0.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 66.0
|
||||
text = "Import Character"
|
||||
|
||||
[node name="But_ChangeScene" parent="VBoxContainer2/Title" instance=ExtResource( 2 )]
|
||||
margin_right = 106.0
|
||||
margin_bottom = 51.0
|
||||
text = "Back"
|
||||
next_scene_path = "res://Screens/MenuScreen.tscn"
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2"]
|
||||
margin_top = 70.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 118.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="But_OpenFile" type="Button" parent="VBoxContainer2/VBoxContainer"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 20.0
|
||||
text = "Open Character File"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="FileDialog" type="FileDialog" parent="VBoxContainer2/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 374.0
|
||||
rect_min_size = Vector2( 400, 140 )
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
access = 2
|
||||
current_dir = "/Users/BD_1/Documents/Godot/mainmenu:impchar/rpg"
|
||||
current_path = "/Users/BD_1/Documents/Godot/mainmenu:impchar/rpg/"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="NameLabel" type="Label" parent="VBoxContainer2/VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 38.0
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="VBoxContainer2/VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 48.0
|
||||
|
||||
[node name="Save_Button" type="Button" parent="VBoxContainer2/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 44.0
|
||||
text = "Save"
|
||||
|
||||
[node name="VBoxContainer3" type="VBoxContainer" parent="VBoxContainer2/VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 48.0
|
||||
|
||||
[node name="textBox" type="LineEdit" parent="VBoxContainer2/VBoxContainer/VBoxContainer3"]
|
||||
visible = false
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 24.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="But_Remember" type="Button" parent="VBoxContainer2"]
|
||||
margin_top = 122.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 142.0
|
||||
text = "Remember File"
|
||||
|
||||
[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="pressed" from="VBoxContainer2/VBoxContainer/Save_Button" to="." method="_on_Save_Button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer2/But_Remember" to="." method="_on_But_Remember_pressed"]
|
27
Phase2/Godot_GameCode/ImportCharacter/screens/LoadGame.tscn
Normal file
27
Phase2/Godot_GameCode/ImportCharacter/screens/LoadGame.tscn
Normal file
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 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/grabFocus.gd" type="Script" id=3]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="." instance=ExtResource( 1 )]
|
||||
anchor_left = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 0.0
|
||||
margin_top = 0.0
|
||||
margin_right = 0.0
|
||||
margin_bottom = 0.0
|
||||
text = "Multiplayer (temp)"
|
||||
|
||||
[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )]
|
||||
text = "Temp: back to menu"
|
||||
next_scene_path = "res://Screens/MenuScreen.tscn"
|
@ -0,0 +1,9 @@
|
||||
#MENUSCREEN:
|
||||
# Script purely to grab focus for tabbing control
|
||||
|
||||
extends Control
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$VBoxContainer/But_NewGame.grab_focus()
|
@ -0,0 +1,98 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Screens/MenuScreen.gd" type="Script" id=2]
|
||||
[ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://assets/ui_controlNode_dark_theme.tres" type="Theme" id=6]
|
||||
[ext_resource path="res://UserInterface/But_Quit.tscn" type="PackedScene" id=10]
|
||||
|
||||
[node name="MenuScreen" type="Control"]
|
||||
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
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 2.0
|
||||
margin_bottom = 2.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="." instance=ExtResource( 5 )]
|
||||
margin_top = 51.8676
|
||||
margin_bottom = 117.868
|
||||
theme = null
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.503333
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.503333
|
||||
margin_left = -119.0
|
||||
margin_top = -152.0
|
||||
margin_right = 119.0
|
||||
margin_bottom = 152.0
|
||||
rect_scale = Vector2( 1.04675, 1.07389 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="But_NewGame" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_right = 238.0
|
||||
margin_bottom = 49.0
|
||||
next_scene_path = "res://screens/NewGame.tscn"
|
||||
|
||||
[node name="But_LoadGame" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 53.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 103.0
|
||||
text = "Load Game"
|
||||
next_scene_path = "res://screens/LoadGame.tscn"
|
||||
|
||||
[node name="But_Multiplayer" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 107.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 156.0
|
||||
text = "Multiplayer"
|
||||
next_scene_path = "res://Screens/Multiplayer.tscn"
|
||||
|
||||
[node name="But_ImportChar" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 160.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 210.0
|
||||
text = "Import Character"
|
||||
next_scene_path = "res://Screens/ImportCharacter.tscn"
|
||||
|
||||
[node name="But_Settings" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 214.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 263.0
|
||||
text = "Settings"
|
||||
next_scene_path = "res://Screens/Settings.tscn"
|
||||
|
||||
[node name="But_Quit" parent="VBoxContainer" instance=ExtResource( 10 )]
|
||||
margin_top = 267.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 303.0
|
||||
|
||||
[node name="Version" type="Label" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -177.0
|
||||
margin_top = -44.0
|
||||
margin_right = -5.0
|
||||
margin_bottom = -6.0
|
||||
text = "Version: 0.0.0"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 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/grabFocus.gd" type="Script" id=3]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="." instance=ExtResource( 1 )]
|
||||
anchor_left = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 0.0
|
||||
margin_top = 0.0
|
||||
margin_right = 0.0
|
||||
margin_bottom = 0.0
|
||||
text = "Multiplayer (temp)"
|
||||
|
||||
[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )]
|
||||
text = "Temp: back to menu"
|
||||
next_scene_path = "res://Screens/MenuScreen.tscn"
|
27
Phase2/Godot_GameCode/ImportCharacter/screens/NewGame.tscn
Normal file
27
Phase2/Godot_GameCode/ImportCharacter/screens/NewGame.tscn
Normal file
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 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/grabFocus.gd" type="Script" id=3]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="." instance=ExtResource( 1 )]
|
||||
anchor_left = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 0.0
|
||||
margin_top = 0.0
|
||||
margin_right = 0.0
|
||||
margin_bottom = 0.0
|
||||
text = "Multiplayer (temp)"
|
||||
|
||||
[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )]
|
||||
text = "Temp: back to menu"
|
||||
next_scene_path = "res://Screens/MenuScreen.tscn"
|
27
Phase2/Godot_GameCode/ImportCharacter/screens/Settings.tscn
Normal file
27
Phase2/Godot_GameCode/ImportCharacter/screens/Settings.tscn
Normal file
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 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/grabFocus.gd" type="Script" id=3]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="." instance=ExtResource( 1 )]
|
||||
anchor_left = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 0.0
|
||||
margin_top = 0.0
|
||||
margin_right = 0.0
|
||||
margin_bottom = 0.0
|
||||
text = "Multiplayer (temp)"
|
||||
|
||||
[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )]
|
||||
text = "Temp: back to menu"
|
||||
next_scene_path = "res://Screens/MenuScreen.tscn"
|
@ -0,0 +1,5 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Screens/MenuScreen.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="MenuScreen" instance=ExtResource( 1 )]
|
17
Phase2/Godot_GameCode/ImportCharacter/screens/Temp_Button.gd
Normal file
17
Phase2/Godot_GameCode/ImportCharacter/screens/Temp_Button.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends Button
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
var tempToggle = 0
|
||||
|
||||
func _on_Button_button_up():
|
||||
var controlNode = get_node("../../")
|
||||
print(controlNode.name)
|
||||
if(tempToggle == 0):
|
||||
controlNode.theme=load("res://assets/ui_controlNode_dark_theme.tres")
|
||||
tempToggle = 1
|
||||
else:
|
||||
controlNode.theme=load("res://assets/ui_controlNode_light_theme.tres")
|
||||
tempToggle = 0
|
60
Phase2/Godot_GameCode/ImportCharacter/screens/grabFocus.gd
Normal file
60
Phase2/Godot_GameCode/ImportCharacter/screens/grabFocus.gd
Normal file
@ -0,0 +1,60 @@
|
||||
extends Control
|
||||
#charFilePath will hold the file path for the character file, fileText will hold the text in the file
|
||||
var charFilePath = ""
|
||||
var fileText
|
||||
|
||||
func _ready() -> void:
|
||||
#grab focus will make it so tab can be used to move between options
|
||||
$VBoxContainer2/Title/But_ChangeScene.grab_focus()
|
||||
|
||||
var save_game = File.new()
|
||||
if save_game.file_exists("user://savegame.save"):
|
||||
save_game.open("user://savegame.save", File.READ)
|
||||
var tempPath = save_game.get_as_text()
|
||||
displayInfo(tempPath)
|
||||
|
||||
save_game.close()
|
||||
|
||||
func displayInfo(path):
|
||||
var file = File.new()
|
||||
#read the text in the file, save it in the variable fileText, display in textBox
|
||||
file.open(path, File.READ)
|
||||
|
||||
fileText = file.get_as_text()
|
||||
|
||||
$VBoxContainer2/VBoxContainer/VBoxContainer3/textBox.visible = true
|
||||
$VBoxContainer2/VBoxContainer/VBoxContainer3/textBox.text = fileText
|
||||
#
|
||||
|
||||
#save the file path in the global var to use it in the other function
|
||||
charFilePath = path
|
||||
file.close()
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
$VBoxContainer2/VBoxContainer/FileDialog.popup()
|
||||
|
||||
func _on_FileDialog_file_selected(path):
|
||||
displayInfo(path)
|
||||
|
||||
#when they've made the changes and pressed save:
|
||||
func _on_Save_Button_pressed():
|
||||
#open the same file so that changes can be written to it
|
||||
var file = File.new()
|
||||
file.open(charFilePath, File.WRITE)
|
||||
|
||||
#store the text from the textbox back into the file
|
||||
var content = ""
|
||||
var currentWord = $VBoxContainer2/VBoxContainer/VBoxContainer3/textBox.text
|
||||
|
||||
content = currentWord
|
||||
file.store_string(content)
|
||||
file.close()
|
||||
|
||||
|
||||
func _on_But_Remember_pressed():
|
||||
#save the path of the file so that it can be automatically opened next time
|
||||
var save_game = File.new()
|
||||
save_game.open("user://savegame.save", File.WRITE)
|
||||
save_game.store_string(charFilePath)
|
||||
save_game.close()
|
Reference in New Issue
Block a user