mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Updates MVP Game Code for XML (cont'd)
Updates working XML and continues update on file parser; currently working on building the dict we can use to run our game (as JSON version currently runs game).
This commit is contained in:
parent
8d3f317f01
commit
de608e7c33
@ -1,86 +1,86 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<root>
|
<root>
|
||||||
<Node_Boat0>
|
<Location>
|
||||||
<Id>Boat_000</Id>
|
<Id>Boat_000</Id>
|
||||||
<Action>ShowText</Action>
|
<Action>ShowText</Action>
|
||||||
<A_Params></A_Params>
|
<A_Params></A_Params>
|
||||||
<Text>The game has begun! You may select from the options below. You are in a boat. You have been shipwrecked. You can leave the boat through a hatch.</Text>
|
<Text>The game has begun! You may select from the options below. You are in a boat. You have been shipwrecked. You can leave the boat through a hatch.</Text>
|
||||||
<Option_Labels>Examine Ship</Option_Labels>
|
<Option_Labels_001>Examine Ship</Option_Labels_001>
|
||||||
<Option_Labels>Climb out through hatch</Option_Labels>
|
<Option_Labels_002>Climb out through hatch</Option_Labels_002>
|
||||||
<Option_Labels>Play the fiddle!</Option_Labels>
|
<Option_Labels_003>Play the fiddle!</Option_Labels_003>
|
||||||
<Option_Labels>Rest</Option_Labels>
|
<Option_Labels_004>Rest</Option_Labels_004>
|
||||||
<Option_Labels>Meditate</Option_Labels>
|
<Option_Labels_005>Meditate</Option_Labels_005>
|
||||||
<Option_GoTos>Boat_002</Option_GoTos>
|
<Option_GoTos_001>Boat_002</Option_GoTos_001>
|
||||||
<Option_GoTos>Shore_001</Option_GoTos>
|
<Option_GoTos_002>Shore_001</Option_GoTos_002>
|
||||||
<Option_GoTos>Misc_001</Option_GoTos>
|
<Option_GoTos_003>Misc_001</Option_GoTos_003>
|
||||||
<Option_GoTos>Misc_002</Option_GoTos>
|
<Option_GoTos_004>Misc_002</Option_GoTos_004>
|
||||||
<Option_GoTos>Misc_003</Option_GoTos>
|
<Option_GoTos_005>Misc_003</Option_GoTos_005>
|
||||||
</Node_Boat0>
|
</Location>
|
||||||
<Node_Boat1>
|
<Location>
|
||||||
<Id>Boat_001</Id>
|
<Id>Boat_001</Id>
|
||||||
<Action>ShowText</Action>
|
<Action>ShowText</Action>
|
||||||
<A_Params></A_Params>
|
<A_Params></A_Params>
|
||||||
<Text>The boat rocks gently. You can leave the boat through a hatch. There is also now a test option.</Text>
|
<Text>The boat rocks gently. You can leave the boat through a hatch. There is also now a test option.</Text>
|
||||||
<Option_Labels>Examine Ship</Option_Labels>
|
<Option_Labels_001>Examine Ship</Option_Labels_001>
|
||||||
<Option_Labels>Climb out through hatch</Option_Labels>
|
<Option_Labels_002>Climb out through hatch</Option_Labels_002>
|
||||||
<Option_Labels>Play the fiddle!</Option_Labels>
|
<Option_Labels_003>Play the fiddle!</Option_Labels_003>
|
||||||
<Option_Labels>Rest</Option_Labels>
|
<Option_Labels_004>Rest</Option_Labels_004>
|
||||||
<Option_Labels>Meditate</Option_Labels>
|
<Option_Labels_005>Meditate</Option_Labels_005>
|
||||||
<Option_Labels>Run die roll test</Option_Labels>
|
<Option_Labels_006>Run die roll test</Option_Labels_006>
|
||||||
<Option_GoTos>Boat_002</Option_GoTos>
|
<Option_GoTos_001>Boat_002</Option_GoTos_001>
|
||||||
<Option_GoTos>Shore_001</Option_GoTos>
|
<Option_GoTos_002>Shore_001</Option_GoTos_002>
|
||||||
<Option_GoTos>Misc_001</Option_GoTos>
|
<Option_GoTos_003>Misc_001</Option_GoTos_003>
|
||||||
<Option_GoTos>Misc_002</Option_GoTos>
|
<Option_GoTos_004>Misc_002</Option_GoTos_004>
|
||||||
<Option_GoTos>Misc_003</Option_GoTos>
|
<Option_GoTos_005>Misc_003</Option_GoTos_005>
|
||||||
<Option_GoTos>Test_000</Option_GoTos>
|
<Option_GoTos_006>Test_000</Option_GoTos_006>
|
||||||
</Node_Boat1>
|
</Location>
|
||||||
<Node_Boat_002>
|
<Location>
|
||||||
<Id>Boat_002</Id>
|
<Id>Boat_002</Id>
|
||||||
<Action>ShowText</Action>
|
<Action>ShowText</Action>
|
||||||
<A_Params></A_Params>
|
<A_Params></A_Params>
|
||||||
<Text>The boat is old and wrecked.</Text>
|
<Text>The boat is old and wrecked.</Text>
|
||||||
<Option_Labels>Continue</Option_Labels>
|
<Option_Labels_001>Continue</Option_Labels_001>
|
||||||
<Option_GoTos>Boat_001</Option_GoTos>
|
<Option_GoTos_001>Boat_001</Option_GoTos_001>
|
||||||
</Node_Boat_002>
|
</Location>
|
||||||
<Node_Shore_001>
|
<Location>
|
||||||
<Id>Shore_001</Id>
|
<Id>Shore_001</Id>
|
||||||
<Action>ShowText</Action>
|
<Action>ShowText</Action>
|
||||||
<A_Params></A_Params>
|
<A_Params></A_Params>
|
||||||
<Text>You've reached the shore!</Text>
|
<Text>You've reached the shore!</Text>
|
||||||
<Option_Labels>Return to boat</Option_Labels>
|
<Option_Labels_001>Return to boat</Option_Labels_001>
|
||||||
<Option_GoTos>Boat_001</Option_GoTos>
|
<Option_GoTos_001>Boat_001</Option_GoTos_001>
|
||||||
</Node_Shore_001>
|
</Location>
|
||||||
<Node_Misc_001>
|
<Location>
|
||||||
<Id>Misc_001</Id>
|
<Id>Misc_001</Id>
|
||||||
<Action>ShowText</Action>
|
<Action>ShowText</Action>
|
||||||
<A_Params></A_Params>
|
<A_Params></A_Params>
|
||||||
<Text>You pull a fiddle from your sack and play it, while dancing around merrily. Great fun is had.</Text>
|
<Text>You pull a fiddle from your sack and play it, while dancing around merrily. Great fun is had.</Text>
|
||||||
<Option_Labels>Resume your quest</Option_Labels>
|
<Option_Labels_001>Resume your quest</Option_Labels_001>
|
||||||
<Option_GoTos>Boat_001</Option_GoTos>
|
<Option_GoTos_001>Boat_001</Option_GoTos_001>
|
||||||
</Node_Misc_001>
|
</Location>
|
||||||
<Node_Misc_002>
|
<Location>
|
||||||
<Id>Misc_002</Id>
|
<Id>Misc_002</Id>
|
||||||
<Action>ShowText</Action>
|
<Action>ShowText</Action>
|
||||||
<A_Params></A_Params>
|
<A_Params></A_Params>
|
||||||
<Text>You pull out a blanket, settle your burdens and take a short rest.</Text>
|
<Text>You pull out a blanket, settle your burdens and take a short rest.</Text>
|
||||||
<Option_Labels>Resume your quest</Option_Labels>
|
<Option_Labels_001>Resume your quest</Option_Labels_001>
|
||||||
<Option_GoTos>Boat_001</Option_GoTos>
|
<Option_GoTos_001>Boat_001</Option_GoTos_001>
|
||||||
</Node_Misc_002>
|
</Location>
|
||||||
<Node_Misc_003>
|
<Location>
|
||||||
<Id>Misc_003</Id>
|
<Id>Misc_003</Id>
|
||||||
<Action>ShowText</Action>
|
<Action>ShowText</Action>
|
||||||
<A_Params></A_Params>
|
<A_Params></A_Params>
|
||||||
<Text>You find a quiet corner on the boat, put down your burden, and feel the rocking of the boat. You rest mind and body, and really I'm experimenting with options and sizes of them, added via JSON here. So in your meditation you have a vision: a sparrow flies high over the mountains and reveals a castle! After this reverie, you awake.</Text>
|
<Text>You find a quiet corner on the boat, put down your burden, and feel the rocking of the boat. You rest mind and body, and really I'm experimenting with options and sizes of them, added via JSON here. So in your meditation you have a vision: a sparrow flies high over the mountains and reveals a castle! After this reverie, you awake.</Text>
|
||||||
<Option_Labels>Resume your quest</Option_Labels>
|
<Option_Labels_001>Resume your quest</Option_Labels_001>
|
||||||
<Option_GoTos>Boat_001</Option_GoTos>
|
<Option_GoTos_001>Boat_001</Option_GoTos_001>
|
||||||
</Node_Misc_003>
|
</Location>
|
||||||
<Node_Test0>
|
<Location>
|
||||||
<Id>Test_000</Id>
|
<Id>Test_000</Id>
|
||||||
<Action>TestDieRollAction</Action>
|
<Action>TestDieRollAction</Action>
|
||||||
<A_Params>4</A_Params>
|
<A_Params>4</A_Params>
|
||||||
<A_Params>6</A_Params>
|
<A_Params>6</A_Params>
|
||||||
<Text>NA</Text>
|
<Text>NA</Text>
|
||||||
<Option_Labels>NA</Option_Labels>
|
<Option_Labels_001>NA</Option_Labels_001>
|
||||||
<Option_GoTos>Boat_001</Option_GoTos>
|
<Option_GoTos_001>Boat_001</Option_GoTos_001>
|
||||||
</Node_Test0>
|
</Location>
|
||||||
</root>
|
</root>
|
@ -1,16 +1,16 @@
|
|||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://gamePlay/Game.gd" type="Script" id=1]
|
[ext_resource path="res://assets/ui_controlNode_dark_theme.tres" type="Theme" id=1]
|
||||||
[ext_resource path="res://gamePlay/But_MoreOptions.gd" type="Script" id=2]
|
[ext_resource path="res://gamePlay/But_Option.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://gamePlay/But_Option.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://gamePlay/Game.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=4]
|
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=4]
|
||||||
[ext_resource path="res://assets/ui_controlNode_dark_theme.tres" type="Theme" id=5]
|
[ext_resource path="res://gamePlay/But_MoreOptions.gd" type="Script" id=5]
|
||||||
|
|
||||||
[node name="Game" type="Control"]
|
[node name="Game" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
theme = ExtResource( 5 )
|
theme = ExtResource( 1 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="Background" type="PanelContainer" parent="."]
|
[node name="Background" type="PanelContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -46,7 +46,7 @@ rect_min_size = Vector2( 0, 40 )
|
|||||||
margin_right = 197.0
|
margin_right = 197.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
text = "More Options"
|
text = "More Options"
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 5 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ margin_right = 108.0
|
|||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
custom_constants/separation = 5
|
custom_constants/separation = 5
|
||||||
|
|
||||||
[node name="option1" type="Button" parent="Background/MarginContainer/Rows/InputArea/ScrollContainer/OptionsContainer" instance=ExtResource( 3 )]
|
[node name="option1" type="Button" parent="Background/MarginContainer/Rows/InputArea/ScrollContainer/OptionsContainer" instance=ExtResource( 2 )]
|
||||||
margin_right = 108.0
|
margin_right = 108.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
custom_fonts/font = ExtResource( 4 )
|
custom_fonts/font = ExtResource( 4 )
|
||||||
|
@ -95,7 +95,7 @@ func loadJSONToDict(filepath:String)->Dictionary:
|
|||||||
func loadXMLDemo(filepath:String):
|
func loadXMLDemo(filepath:String):
|
||||||
print("TEST! Trying to open xml at " + filepath)
|
print("TEST! Trying to open xml at " + filepath)
|
||||||
|
|
||||||
var test_array = []
|
var xml_data = {}
|
||||||
var parser = XMLParser.new()
|
var parser = XMLParser.new()
|
||||||
var error = parser.open(filepath)
|
var error = parser.open(filepath)
|
||||||
if error != OK:
|
if error != OK:
|
||||||
@ -111,19 +111,50 @@ func loadXMLDemo(filepath:String):
|
|||||||
|
|
||||||
#DKM TEMP: printer; probably don't need the strip_edges, was looking to remove white space.
|
#DKM TEMP: printer; probably don't need the strip_edges, was looking to remove white space.
|
||||||
# Looks like it reads the closing tags, too, which is a bummer.
|
# Looks like it reads the closing tags, too, which is a bummer.
|
||||||
while true:
|
|
||||||
if parser.read() != OK:
|
#DKM TEMP: Test print output brute force
|
||||||
print("Parser read not okay!")
|
# while true:
|
||||||
return
|
# if parser.read() != OK:
|
||||||
else:
|
# print("Parser read not okay!")
|
||||||
var px = parser.get_node_name()
|
# return
|
||||||
px.strip_edges(true,true)
|
# else:
|
||||||
if(!px.empty()):
|
# var px = parser.get_node_name()
|
||||||
print("Node Named: " + px)
|
# px.strip_edges(true,true)
|
||||||
px = parser.get_node_data()
|
# if(!px.empty()):
|
||||||
px.strip_edges(true,true)
|
# print("Node Named: " + px)
|
||||||
if(!px.empty()):
|
# px = parser.get_node_data()
|
||||||
print("Data: " + px)
|
# px.strip_edges(true,true)
|
||||||
|
# if(!px.empty()):
|
||||||
|
# print("Data: " + px)
|
||||||
|
while parser.read() == OK:
|
||||||
|
if parser.get_node_type() == XMLParser.NODE_ELEMENT:
|
||||||
|
var node_name = parser.get_node_name()
|
||||||
|
if node_name.strip_edges(true,true).to_upper() == "LOCATION":
|
||||||
|
while parser.read() == OK:
|
||||||
|
if parser.get_node_type() == XMLParser.NODE_ELEMENT:
|
||||||
|
if parser.get_node_name().strip_edges(true,true).to_upper() == "LOCATION":
|
||||||
|
break
|
||||||
|
var child_node_name = parser.get_node_name()
|
||||||
|
#DKM TEMP: we need to switch/match all this, but still wrapping head around this parsing
|
||||||
|
print(child_node_name.strip_edges(true,true).to_upper())
|
||||||
|
if child_node_name.strip_edges(true,true).to_upper() == "ID":
|
||||||
|
parser.read()
|
||||||
|
var id_node_data = parser.get_node_data()
|
||||||
|
print("TEMP: ID found, named: " + str(id_node_data))
|
||||||
|
xml_data[id_node_data] = {}
|
||||||
|
|
||||||
|
|
||||||
|
# xml_data[node_name] = {}
|
||||||
|
# for i in range(parser.get_attribute_count()):
|
||||||
|
# var key = parser.get_attribute_name(i)
|
||||||
|
# var value = parser.get_attribute_value(i)
|
||||||
|
# xml_data[node_name][key] = value
|
||||||
|
|
||||||
|
#DKM TEMP: test dictionary output:
|
||||||
|
# print("TEST: printing XML dictionary values: ")
|
||||||
|
# for val in xml_data.values():
|
||||||
|
# print(val)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user