mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-12-06 03:30:22 -08:00
Fixed up some custom level menu stuff
This commit is contained in:
parent
795f9be8c2
commit
b6c97ffa1e
5 changed files with 41 additions and 17 deletions
|
|
@ -12,6 +12,7 @@ static var page_number_save := -1
|
|||
static var last_played_container = null
|
||||
|
||||
static var saved_search_values := [-1, -1, -1]
|
||||
static var level_id := ""
|
||||
|
||||
func _ready() -> void:
|
||||
has_entered = true
|
||||
|
|
@ -84,8 +85,20 @@ func play_level() -> void:
|
|||
LevelTransition.level_to_transition_to = ("res://Scenes/Levels/LevelEditor.tscn")
|
||||
Global.transition_to_scene("res://Scenes/Levels/LevelTransition.tscn")
|
||||
|
||||
func online_play() -> void:
|
||||
lss_level_played()
|
||||
Global.current_game_mode = Global.GameMode.CUSTOM_LEVEL
|
||||
Settings.file.difficulty.inf_lives = 1
|
||||
LevelEditor.load_play = true
|
||||
$LSSCharacterSelect.open()
|
||||
await $LSSCharacterSelect.selected
|
||||
LevelTransition.level_to_transition_to = ("res://Scenes/Levels/LevelEditor.tscn")
|
||||
Global.transition_to_scene("res://Scenes/Levels/LevelTransition.tscn")
|
||||
|
||||
func lss_level_played() -> void:
|
||||
last_played_container = %LSSLevelInfo.container_to_play.duplicate()
|
||||
level_id = %LSSLevelInfo.container_to_play.level_id
|
||||
print(level_id)
|
||||
page_number_save = %LSSBrowser.page_number
|
||||
saved_search_values[0] = %LSSBrowser.page_number
|
||||
saved_search_values[1] = %LSSBrowser.filter
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ signal closed
|
|||
|
||||
const LEVEL_INFO_URL := "https://levelsharesquare.com/api/levels/"
|
||||
|
||||
var level_id := ""
|
||||
static var level_id := ""
|
||||
|
||||
var has_downloaded := false
|
||||
|
||||
|
|
@ -30,7 +30,9 @@ func open(container: OnlineLevelContainer) -> void:
|
|||
else:
|
||||
%Download.grab_focus()
|
||||
setup_visuals(container)
|
||||
level_id = container.level_id
|
||||
reset_process()
|
||||
|
||||
func reset_process() -> void:
|
||||
await get_tree().physics_frame
|
||||
set_process(true)
|
||||
|
||||
|
|
@ -49,6 +51,7 @@ func setup_visuals(container: OnlineLevelContainer) -> void:
|
|||
else: value = container.get(i)
|
||||
%SelectedOnlineLevel.set(i, value)
|
||||
saved_stuff[i] = value
|
||||
level_id = saved_stuff.level_id
|
||||
%SelectedOnlineLevel.setup_visuals()
|
||||
%Download.visible = not has_downloaded
|
||||
%OnlinePlay.visible = has_downloaded
|
||||
|
|
@ -70,6 +73,7 @@ func download_level() -> void:
|
|||
%Download.text = "DOWNLOADING..."
|
||||
|
||||
func open_lss() -> void:
|
||||
print(level_id)
|
||||
OS.shell_open("https://levelsharesquare.com/levels/" + str(level_id))
|
||||
|
||||
func on_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
|
|
@ -104,6 +108,7 @@ func play_level() -> void:
|
|||
var file_path := "user://custom_levels/downloaded/" + level_id + ".lvl"
|
||||
var file = JSON.parse_string(FileAccess.open(file_path, FileAccess.READ).get_as_text())
|
||||
LevelEditor.level_file = file
|
||||
set_process(false)
|
||||
var info = file["Info"]
|
||||
LevelEditor.level_author = info["Author"]
|
||||
LevelEditor.level_name = info["Name"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue