Skip to content

Commit

Permalink
Move event flag to metadata fixing map loading, adding notification s…
Browse files Browse the repository at this point in the history
…ervice
  • Loading branch information
anthony-63 committed Nov 1, 2023
1 parent 582c7c6 commit db10408
Show file tree
Hide file tree
Showing 16 changed files with 4,133 additions and 23 deletions.
15 changes: 11 additions & 4 deletions Flux.gd
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,21 @@ func ms_to_min_sec_str(ms):
var secs: int = int(float(ms) * 0.001) % 60
return str(max(mins, 0.0)) + ":" + ("%02d" % max(secs, 0.0))

func play_replay(replay_data):
func play_replay(replay_data, scr):
var file_text: String = FileAccess.get_file_as_string("user://replays/" + replay_data.file)
var a: int = file_text.find("Ξζξ")
var b: int = file_text.find("Ξζξ", a + 1)
replay_file = FileAccess.open("user://replays/" + replay_data.file, FileAccess.READ)
replay_file.seek(b + 9)

var m: Dictionary = {}
for map in Flux.maps:
if map.meta.id == replay_data.meta.id: m = map

if not FileAccess.file_exists("user://maps/%s.flux" % replay_data.meta.id):
NotificationService.show_notification(scr, NotificationType.Ok, "Failed to load replay", "Map ID does not exist: %s" % replay_data.meta.id)
return

replaying = true

Flux.spinning = bool(replay_file.get_8()) # spin
Expand All @@ -134,11 +142,10 @@ func play_replay(replay_data):
Flux.settings.note.sd = replay_file.get_float()

print("speed: " + str(Flux.mods.speed) + "\nar: " + str(Flux.settings.note.ar) + "\nsd: " + str(Flux.settings.note.sd))
var m: Dictionary = {}
for map in Flux.maps:
if map.meta.id == replay_data.meta.id: m = map

Flux.current_map = m
FluxMap.load_data(Flux.current_map)

get_tree().change_scene_to_file("res://scenes/Game.tscn")

func get_map_len_str(map):
Expand Down
6 changes: 0 additions & 6 deletions prefabs/theme.tres

This file was deleted.

6 changes: 6 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ DiscordSDKLoader="*res://addons/discord-sdk-gd/nodes/core_updater.gd"
ReplayManager="*res://scripts/game/managers/ReplayManager.gd"
FluxCursorset="*res://scripts/io/FluxCursorset.gd"
FluxEvents="*res://scripts/io/FluxEvents.gd"
NotificationType="*res://scripts/notification/NotificationType.gd"
NotificationService="*res://scripts/notification/NotificationService.gd"

[display]

window/size/viewport_width=1920
window/size/viewport_height=1080
window/vsync/vsync_mode=0

[editor_plugins]
Expand All @@ -41,6 +45,8 @@ enabled=PackedStringArray("res://addons/draw3d/plugin.cfg")
[gui]

theme/custom="res://prefabs/theme.tres"
theme/size/viewport_height=648
theme/size/viewport_width=1152

[input]

Expand Down
Loading

0 comments on commit db10408

Please sign in to comment.