Inital Kade Engine Commit
This commit is contained in:
parent
d3cd2e21c8
commit
6ce80b1c5b
@ -498,22 +498,21 @@ class Controls extends FlxActionSet
|
|||||||
switch (scheme)
|
switch (scheme)
|
||||||
{
|
{
|
||||||
case Solo:
|
case Solo:
|
||||||
inline bindKeys(Control.UP, [W, FlxKey.UP]);
|
inline bindKeys(Control.UP, [J, FlxKey.UP]);
|
||||||
inline bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
|
inline bindKeys(Control.DOWN, [F, FlxKey.DOWN]);
|
||||||
inline bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
|
inline bindKeys(Control.LEFT, [D, FlxKey.LEFT]);
|
||||||
inline bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
|
inline bindKeys(Control.RIGHT, [K, FlxKey.RIGHT]);
|
||||||
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
||||||
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
||||||
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
||||||
inline bindKeys(Control.RESET, [R]);
|
inline bindKeys(Control.RESET, [R]);
|
||||||
case Duo(true):
|
case Duo(true):
|
||||||
inline bindKeys(Control.UP, [W]);
|
inline bindKeys(Control.UP, [W, FlxKey.UP]);
|
||||||
inline bindKeys(Control.DOWN, [S]);
|
inline bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
|
||||||
inline bindKeys(Control.LEFT, [A]);
|
inline bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
|
||||||
inline bindKeys(Control.RIGHT, [D]);
|
inline bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
|
||||||
inline bindKeys(Control.ACCEPT, [G, Z]);
|
inline bindKeys(Control.ACCEPT, [G, Z, SPACE, ENTER]);
|
||||||
inline bindKeys(Control.BACK, [H, X]);
|
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
||||||
inline bindKeys(Control.PAUSE, [ONE]);
|
|
||||||
inline bindKeys(Control.RESET, [R]);
|
inline bindKeys(Control.RESET, [R]);
|
||||||
case Duo(false):
|
case Duo(false):
|
||||||
inline bindKeys(Control.UP, [FlxKey.UP]);
|
inline bindKeys(Control.UP, [FlxKey.UP]);
|
||||||
|
@ -25,6 +25,18 @@ class CoolUtil
|
|||||||
return daList;
|
return daList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function coolStringFile(path:String):Array<String>
|
||||||
|
{
|
||||||
|
var daList:Array<String> = path.trim().split('\n');
|
||||||
|
|
||||||
|
for (i in 0...daList.length)
|
||||||
|
{
|
||||||
|
daList[i] = daList[i].trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
return daList;
|
||||||
|
}
|
||||||
|
|
||||||
public static function numberArray(max:Int, ?min = 0):Array<Int>
|
public static function numberArray(max:Int, ?min = 0):Array<Int>
|
||||||
{
|
{
|
||||||
var dumbArray:Array<Int> = [];
|
var dumbArray:Array<Int> = [];
|
||||||
|
@ -53,22 +53,13 @@ class FreeplayState extends MusicBeatState
|
|||||||
isDebug = true;
|
isDebug = true;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
if (StoryMenuState.weekUnlocked[2] || isDebug)
|
|
||||||
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
|
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
|
||||||
|
|
||||||
if (StoryMenuState.weekUnlocked[2] || isDebug)
|
|
||||||
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
|
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
|
||||||
|
|
||||||
if (StoryMenuState.weekUnlocked[3] || isDebug)
|
|
||||||
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
|
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
|
||||||
|
|
||||||
if (StoryMenuState.weekUnlocked[4] || isDebug)
|
|
||||||
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
|
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
|
||||||
|
|
||||||
if (StoryMenuState.weekUnlocked[5] || isDebug)
|
|
||||||
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
|
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
|
||||||
|
|
||||||
if (StoryMenuState.weekUnlocked[6] || isDebug)
|
|
||||||
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
|
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
|
||||||
|
|
||||||
// LOAD MUSIC
|
// LOAD MUSIC
|
||||||
@ -250,7 +241,7 @@ class FreeplayState extends MusicBeatState
|
|||||||
function changeSelection(change:Int = 0)
|
function changeSelection(change:Int = 0)
|
||||||
{
|
{
|
||||||
#if !switch
|
#if !switch
|
||||||
NGio.logEvent('Fresh');
|
// NGio.logEvent('Fresh');
|
||||||
#end
|
#end
|
||||||
|
|
||||||
// NGio.logEvent('Fresh');
|
// NGio.logEvent('Fresh');
|
||||||
|
201
source/LoadReplayState.hx
Normal file
201
source/LoadReplayState.hx
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
package;
|
||||||
|
|
||||||
|
import Controls.KeyboardScheme;
|
||||||
|
import Controls.Control;
|
||||||
|
import flash.text.TextField;
|
||||||
|
import flixel.FlxG;
|
||||||
|
import flixel.FlxSprite;
|
||||||
|
import flixel.addons.display.FlxGridOverlay;
|
||||||
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
|
import flixel.input.keyboard.FlxKey;
|
||||||
|
import flixel.math.FlxMath;
|
||||||
|
import flixel.text.FlxText;
|
||||||
|
import flixel.util.FlxColor;
|
||||||
|
import lime.utils.Assets;
|
||||||
|
#if sys
|
||||||
|
import sys.io.File;
|
||||||
|
#end
|
||||||
|
|
||||||
|
class LoadReplayState extends MusicBeatState
|
||||||
|
{
|
||||||
|
var selector:FlxText;
|
||||||
|
var curSelected:Int = 0;
|
||||||
|
|
||||||
|
var songs:Array<FreeplayState.SongMetadata> = [];
|
||||||
|
|
||||||
|
var controlsStrings:Array<String> = [];
|
||||||
|
var actualNames:Array<String> = [];
|
||||||
|
|
||||||
|
private var grpControls:FlxTypedGroup<Alphabet>;
|
||||||
|
var versionShit:FlxText;
|
||||||
|
var poggerDetails:FlxText;
|
||||||
|
override function create()
|
||||||
|
{
|
||||||
|
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
||||||
|
#if sys
|
||||||
|
controlsStrings = sys.FileSystem.readDirectory(Sys.getCwd() + "\\assets\\replays\\");
|
||||||
|
#end
|
||||||
|
trace(controlsStrings);
|
||||||
|
|
||||||
|
controlsStrings.sort(Reflect.compare);
|
||||||
|
|
||||||
|
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
|
||||||
|
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
|
||||||
|
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
|
||||||
|
|
||||||
|
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
|
||||||
|
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
|
||||||
|
|
||||||
|
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
|
||||||
|
|
||||||
|
|
||||||
|
for(i in 0...controlsStrings.length)
|
||||||
|
{
|
||||||
|
var string:String = controlsStrings[i];
|
||||||
|
actualNames[i] = string;
|
||||||
|
var rep:Replay = Replay.LoadReplay(string);
|
||||||
|
controlsStrings[i] = string.split("time")[0] + " " + (rep.replay.songDiff == 2 ? "HARD" : rep.replay.songDiff == 1 ? "EASY" : "NORMAL");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controlsStrings.length == 0)
|
||||||
|
controlsStrings.push("No Replays...");
|
||||||
|
|
||||||
|
menuBG.color = 0xFFea71fd;
|
||||||
|
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
||||||
|
menuBG.updateHitbox();
|
||||||
|
menuBG.screenCenter();
|
||||||
|
menuBG.antialiasing = true;
|
||||||
|
add(menuBG);
|
||||||
|
|
||||||
|
grpControls = new FlxTypedGroup<Alphabet>();
|
||||||
|
add(grpControls);
|
||||||
|
|
||||||
|
for (i in 0...controlsStrings.length)
|
||||||
|
{
|
||||||
|
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false);
|
||||||
|
controlLabel.isMenuItem = true;
|
||||||
|
controlLabel.targetY = i;
|
||||||
|
grpControls.add(controlLabel);
|
||||||
|
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
versionShit = new FlxText(5, FlxG.height - 34, 0, "Replay Loader (ESCAPE TO GO BACK)\nNOTICE!!!! Replays are in a beta stage, and they are probably not 100% correct. expect misses and other stuff that isn't there!", 12);
|
||||||
|
versionShit.scrollFactor.set();
|
||||||
|
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||||
|
add(versionShit);
|
||||||
|
|
||||||
|
|
||||||
|
poggerDetails = new FlxText(5, 34, 0, "Replay Details - \nnone", 12);
|
||||||
|
poggerDetails.scrollFactor.set();
|
||||||
|
poggerDetails.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||||
|
add(poggerDetails);
|
||||||
|
|
||||||
|
changeSelection(0);
|
||||||
|
|
||||||
|
super.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWeekNumbFromSong(songName:String):Int
|
||||||
|
{
|
||||||
|
var week:Int = 0;
|
||||||
|
for (i in 0...songs.length)
|
||||||
|
{
|
||||||
|
var pog:FreeplayState.SongMetadata = songs[i];
|
||||||
|
if (pog.songName.toLowerCase() == songName)
|
||||||
|
week = pog.week;
|
||||||
|
}
|
||||||
|
return week;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addSong(songName:String, weekNum:Int, songCharacter:String)
|
||||||
|
{
|
||||||
|
songs.push(new FreeplayState.SongMetadata(songName, weekNum, songCharacter));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWeek(songs:Array<String>, weekNum:Int, ?songCharacters:Array<String>)
|
||||||
|
{
|
||||||
|
if (songCharacters == null)
|
||||||
|
songCharacters = ['bf'];
|
||||||
|
|
||||||
|
var num:Int = 0;
|
||||||
|
for (song in songs)
|
||||||
|
{
|
||||||
|
addSong(song, weekNum, songCharacters[num]);
|
||||||
|
|
||||||
|
if (songCharacters.length != 1)
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override function update(elapsed:Float)
|
||||||
|
{
|
||||||
|
super.update(elapsed);
|
||||||
|
|
||||||
|
if (controls.BACK)
|
||||||
|
FlxG.switchState(new OptionsMenu());
|
||||||
|
if (controls.UP_P)
|
||||||
|
changeSelection(-1);
|
||||||
|
if (controls.DOWN_P)
|
||||||
|
changeSelection(1);
|
||||||
|
|
||||||
|
|
||||||
|
if (controls.ACCEPT && grpControls.members[curSelected].text != "No Replays...")
|
||||||
|
{
|
||||||
|
trace('loading ' + actualNames[curSelected]);
|
||||||
|
PlayState.rep = Replay.LoadReplay(actualNames[curSelected]);
|
||||||
|
|
||||||
|
PlayState.loadRep = true;
|
||||||
|
|
||||||
|
var poop:String = Highscore.formatSong(PlayState.rep.replay.songName.toLowerCase(), PlayState.rep.replay.songDiff);
|
||||||
|
|
||||||
|
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName.toLowerCase());
|
||||||
|
PlayState.isStoryMode = false;
|
||||||
|
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
|
||||||
|
PlayState.storyWeek = getWeekNumbFromSong(PlayState.rep.replay.songName);
|
||||||
|
LoadingState.loadAndSwitchState(new PlayState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var isSettingControl:Bool = false;
|
||||||
|
|
||||||
|
function changeSelection(change:Int = 0)
|
||||||
|
{
|
||||||
|
#if !switch
|
||||||
|
// NGio.logEvent('Fresh');
|
||||||
|
#end
|
||||||
|
|
||||||
|
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
||||||
|
|
||||||
|
curSelected += change;
|
||||||
|
|
||||||
|
if (curSelected < 0)
|
||||||
|
curSelected = grpControls.length - 1;
|
||||||
|
if (curSelected >= grpControls.length)
|
||||||
|
curSelected = 0;
|
||||||
|
|
||||||
|
var rep:Replay = Replay.LoadReplay(actualNames[curSelected]);
|
||||||
|
|
||||||
|
poggerDetails.text = "Replay Details - \nDate Created: " + rep.replay.timestamp + "\nSong: " + rep.replay.songName + "\nReplay Version: " + (rep.replay.replayGameVer != Replay.version ? "OUTDATED" : "Latest");
|
||||||
|
|
||||||
|
// selector.y = (70 * curSelected) + 30;
|
||||||
|
|
||||||
|
var bullShit:Int = 0;
|
||||||
|
|
||||||
|
for (item in grpControls.members)
|
||||||
|
{
|
||||||
|
item.targetY = bullShit - curSelected;
|
||||||
|
bullShit++;
|
||||||
|
|
||||||
|
item.alpha = 0.6;
|
||||||
|
// item.setGraphicSize(Std.int(item.width * 0.8));
|
||||||
|
|
||||||
|
if (item.targetY == 0)
|
||||||
|
{
|
||||||
|
item.alpha = 1;
|
||||||
|
// item.setGraphicSize(Std.int(item.width));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,7 @@ class Main extends Sprite
|
|||||||
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
|
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
|
||||||
var initialState:Class<FlxState> = TitleState; // The FlxState the game starts with.
|
var initialState:Class<FlxState> = TitleState; // The FlxState the game starts with.
|
||||||
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
|
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
|
||||||
var framerate:Int = 60; // How many frames per second the game should run at.
|
var framerate:Int = 120; // How many frames per second the game should run at.
|
||||||
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
|
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
|
||||||
var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets
|
var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package;
|
|||||||
import flixel.FlxG;
|
import flixel.FlxG;
|
||||||
import flixel.FlxObject;
|
import flixel.FlxObject;
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
import flixel.addons.transition.FlxTransitionableState;
|
|
||||||
import flixel.effects.FlxFlicker;
|
import flixel.effects.FlxFlicker;
|
||||||
import flixel.graphics.frames.FlxAtlasFrames;
|
import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
@ -28,14 +27,18 @@ class MainMenuState extends MusicBeatState
|
|||||||
var optionShit:Array<String> = ['story mode', 'freeplay'];
|
var optionShit:Array<String> = ['story mode', 'freeplay'];
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
var newGaming:FlxText;
|
||||||
|
var newGaming2:FlxText;
|
||||||
|
var newInput:Bool = true;
|
||||||
|
|
||||||
|
public static var kadeEngineVer:String = "1.0";
|
||||||
|
public static var gameVer:String = "0.2.7.1";
|
||||||
|
|
||||||
var magenta:FlxSprite;
|
var magenta:FlxSprite;
|
||||||
var camFollow:FlxObject;
|
var camFollow:FlxObject;
|
||||||
|
|
||||||
override function create()
|
override function create()
|
||||||
{
|
{
|
||||||
transIn = FlxTransitionableState.defaultTransIn;
|
|
||||||
transOut = FlxTransitionableState.defaultTransOut;
|
|
||||||
|
|
||||||
if (!FlxG.sound.music.playing)
|
if (!FlxG.sound.music.playing)
|
||||||
{
|
{
|
||||||
FlxG.sound.playMusic(Paths.music('freakyMenu'));
|
FlxG.sound.playMusic(Paths.music('freakyMenu'));
|
||||||
@ -88,13 +91,14 @@ class MainMenuState extends MusicBeatState
|
|||||||
|
|
||||||
FlxG.camera.follow(camFollow, null, 0.06);
|
FlxG.camera.follow(camFollow, null, 0.06);
|
||||||
|
|
||||||
var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, "v" + Application.current.meta.get('version'), 12);
|
var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, gameVer + " FNF - " + kadeEngineVer + " Kade Engine", 12);
|
||||||
versionShit.scrollFactor.set();
|
versionShit.scrollFactor.set();
|
||||||
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||||
add(versionShit);
|
add(versionShit);
|
||||||
|
|
||||||
// NG.core.calls.event.logEvent('swag').send();
|
// NG.core.calls.event.logEvent('swag').send();
|
||||||
|
|
||||||
|
|
||||||
changeItem();
|
changeItem();
|
||||||
|
|
||||||
super.create();
|
super.create();
|
||||||
@ -149,7 +153,7 @@ class MainMenuState extends MusicBeatState
|
|||||||
{
|
{
|
||||||
if (curSelected != spr.ID)
|
if (curSelected != spr.ID)
|
||||||
{
|
{
|
||||||
FlxTween.tween(spr, {alpha: 0}, 0.4, {
|
FlxTween.tween(spr, {alpha: 0}, 1.3, {
|
||||||
ease: FlxEase.quadOut,
|
ease: FlxEase.quadOut,
|
||||||
onComplete: function(twn:FlxTween)
|
onComplete: function(twn:FlxTween)
|
||||||
{
|
{
|
||||||
@ -174,8 +178,6 @@ class MainMenuState extends MusicBeatState
|
|||||||
trace("Freeplay Menu Selected");
|
trace("Freeplay Menu Selected");
|
||||||
|
|
||||||
case 'options':
|
case 'options':
|
||||||
FlxTransitionableState.skipNextTransIn = true;
|
|
||||||
FlxTransitionableState.skipNextTransOut = true;
|
|
||||||
FlxG.switchState(new OptionsMenu());
|
FlxG.switchState(new OptionsMenu());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
|
import Controls.KeyboardScheme;
|
||||||
import Controls.Control;
|
import Controls.Control;
|
||||||
import flash.text.TextField;
|
import flash.text.TextField;
|
||||||
import flixel.FlxG;
|
import flixel.FlxG;
|
||||||
@ -20,11 +21,23 @@ class OptionsMenu extends MusicBeatState
|
|||||||
var controlsStrings:Array<String> = [];
|
var controlsStrings:Array<String> = [];
|
||||||
|
|
||||||
private var grpControls:FlxTypedGroup<Alphabet>;
|
private var grpControls:FlxTypedGroup<Alphabet>;
|
||||||
|
var versionShit:FlxText;
|
||||||
override function create()
|
override function create()
|
||||||
{
|
{
|
||||||
|
if (FlxG.save.data.newInput == null)
|
||||||
|
FlxG.save.data.newInput = true;
|
||||||
|
|
||||||
|
if (FlxG.save.data.downscroll == null)
|
||||||
|
FlxG.save.data.downscroll = false;
|
||||||
|
|
||||||
|
if (FlxG.save.data.dfjk == null)
|
||||||
|
FlxG.save.data.dfjk = false;
|
||||||
|
|
||||||
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
||||||
controlsStrings = CoolUtil.coolTextFile(Paths.txt('controls'));
|
controlsStrings = CoolUtil.coolStringFile((FlxG.save.data.dfjk ? 'DFJK' : 'WASD') + "\n" + (FlxG.save.data.newInput ? "New input" : "Old Input") + "\n" + (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll') + "\nLoad replays");
|
||||||
|
|
||||||
|
trace(controlsStrings);
|
||||||
|
|
||||||
menuBG.color = 0xFFea71fd;
|
menuBG.color = 0xFFea71fd;
|
||||||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
||||||
menuBG.updateHitbox();
|
menuBG.updateHitbox();
|
||||||
@ -32,75 +45,93 @@ class OptionsMenu extends MusicBeatState
|
|||||||
menuBG.antialiasing = true;
|
menuBG.antialiasing = true;
|
||||||
add(menuBG);
|
add(menuBG);
|
||||||
|
|
||||||
/*
|
grpControls = new FlxTypedGroup<Alphabet>();
|
||||||
grpControls = new FlxTypedGroup<Alphabet>();
|
add(grpControls);
|
||||||
add(grpControls);
|
|
||||||
|
|
||||||
for (i in 0...controlsStrings.length)
|
for (i in 0...controlsStrings.length)
|
||||||
{
|
{
|
||||||
if (controlsStrings[i].indexOf('set') != -1)
|
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false);
|
||||||
{
|
controlLabel.isMenuItem = true;
|
||||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false);
|
controlLabel.targetY = i;
|
||||||
controlLabel.isMenuItem = true;
|
grpControls.add(controlLabel);
|
||||||
controlLabel.targetY = i;
|
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||||
grpControls.add(controlLabel);
|
}
|
||||||
}
|
|
||||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
|
||||||
}
|
versionShit = new FlxText(5, FlxG.height - 18, 0, "Offset (Left, Right): " + FlxG.save.data.offset, 12);
|
||||||
*/
|
versionShit.scrollFactor.set();
|
||||||
|
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||||
|
add(versionShit);
|
||||||
|
|
||||||
super.create();
|
super.create();
|
||||||
|
|
||||||
openSubState(new OptionsSubState());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override function update(elapsed:Float)
|
override function update(elapsed:Float)
|
||||||
{
|
{
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
||||||
/*
|
if (controls.BACK)
|
||||||
|
FlxG.switchState(new MainMenuState());
|
||||||
|
if (controls.UP_P)
|
||||||
|
changeSelection(-1);
|
||||||
|
if (controls.DOWN_P)
|
||||||
|
changeSelection(1);
|
||||||
|
|
||||||
|
if (controls.RIGHT_R)
|
||||||
|
{
|
||||||
|
FlxG.save.data.offset++;
|
||||||
|
versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controls.LEFT_R)
|
||||||
|
{
|
||||||
|
FlxG.save.data.offset--;
|
||||||
|
versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (controls.ACCEPT)
|
if (controls.ACCEPT)
|
||||||
{
|
{
|
||||||
changeBinding();
|
if (curSelected != 3)
|
||||||
}
|
grpControls.remove(grpControls.members[curSelected]);
|
||||||
|
switch(curSelected)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
FlxG.save.data.dfjk = !FlxG.save.data.dfjk;
|
||||||
|
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.dfjk ? 'DFJK' : 'WASD'), true, false);
|
||||||
|
ctrl.isMenuItem = true;
|
||||||
|
ctrl.targetY = curSelected;
|
||||||
|
grpControls.add(ctrl);
|
||||||
|
if (FlxG.save.data.dfjk)
|
||||||
|
controls.setKeyboardScheme(KeyboardScheme.Solo, true);
|
||||||
|
else
|
||||||
|
controls.setKeyboardScheme(KeyboardScheme.Duo(true), true);
|
||||||
|
|
||||||
if (isSettingControl)
|
case 1:
|
||||||
waitingInput();
|
FlxG.save.data.newInput = !FlxG.save.data.newInput;
|
||||||
else
|
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.newInput ? "New input" : "Old Input"), true, false);
|
||||||
{
|
ctrl.isMenuItem = true;
|
||||||
if (controls.BACK)
|
ctrl.targetY = curSelected - 1;
|
||||||
FlxG.switchState(new MainMenuState());
|
grpControls.add(ctrl);
|
||||||
if (controls.UP_P)
|
case 2:
|
||||||
changeSelection(-1);
|
FlxG.save.data.downscroll = !FlxG.save.data.downscroll;
|
||||||
if (controls.DOWN_P)
|
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll'), true, false);
|
||||||
changeSelection(1);
|
ctrl.isMenuItem = true;
|
||||||
|
ctrl.targetY = curSelected - 2;
|
||||||
|
grpControls.add(ctrl);
|
||||||
|
case 3:
|
||||||
|
trace('switch');
|
||||||
|
FlxG.switchState(new LoadReplayState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
function waitingInput():Void
|
|
||||||
{
|
|
||||||
if (FlxG.keys.getIsDown().length > 0)
|
|
||||||
{
|
|
||||||
PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxG.keys.getIsDown()[0].ID, null);
|
|
||||||
}
|
|
||||||
// PlayerSettings.player1.controls.replaceBinding(Control)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var isSettingControl:Bool = false;
|
var isSettingControl:Bool = false;
|
||||||
|
|
||||||
function changeBinding():Void
|
|
||||||
{
|
|
||||||
if (!isSettingControl)
|
|
||||||
{
|
|
||||||
isSettingControl = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeSelection(change:Int = 0)
|
function changeSelection(change:Int = 0)
|
||||||
{
|
{
|
||||||
#if !switch
|
#if !switch
|
||||||
NGio.logEvent('Fresh');
|
// NGio.logEvent('Fresh');
|
||||||
#end
|
#end
|
||||||
|
|
||||||
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
||||||
|
1061
source/PlayState.hx
1061
source/PlayState.hx
File diff suppressed because it is too large
Load Diff
101
source/Replay.hx
Normal file
101
source/Replay.hx
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#if sys
|
||||||
|
import sys.io.File;
|
||||||
|
#end
|
||||||
|
import Controls.Control;
|
||||||
|
import flixel.FlxG;
|
||||||
|
import openfl.events.IOErrorEvent;
|
||||||
|
import openfl.events.Event;
|
||||||
|
import openfl.net.FileReference;
|
||||||
|
import lime.utils.Assets;
|
||||||
|
import haxe.Json;
|
||||||
|
import flixel.input.keyboard.FlxKey;
|
||||||
|
import openfl.utils.Dictionary;
|
||||||
|
|
||||||
|
typedef KeyPress =
|
||||||
|
{
|
||||||
|
public var time:Float;
|
||||||
|
public var key:String;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef KeyRelease =
|
||||||
|
{
|
||||||
|
public var time:Float;
|
||||||
|
public var key:String;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef ReplayJSON =
|
||||||
|
{
|
||||||
|
public var replayGameVer:String;
|
||||||
|
public var timestamp:Date;
|
||||||
|
public var songName:String;
|
||||||
|
public var songDiff:Int;
|
||||||
|
public var keyPresses:Array<KeyPress>;
|
||||||
|
public var keyReleases:Array<KeyRelease>;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Replay
|
||||||
|
{
|
||||||
|
public static var version:String = "1.0"; // replay file version
|
||||||
|
|
||||||
|
public var path:String = "";
|
||||||
|
public var replay:ReplayJSON;
|
||||||
|
public function new(path:String)
|
||||||
|
{
|
||||||
|
this.path = path;
|
||||||
|
replay = {
|
||||||
|
songName: "Tutorial",
|
||||||
|
songDiff: 1,
|
||||||
|
keyPresses: [],
|
||||||
|
keyReleases: [],
|
||||||
|
replayGameVer: version,
|
||||||
|
timestamp: Date.now()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function LoadReplay(path:String):Replay
|
||||||
|
{
|
||||||
|
var rep:Replay = new Replay(path);
|
||||||
|
|
||||||
|
rep.LoadFromJSON();
|
||||||
|
|
||||||
|
trace('basic replay data:\nSong Name: ' + rep.replay.songName + '\nSong Diff: ' + rep.replay.songDiff + '\nKeys Length: ' + rep.replay.keyPresses.length);
|
||||||
|
|
||||||
|
return rep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SaveReplay()
|
||||||
|
{
|
||||||
|
var json = {
|
||||||
|
"songName": PlayState.SONG.song.toLowerCase(),
|
||||||
|
"songDiff": PlayState.storyDifficulty,
|
||||||
|
"keyPresses": replay.keyPresses,
|
||||||
|
"keyReleases": replay.keyReleases,
|
||||||
|
"timestamp": Date.now(),
|
||||||
|
"replayGameVer": version
|
||||||
|
};
|
||||||
|
|
||||||
|
var data:String = Json.stringify(json);
|
||||||
|
|
||||||
|
#if sys
|
||||||
|
File.saveContent("assets/replays/replay-" + PlayState.SONG.song + "-time" + Date.now().getTime() + ".kadeReplay", data);
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function LoadFromJSON()
|
||||||
|
{
|
||||||
|
#if sys
|
||||||
|
trace('loading ' + Sys.getCwd() + 'assets\\replays\\' + path + ' replay...');
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var repl:ReplayJSON = cast Json.parse(File.getContent(Sys.getCwd() + "assets\\replays\\" + path));
|
||||||
|
replay = repl;
|
||||||
|
}
|
||||||
|
catch(e)
|
||||||
|
{
|
||||||
|
trace('failed!\n' + e.message);
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -54,7 +54,7 @@ class TitleState extends MusicBeatState
|
|||||||
|
|
||||||
super.create();
|
super.create();
|
||||||
|
|
||||||
NGio.noLogin(APIStuff.API);
|
// NGio.noLogin(APIStuff.API);
|
||||||
|
|
||||||
#if ng
|
#if ng
|
||||||
var ng:NGio = new NGio(APIStuff.API, APIStuff.EncKey);
|
var ng:NGio = new NGio(APIStuff.API, APIStuff.EncKey);
|
||||||
@ -364,10 +364,9 @@ class TitleState extends MusicBeatState
|
|||||||
// credTextShit.text = 'In association \nwith';
|
// credTextShit.text = 'In association \nwith';
|
||||||
// credTextShit.screenCenter();
|
// credTextShit.screenCenter();
|
||||||
case 5:
|
case 5:
|
||||||
createCoolText(['In association', 'with']);
|
createCoolText(['Kade Engine', 'by']);
|
||||||
case 7:
|
case 7:
|
||||||
addMoreText('newgrounds');
|
addMoreText('KadeDeveloper');
|
||||||
ngSpr.visible = true;
|
|
||||||
// credTextShit.text += '\nNewgrounds';
|
// credTextShit.text += '\nNewgrounds';
|
||||||
case 8:
|
case 8:
|
||||||
deleteCoolText();
|
deleteCoolText();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user