Grabbed the updated about dialog, and nameplates from BrokenSeals.

This commit is contained in:
Relintai 2020-07-11 23:25:59 +02:00
parent 1bb9d7cbe7
commit cd7d67052e
3 changed files with 133 additions and 36 deletions

View File

@ -96,48 +96,49 @@ SOFTWARE."
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 8.0
margin_top = 62.0
margin_bottom = 27.0
margin_left = 4.0
margin_top = 31.0
margin_right = -4.0
margin_bottom = -4.0
size_flags_horizontal = 3
script = ExtResource( 7 )
tree_path = NodePath("HBoxContainer/Tree")
rtl_path = NodePath("HBoxContainer/PanelContainer/RichTextLabel")
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/TabContainer/Third-Party Licenses"]
margin_right = 712.0
margin_right = 720.0
margin_bottom = 51.0
text = "This project relies on a number of third-party free and open source assets/components, all compatible with the terms of its MIT license. The following is an exhaustive list of all such third-party components with their respective copyright statements and license terms."
autowrap = true
[node name="HBoxContainer" type="HSplitContainer" parent="PanelContainer/VBoxContainer/TabContainer/Third-Party Licenses"]
margin_top = 59.0
margin_right = 712.0
margin_bottom = 361.0
margin_right = 720.0
margin_bottom = 396.0
size_flags_horizontal = 3
size_flags_vertical = 3
split_offset = -88
[node name="Tree" type="Tree" parent="PanelContainer/VBoxContainer/TabContainer/Third-Party Licenses/HBoxContainer"]
margin_right = 262.0
margin_bottom = 302.0
margin_right = 266.0
margin_bottom = 337.0
size_flags_horizontal = 3
size_flags_vertical = 3
hide_folding = true
hide_root = true
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer/VBoxContainer/TabContainer/Third-Party Licenses/HBoxContainer"]
margin_left = 274.0
margin_right = 712.0
margin_bottom = 302.0
margin_left = 278.0
margin_right = 720.0
margin_bottom = 337.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/VBoxContainer/TabContainer/Third-Party Licenses/HBoxContainer/PanelContainer"]
margin_left = 4.0
margin_top = 4.0
margin_right = 434.0
margin_bottom = 298.0
margin_right = 438.0
margin_bottom = 333.0
size_flags_horizontal = 3
size_flags_vertical = 3

View File

@ -8,6 +8,17 @@ var rtl : RichTextLabel
var populated : bool = false
var _data : Array = Array()
enum AttibutionIndex {
ATTRIBUTION_INDEX_NAME = 0,
ATTRIBUTION_INDEX_URL = 1,
ATTRIBUTION_INDEX_DESCRIPTION = 2,
ATTRIBUTION_INDEX_LICENSES = 3,
ATTRIBUTION_INDEX_FILES = 4,
ATTRIBUTION_INDEX_MAX = 5,
}
func _enter_tree():
tree = get_node(tree_path) as Tree
rtl = get_node(rtl_path) as RichTextLabel
@ -28,24 +39,109 @@ func populate():
populated = true
# tree.create_item()
#
# for info in Engine.get_copyright_info():
# var ti : TreeItem = tree.create_item()
#
# var st : String = info["name"] + "\n\n"
#
# for p in info["parts"]:
# for k in p:
# st += k + ":\n\n"
#
# if p[k] is Array:
# for it in p[k]:
# st += String(it) + "\n"
# else:
# st += String(p[k]) + "\n"
#
# st += "\n\n"
#
# ti.set_metadata(0, st)
# ti.set_text(0, info["name"])
#root
tree.create_item()
_data.clear()
load_all_xmls("res://")
for entry in _data:
var main : TreeItem = tree.create_item()
main.set_text(0, entry[0][0])
main.set_metadata(0, data_arr_to_string(entry[0]))
for i in range(1, entry.size()):
var curr : TreeItem = tree.create_item(main)
curr.set_text(0, entry[i][0])
curr.set_metadata(0, data_arr_to_string(entry[i]))
func load_all_xmls(path : String) -> void:
var dir = Directory.new()
if dir.open(path) == OK:
dir.list_dir_begin()
var file_name = dir.get_next()
while file_name != "":
if file_name == "." or file_name == "..":
file_name = dir.get_next()
continue
if dir.current_is_dir():
if path == "res://":
load_all_xmls(path + file_name)
else:
load_all_xmls(path + "/" + file_name)
else:
if file_name == "Attributions.xml":
if path == "res://":
load_xml(path + file_name)
else:
load_xml(path + "/" + file_name)
file_name = dir.get_next()
else:
print("An error occurred when trying to access the path: " + path)
func load_xml(path : String) -> void:
var parser : XMLParser = XMLParser.new()
var err = parser.open(path)
if err != OK:
print("Couldn't open file: " + path + " Err: " + err)
return
var attributions : Array = Array()
attributions.resize(1)
var attrib : PoolStringArray = PoolStringArray()
attrib.resize(AttibutionIndex.ATTRIBUTION_INDEX_MAX)
var curr_element : String = ""
while parser.read() == OK:
if parser.get_node_type() == XMLParser.NODE_ELEMENT:
curr_element = parser.get_node_name()
elif parser.get_node_type() == XMLParser.NODE_TEXT:
if curr_element == "Name":
attrib[AttibutionIndex.ATTRIBUTION_INDEX_NAME] = parser.get_node_data()
elif curr_element == "Description":
attrib[AttibutionIndex.ATTRIBUTION_INDEX_DESCRIPTION] = parser.get_node_data()
elif curr_element == "Licenses":
attrib[AttibutionIndex.ATTRIBUTION_INDEX_LICENSES] = parser.get_node_data()
elif curr_element == "URL":
attrib[AttibutionIndex.ATTRIBUTION_INDEX_URL] = parser.get_node_data()
elif curr_element == "Files":
attrib[AttibutionIndex.ATTRIBUTION_INDEX_FILES] = parser.get_node_data()
elif parser.get_node_type() == XMLParser.NODE_ELEMENT_END:
if parser.get_node_name() == "Attribution":
attributions.push_back(attrib)
attrib = PoolStringArray()
attrib.resize(AttibutionIndex.ATTRIBUTION_INDEX_MAX)
elif parser.get_node_name() == "Module":
attributions[0] = attrib
attrib = PoolStringArray()
attrib.resize(AttibutionIndex.ATTRIBUTION_INDEX_MAX)
if attributions[0] == null:
print("Attributions file does not have a Module tag! Path: " + path)
_data.push_back(attributions)
func data_arr_to_string(arr : Array) -> String:
var s : String = ""
s += arr[AttibutionIndex.ATTRIBUTION_INDEX_NAME] + "\n\n"
if arr[AttibutionIndex.ATTRIBUTION_INDEX_URL] != "":
s += "url: " + arr[AttibutionIndex.ATTRIBUTION_INDEX_URL] + "\n\n"
s += arr[AttibutionIndex.ATTRIBUTION_INDEX_DESCRIPTION] + "\n\n"
s += "License(s):\n"
s += arr[AttibutionIndex.ATTRIBUTION_INDEX_LICENSES] + "\n\n"
if arr[AttibutionIndex.ATTRIBUTION_INDEX_FILES] != "":
s += "File(s):\n\n"
s += arr[AttibutionIndex.ATTRIBUTION_INDEX_FILES]
return s

View File

@ -71,8 +71,8 @@ func set_player(p_player: Entity) -> void:
_player = p_player
_player.connect("cname_changed", self, "cname_changed")
_player.connect("notification_ccharacter_level_up", self, "clevel_changed")
_player.connect("con_character_level_changed", self, "clevel_changed")
_player.connect("notification_clevel_up", self, "clevel_changed")
_player.connect("con_level_changed", self, "clevel_changed")
_player.connect("notification_cxp_gained", self, "notification_cxp_gained")
_player.connect("centity_resource_added", self, "centity_resource_added")