mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Fixed up some custom level menu stuff
This commit is contained in:
@@ -17,6 +17,7 @@ func on_timeout() -> void:
|
||||
$AnimationPlayer.stop()
|
||||
var node = item.instantiate()
|
||||
node.global_position = $Joint.global_position
|
||||
node.hide()
|
||||
add_sibling(node)
|
||||
$Joint.remote_path = node.get_path()
|
||||
item_amount += 1
|
||||
@@ -27,10 +28,12 @@ func on_timeout() -> void:
|
||||
node.z_index = -10
|
||||
$AnimationPlayer.play(get_direction_string([Vector2.DOWN, Vector2.UP, Vector2.RIGHT, Vector2.LEFT][direction]))
|
||||
await get_tree().process_frame
|
||||
node.show()
|
||||
node.reset_physics_interpolation()
|
||||
await $AnimationPlayer.animation_finished
|
||||
$Joint.remote_path = ""
|
||||
if is_instance_valid(node):
|
||||
node.velocity = Vector2.ZERO
|
||||
node.set_process(true)
|
||||
node.z_index = z_old
|
||||
node.set_physics_process(true)
|
||||
|
@@ -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"]
|
||||
|
Reference in New Issue
Block a user