-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDescription.gd
50 lines (45 loc) · 1.99 KB
/
Description.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class_name Description extends RichTextLabel
@export var main_screen: MainScreen
@export var version_list: VersionList
@export var platform_selection: PlatformSelection
var readme := ""
var current_version := "Select a version"
var current_version_index := -1
func refresh_readme():
if version_list == null:
readme = "Invalid version_list export"
return
if main_screen == null:
readme = "Invalid main_screen export"
return
if current_version_index < 0 or current_version_index >= main_screen.sorted_versions.size():
readme = "Invalid current_version_index"
return
if not current_version in main_screen.versions:
readme = "Invalid current_version"
return
readme = main_screen.versions[current_version].get("readme", "")
func _on_version_list_new_version_selected(version):
if current_version == version:
return
current_version = version if version != null else "Select a version"
current_version_index = version_list.currently_selected_index
refresh_readme()
func _process(_delta):
if main_screen.versions.size() == 0:
text = "Loading versions..."
else:
text = "%s\n%s\n%s\n\nCurrent Platform: %s" % [
current_version,
main_screen.versions[current_version]["modified"] if current_version in main_screen.versions else "",
readme,
OS.get_name()
]
text += "\n\nDownload Locations:"
for i in range(1, platform_selection.item_count):
var platform := platform_selection.get_item_text(i)
text += "\n%s%s: %s" % ["(This) " if platform_selection._is_for_this_platform(platform) else "", platform, ProjectSettings.globalize_path(platform_selection._get_download_path(platform))]
text += "\n\nExecutable Locations:"
for i in range(1, platform_selection.item_count):
var platform := platform_selection.get_item_text(i)
text += "\n%s%s: %s" % ["(This) " if platform_selection._is_for_this_platform(platform) else "", platform, ProjectSettings.globalize_path(platform_selection._get_executable_path(platform))]