From 6e93df0437886cbf942be2c9e727d1e859d416b6 Mon Sep 17 00:00:00 2001 From: Detoria <44783518+theDetourist@users.noreply.github.com> Date: Thu, 15 Apr 2021 12:28:13 -0300 Subject: [PATCH 1/3] offset desktop only pt.1 --- source/PauseSubState.hx | 113 +++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 53 deletions(-) diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 29f0ffa..3533fe0 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -69,7 +69,10 @@ class PauseSubState extends MusicBeatSubstate perSongOffset = new FlxText(5, FlxG.height - 18, 0, "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.', 12); perSongOffset.scrollFactor.set(); perSongOffset.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); - add(perSongOffset); + + #if desktop + add(perSongOffset); + #end for (i in 0...menuItems.length) { @@ -106,59 +109,63 @@ class PauseSubState extends MusicBeatSubstate }else if (downP) { changeSelection(1); - }else if (leftP) - { - oldOffset = PlayState.songOffset; - PlayState.songOffset -= 1; - sys.FileSystem.rename(songPath + oldOffset + '.offset', songPath + PlayState.songOffset + '.offset'); - perSongOffset.text = "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.'; - - // Prevent loop from happening every single time the offset changes - if(!offsetChanged) - { - grpMenuShit.clear(); - - menuItems = ['Restart Song', 'Exit to menu']; - - for (i in 0...menuItems.length) - { - var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false); - songText.isMenuItem = true; - songText.targetY = i; - grpMenuShit.add(songText); - } - - changeSelection(); - - cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]]; - offsetChanged = true; - } - }else if (rightP) - { - oldOffset = PlayState.songOffset; - PlayState.songOffset += 1; - sys.FileSystem.rename(songPath + oldOffset + '.offset', songPath + PlayState.songOffset + '.offset'); - perSongOffset.text = "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.'; - if(!offsetChanged) - { - grpMenuShit.clear(); - - menuItems = ['Restart Song', 'Exit to menu']; - - for (i in 0...menuItems.length) - { - var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false); - songText.isMenuItem = true; - songText.targetY = i; - grpMenuShit.add(songText); - } - - changeSelection(); - - cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]]; - offsetChanged = true; - } } + + #if desktop + else if (leftP) + { + oldOffset = PlayState.songOffset; + PlayState.songOffset -= 1; + sys.FileSystem.rename(songPath + oldOffset + '.offset', songPath + PlayState.songOffset + '.offset'); + perSongOffset.text = "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.'; + + // Prevent loop from happening every single time the offset changes + if(!offsetChanged) + { + grpMenuShit.clear(); + + menuItems = ['Restart Song', 'Exit to menu']; + + for (i in 0...menuItems.length) + { + var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false); + songText.isMenuItem = true; + songText.targetY = i; + grpMenuShit.add(songText); + } + + changeSelection(); + + cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]]; + offsetChanged = true; + } + }else if (rightP) + { + oldOffset = PlayState.songOffset; + PlayState.songOffset += 1; + sys.FileSystem.rename(songPath + oldOffset + '.offset', songPath + PlayState.songOffset + '.offset'); + perSongOffset.text = "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.'; + if(!offsetChanged) + { + grpMenuShit.clear(); + + menuItems = ['Restart Song', 'Exit to menu']; + + for (i in 0...menuItems.length) + { + var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false); + songText.isMenuItem = true; + songText.targetY = i; + grpMenuShit.add(songText); + } + + changeSelection(); + + cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]]; + offsetChanged = true; + } + } + #end if (accepted) { From 7162b4dd86bdbcbe18c59258f0f7f1ece5a70130 Mon Sep 17 00:00:00 2001 From: Detoria <44783518+theDetourist@users.noreply.github.com> Date: Thu, 15 Apr 2021 12:29:28 -0300 Subject: [PATCH 2/3] offset desktop only pt.2 --- source/PlayState.hx | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 4409319..44c1dbd 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -39,10 +39,10 @@ import lime.utils.Assets; import openfl.display.BlendMode; import openfl.display.StageQuality; import openfl.filters.ShaderFilter; -import Sys; #if windows import Discord.DiscordClient; +import Sys; #end using StringTools; @@ -1230,23 +1230,26 @@ class PlayState extends MusicBeatState var playerCounter:Int = 0; // Per song offset check - var songPath = 'assets/data/' + PlayState.SONG.song.toLowerCase() + '/'; - for(file in sys.FileSystem.readDirectory(songPath)) - { - var path = haxe.io.Path.join([songPath, file]); - if(!sys.FileSystem.isDirectory(path)) + #if desktop + var songPath = 'assets/data/' + PlayState.SONG.song.toLowerCase() + '/'; + for(file in sys.FileSystem.readDirectory(songPath)) { - if(path.endsWith('.offset')) + var path = haxe.io.Path.join([songPath, file]); + if(!sys.FileSystem.isDirectory(path)) { - trace('Found offset file: ' + path); - songOffset = Std.parseFloat(file.substring(0, file.indexOf('.off'))); - break; - }else { - trace('Offset file not found. Creating one @: ' + songPath); - sys.io.File.saveContent(songPath + songOffset + '.offset', ''); + if(path.endsWith('.offset')) + { + trace('Found offset file: ' + path); + songOffset = Std.parseFloat(file.substring(0, file.indexOf('.off'))); + break; + }else { + trace('Offset file not found. Creating one @: ' + songPath); + sys.io.File.saveContent(songPath + songOffset + '.offset', ''); + } } } - } + #end + var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped for (section in noteData) { @@ -3270,4 +3273,4 @@ class PlayState extends MusicBeatState } var curLight:Int = 0; -} \ No newline at end of file +} From 86d4e9da07455a30d993dce72d479d62b4e5cc8d Mon Sep 17 00:00:00 2001 From: Detoria <44783518+theDetourist@users.noreply.github.com> Date: Thu, 15 Apr 2021 12:30:26 -0300 Subject: [PATCH 3/3] windows only -> desktop --- source/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 44c1dbd..3af5232 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -40,7 +40,7 @@ import openfl.display.BlendMode; import openfl.display.StageQuality; import openfl.filters.ShaderFilter; -#if windows +#if desktop import Discord.DiscordClient; import Sys; #end