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

Commit f41807e

Browse files
Wither362DEMOLITIONDON96Theoyeah
authored
New things of options (#74)
* 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 <87618246+DEMOLITIONDON96@users.noreply.github.com> Co-authored-by: Theoyeah <theodelalot@hotmail.com>
1 parent ecee5a1 commit f41807e

8 files changed

+128
-48
lines changed

assets/preload/music/flyAgainBro.mp3

6.48 MB
Binary file not shown.

assets/preload/music/flyAgainBro.ogg

3.15 MB
Binary file not shown.

source/ClientPrefs.hx

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class ClientPrefs {
3939
public static var crazycounter:Bool = false; // The reason it is called like that is bc it can mess with some things
4040
public static var camfollow:Bool = true; // No other name cuz it can mess with some others things
4141
public static var multiplicativeValue:Float = 0;
42+
public static var musicSelected:String = 'freakyMenu';
4243
public static var gameplaySettings:Map<String, Dynamic> = [
4344
'scrollspeed' => 1.0,
4445
'scrolltype' => 'multiplicative',
@@ -107,6 +108,7 @@ class ClientPrefs {
107108
FlxG.save.data.middleScroll = middleScroll;
108109
FlxG.save.data.showFPS = showFPS;
109110
FlxG.save.data.flashing = flashing;
111+
FlxG.save.data.musicSelected = musicSelected;
110112
FlxG.save.data.globalAntialiasing = globalAntialiasing;
111113
FlxG.save.data.noteSplashes = noteSplashes;
112114
FlxG.save.data.lowQuality = lowQuality;
@@ -167,6 +169,9 @@ class ClientPrefs {
167169
if(FlxG.save.data.middleScroll != null) {
168170
middleScroll = FlxG.save.data.middleScroll;
169171
}
172+
if(FlxG.save.data.musicSelected != null) {
173+
musicSelected = FlxG.save.data.musicSelected;
174+
}
170175
if(FlxG.save.data.iconBounce != null) {
171176
iconBounce = FlxG.save.data.iconBounce;
172177
}

source/TitleState.hx

+3-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class TitleState extends MusicBeatState
253253
// music.play();
254254

255255
if(FlxG.sound.music == null) {
256-
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
256+
FlxG.sound.playMusic(Paths.music(ClientPrefs.musicSelected), 0);
257257

258258
FlxG.sound.music.fadeIn(4, 0, 0.7);
259259
}
@@ -736,7 +736,7 @@ class TitleState extends MusicBeatState
736736
skippedIntro = true;
737737
playJingle = false;
738738

739-
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
739+
FlxG.sound.playMusic(Paths.music(ClientPrefs.musicSelected), 0);
740740
FlxG.sound.music.fadeIn(4, 0, 0.7);
741741
return;
742742
}
@@ -756,7 +756,7 @@ class TitleState extends MusicBeatState
756756
removeThings();
757757
FlxG.camera.flash(FlxColor.WHITE, 3);
758758
sound.onComplete = function() {
759-
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
759+
FlxG.sound.playMusic(Paths.music(ClientPrefs.musicSelected), 0);
760760
FlxG.sound.music.fadeIn(4, 0, 0.7);
761761
transitioning = false;
762762
};

source/options/GameplaySettingsSubState.hx

-19
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,6 @@ class GameplaySettingsSubState extends BaseOptionsMenu
8181
false);
8282
addOption(option);
8383

84-
var option:Option = new Option('Hitsound Volume',
85-
'Funny notes does \"Tick!\" when you hit them."',
86-
'hitsoundVolume',
87-
'percent',
88-
0);
89-
addOption(option);
90-
option.scrollSpeed = 1.6;
91-
option.minValue = 0.0;
92-
option.maxValue = 1;
93-
if(FlxG.keys.pressed.SHIFT) {
94-
if(ClientPrefs.multiplicativeValue > 0) {
95-
option.changeValue = ClientPrefs.multiplicativeValue;
96-
} else {
97-
option.changeValue = 0.5;
98-
}
99-
} else {
100-
option.changeValue = 0.1;
101-
}
102-
option.decimals = 1;
10384

10485
var option:Option = new Option('Rating Offset',
10586
'Changes how late/early you have to hit for a "Sick!"\nHigher values mean you have to hit later.',
+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
package options;
2+
3+
#if desktop
4+
import Discord.DiscordClient;
5+
#end
6+
import flash.text.TextField;
7+
import flixel.FlxCamera;
8+
import flixel.FlxG;
9+
import flixel.FlxSprite;
10+
import flixel.addons.display.FlxGridOverlay;
11+
import flixel.group.FlxGroup.FlxTypedGroup;
12+
import flixel.math.FlxMath;
13+
import flixel.text.FlxText;
14+
import flixel.util.FlxColor;
15+
import lime.utils.Assets;
16+
import flixel.FlxSubState;
17+
import flash.text.TextField;
18+
import flixel.FlxG;
19+
import flixel.FlxSprite;
20+
import flixel.util.FlxSave;
21+
import haxe.Json;
22+
import flixel.tweens.FlxEase;
23+
import flixel.tweens.FlxTween;
24+
import flixel.util.FlxTimer;
25+
import flixel.input.keyboard.FlxKey;
26+
import flixel.graphics.FlxGraphic;
27+
import Controls;
28+
import openfl.Lib;
29+
30+
using StringTools;
31+
32+
class MusicSettingsSubState extends BaseOptionsMenu
33+
{
34+
public function new()
35+
{
36+
title = 'Music';
37+
rpcTitle = 'Music Settings Menu'; //for Discord Rich Presence
38+
39+
//I'd suggest using "Low Quality" as an example for making your own option since it is the simplest here
40+
/*var option:Option = new Option('Low Quality', //Name
41+
'If checked, disables some background details,\ndecreases loading times and improves performance.', //Description
42+
'lowQuality', //Save data variable name
43+
'bool', //Variable type
44+
false); //Default value
45+
addOption(option);*/
46+
47+
/*
48+
var option:Option = new Option('Persistent Cached Data',
49+
'If checked, images loaded will stay in memory\nuntil the game is closed, this increases memory usage,\nbut basically makes reloading times instant.',
50+
'imagesPersist',
51+
'bool',
52+
false);
53+
option.onChange = onChangePersistentData; //Persistent Cached Data changes FlxGraphic.defaultPersist
54+
addOption(option);
55+
*/
56+
57+
/*var option:Option = new Option('Music',
58+
'What music you want to play',
59+
'musicSelected',
60+
'String',
61+
'freakyMenu',
62+
['freakyMenu', 'offsetSong', 'breakfast', 'tea-time', 'flyAgainBro']);
63+
addOption(option);*/
64+
65+
var option:Option = new Option('Hitsound Volume',
66+
'Funny notes does \"Tick!\" when you hit them."',
67+
'hitsoundVolume',
68+
'percent',
69+
0);
70+
addOption(option);
71+
option.scrollSpeed = 1.6;
72+
option.minValue = 0.0;
73+
option.maxValue = 1;
74+
if(FlxG.keys.pressed.SHIFT) {
75+
if(ClientPrefs.multiplicativeValue > 0) {
76+
option.changeValue = ClientPrefs.multiplicativeValue;
77+
} else {
78+
option.changeValue = 0.5;
79+
}
80+
} else {
81+
option.changeValue = 0.1;
82+
}
83+
option.decimals = 1;
84+
85+
86+
var option:Option = new Option('Pause Screen Song:',
87+
"What song do you prefer for the Pause Screen?",
88+
'pauseMusic',
89+
'string',
90+
'Tea Time',
91+
['None', 'Breakfast', 'Tea Time']);
92+
addOption(option);
93+
option.onChange = onChangePauseMusic;
94+
95+
96+
super();
97+
}
98+
99+
var changedMusic:Bool = false;
100+
function onChangePauseMusic()
101+
{
102+
if(ClientPrefs.pauseMusic == 'None') {
103+
FlxG.sound.music.volume = 0;
104+
} else {
105+
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath(ClientPrefs.pauseMusic)));
106+
}
107+
108+
changedMusic = true;
109+
}
110+
111+
override function destroy()
112+
{
113+
if(changedMusic) FlxG.sound.playMusic(Paths.music('freakyMenu'));
114+
super.destroy();
115+
}
116+
117+
}

source/options/OptionsState.hx

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ using StringTools;
3030

3131
class OptionsState extends MusicBeatState
3232
{
33-
var options:Array<String> = ['Note Colors', 'Controls', 'Adjust Delay and Combo', 'Graphics', 'Visuals and UI', 'Gameplay'];
33+
var options:Array<String> = ['Note Colors', 'Controls', 'Adjust Delay and Combo', 'Graphics', 'Visuals and UI', 'Gameplay', 'Music'];
3434
private var grpOptions:FlxTypedGroup<Alphabet>;
3535
private static var curSelected:Int = 0;
3636
public static var menuBG:FlxSprite;
@@ -47,6 +47,8 @@ class OptionsState extends MusicBeatState
4747
openSubState(new options.VisualsUISubState());
4848
case 'Gameplay':
4949
openSubState(new options.GameplaySettingsSubState());
50+
case 'Music':
51+
openSubState(new options.MusicSettingsSubState());
5052
case 'Adjust Delay and Combo':
5153
LoadingState.loadAndSwitchState(new options.NoteOffsetState());
5254
}

source/options/VisualsUISubState.hx

-25
Original file line numberDiff line numberDiff line change
@@ -158,35 +158,10 @@ class VisualsUISubState extends BaseOptionsMenu
158158
option.onChange = onChangeFPSCounter;
159159
#end
160160

161-
var option:Option = new Option('Pause Screen Song:',
162-
"What song do you prefer for the Pause Screen?",
163-
'pauseMusic',
164-
'string',
165-
'Tea Time',
166-
['None', 'Breakfast', 'Tea Time']);
167-
addOption(option);
168-
option.onChange = onChangePauseMusic;
169161

170162
super();
171163
}
172164

173-
var changedMusic:Bool = false;
174-
function onChangePauseMusic()
175-
{
176-
if(ClientPrefs.pauseMusic == 'None')
177-
FlxG.sound.music.volume = 0;
178-
else
179-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath(ClientPrefs.pauseMusic)));
180-
181-
changedMusic = true;
182-
}
183-
184-
override function destroy()
185-
{
186-
if(changedMusic) FlxG.sound.playMusic(Paths.music('freakyMenu'));
187-
super.destroy();
188-
}
189-
190165

191166

192167
#if !mobile

0 commit comments

Comments
 (0)