Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
New things of options (#74)
Browse files Browse the repository at this point in the history
* Music option

It isn´t finished

* Forgot some important stuff

* More music

* More music

* Options 2 (#76)

* Well, like this is better

* Better

* Update VisualsUISubState.hx

* Update MusicSettingsSubState.hx

* Update VisualsUISubState.hx

* Update MusicSettingsSubState.hx

* Update VisualsUISubState.hx

* Update MusicSettingsSubState.hx

* I'll review that

Co-authored-by: DEMOLITIONDON96 <[email protected]>
Co-authored-by: Theoyeah <[email protected]>
  • Loading branch information
3 people authored May 9, 2022
1 parent ecee5a1 commit f41807e
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 48 deletions.
Binary file added assets/preload/music/flyAgainBro.mp3
Binary file not shown.
Binary file added assets/preload/music/flyAgainBro.ogg
Binary file not shown.
5 changes: 5 additions & 0 deletions source/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ClientPrefs {
public static var crazycounter:Bool = false; // The reason it is called like that is bc it can mess with some things
public static var camfollow:Bool = true; // No other name cuz it can mess with some others things
public static var multiplicativeValue:Float = 0;
public static var musicSelected:String = 'freakyMenu';
public static var gameplaySettings:Map<String, Dynamic> = [
'scrollspeed' => 1.0,
'scrolltype' => 'multiplicative',
Expand Down Expand Up @@ -107,6 +108,7 @@ class ClientPrefs {
FlxG.save.data.middleScroll = middleScroll;
FlxG.save.data.showFPS = showFPS;
FlxG.save.data.flashing = flashing;
FlxG.save.data.musicSelected = musicSelected;
FlxG.save.data.globalAntialiasing = globalAntialiasing;
FlxG.save.data.noteSplashes = noteSplashes;
FlxG.save.data.lowQuality = lowQuality;
Expand Down Expand Up @@ -167,6 +169,9 @@ class ClientPrefs {
if(FlxG.save.data.middleScroll != null) {
middleScroll = FlxG.save.data.middleScroll;
}
if(FlxG.save.data.musicSelected != null) {
musicSelected = FlxG.save.data.musicSelected;
}
if(FlxG.save.data.iconBounce != null) {
iconBounce = FlxG.save.data.iconBounce;
}
Expand Down
6 changes: 3 additions & 3 deletions source/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class TitleState extends MusicBeatState
// music.play();

if(FlxG.sound.music == null) {
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.playMusic(Paths.music(ClientPrefs.musicSelected), 0);

FlxG.sound.music.fadeIn(4, 0, 0.7);
}
Expand Down Expand Up @@ -736,7 +736,7 @@ class TitleState extends MusicBeatState
skippedIntro = true;
playJingle = false;

FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.playMusic(Paths.music(ClientPrefs.musicSelected), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
return;
}
Expand All @@ -756,7 +756,7 @@ class TitleState extends MusicBeatState
removeThings();
FlxG.camera.flash(FlxColor.WHITE, 3);
sound.onComplete = function() {
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.playMusic(Paths.music(ClientPrefs.musicSelected), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
transitioning = false;
};
Expand Down
19 changes: 0 additions & 19 deletions source/options/GameplaySettingsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,6 @@ class GameplaySettingsSubState extends BaseOptionsMenu
false);
addOption(option);

var option:Option = new Option('Hitsound Volume',
'Funny notes does \"Tick!\" when you hit them."',
'hitsoundVolume',
'percent',
0);
addOption(option);
option.scrollSpeed = 1.6;
option.minValue = 0.0;
option.maxValue = 1;
if(FlxG.keys.pressed.SHIFT) {
if(ClientPrefs.multiplicativeValue > 0) {
option.changeValue = ClientPrefs.multiplicativeValue;
} else {
option.changeValue = 0.5;
}
} else {
option.changeValue = 0.1;
}
option.decimals = 1;

var option:Option = new Option('Rating Offset',
'Changes how late/early you have to hit for a "Sick!"\nHigher values mean you have to hit later.',
Expand Down
117 changes: 117 additions & 0 deletions source/options/MusicSettingsSubState.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package options;

#if desktop
import Discord.DiscordClient;
#end
import flash.text.TextField;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import lime.utils.Assets;
import flixel.FlxSubState;
import flash.text.TextField;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.util.FlxSave;
import haxe.Json;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxTimer;
import flixel.input.keyboard.FlxKey;
import flixel.graphics.FlxGraphic;
import Controls;
import openfl.Lib;

using StringTools;

class MusicSettingsSubState extends BaseOptionsMenu
{
public function new()
{
title = 'Music';
rpcTitle = 'Music Settings Menu'; //for Discord Rich Presence

//I'd suggest using "Low Quality" as an example for making your own option since it is the simplest here
/*var option:Option = new Option('Low Quality', //Name
'If checked, disables some background details,\ndecreases loading times and improves performance.', //Description
'lowQuality', //Save data variable name
'bool', //Variable type
false); //Default value
addOption(option);*/

/*
var option:Option = new Option('Persistent Cached Data',
'If checked, images loaded will stay in memory\nuntil the game is closed, this increases memory usage,\nbut basically makes reloading times instant.',
'imagesPersist',
'bool',
false);
option.onChange = onChangePersistentData; //Persistent Cached Data changes FlxGraphic.defaultPersist
addOption(option);
*/

/*var option:Option = new Option('Music',
'What music you want to play',
'musicSelected',
'String',
'freakyMenu',
['freakyMenu', 'offsetSong', 'breakfast', 'tea-time', 'flyAgainBro']);
addOption(option);*/

var option:Option = new Option('Hitsound Volume',
'Funny notes does \"Tick!\" when you hit them."',
'hitsoundVolume',
'percent',
0);
addOption(option);
option.scrollSpeed = 1.6;
option.minValue = 0.0;
option.maxValue = 1;
if(FlxG.keys.pressed.SHIFT) {
if(ClientPrefs.multiplicativeValue > 0) {
option.changeValue = ClientPrefs.multiplicativeValue;
} else {
option.changeValue = 0.5;
}
} else {
option.changeValue = 0.1;
}
option.decimals = 1;


var option:Option = new Option('Pause Screen Song:',
"What song do you prefer for the Pause Screen?",
'pauseMusic',
'string',
'Tea Time',
['None', 'Breakfast', 'Tea Time']);
addOption(option);
option.onChange = onChangePauseMusic;


super();
}

var changedMusic:Bool = false;
function onChangePauseMusic()
{
if(ClientPrefs.pauseMusic == 'None') {
FlxG.sound.music.volume = 0;
} else {
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath(ClientPrefs.pauseMusic)));
}

changedMusic = true;
}

override function destroy()
{
if(changedMusic) FlxG.sound.playMusic(Paths.music('freakyMenu'));
super.destroy();
}

}
4 changes: 3 additions & 1 deletion source/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using StringTools;

class OptionsState extends MusicBeatState
{
var options:Array<String> = ['Note Colors', 'Controls', 'Adjust Delay and Combo', 'Graphics', 'Visuals and UI', 'Gameplay'];
var options:Array<String> = ['Note Colors', 'Controls', 'Adjust Delay and Combo', 'Graphics', 'Visuals and UI', 'Gameplay', 'Music'];
private var grpOptions:FlxTypedGroup<Alphabet>;
private static var curSelected:Int = 0;
public static var menuBG:FlxSprite;
Expand All @@ -47,6 +47,8 @@ class OptionsState extends MusicBeatState
openSubState(new options.VisualsUISubState());
case 'Gameplay':
openSubState(new options.GameplaySettingsSubState());
case 'Music':
openSubState(new options.MusicSettingsSubState());
case 'Adjust Delay and Combo':
LoadingState.loadAndSwitchState(new options.NoteOffsetState());
}
Expand Down
25 changes: 0 additions & 25 deletions source/options/VisualsUISubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -158,35 +158,10 @@ class VisualsUISubState extends BaseOptionsMenu
option.onChange = onChangeFPSCounter;
#end

var option:Option = new Option('Pause Screen Song:',
"What song do you prefer for the Pause Screen?",
'pauseMusic',
'string',
'Tea Time',
['None', 'Breakfast', 'Tea Time']);
addOption(option);
option.onChange = onChangePauseMusic;

super();
}

var changedMusic:Bool = false;
function onChangePauseMusic()
{
if(ClientPrefs.pauseMusic == 'None')
FlxG.sound.music.volume = 0;
else
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath(ClientPrefs.pauseMusic)));

changedMusic = true;
}

override function destroy()
{
if(changedMusic) FlxG.sound.playMusic(Paths.music('freakyMenu'));
super.destroy();
}



#if !mobile
Expand Down

0 comments on commit f41807e

Please sign in to comment.