Added support for multiple arguments on trace

Added quick skip for title state
Small Fixes
This commit is contained in:
NeeEoo
2023-03-26 20:22:16 +02:00
parent 64e1bd768e
commit 0af39387df
5 changed files with 97 additions and 86 deletions
+19 -13
View File
@@ -156,6 +156,11 @@ class TitleState extends MusicBeatState
#end
}
if (pressedEnter && transitioning && skippedIntro) {
FlxG.camera.stopFX();// FlxG.camera.visible = false;
goToMainMenu();
}
if (pressedEnter && !transitioning && skippedIntro)
{
pressEnter();
@@ -176,21 +181,22 @@ class TitleState extends MusicBeatState
transitioning = true;
// FlxG.sound.music.stop();
new FlxTimer().start(2, function(tmr:FlxTimer)
{
#if UPDATE_CHECKING
var report = hasCheckedUpdates ? null : funkin.updating.UpdateUtil.checkForUpdates();
hasCheckedUpdates = true;
new FlxTimer().start(2, (_) -> goToMainMenu());
}
if (report != null && report.newUpdate) {
FlxG.switchState(new funkin.updating.UpdateAvailableScreen(report));
} else {
FlxG.switchState(new MainMenuState());
}
#else
function goToMainMenu() {
#if UPDATE_CHECKING
var report = hasCheckedUpdates ? null : funkin.updating.UpdateUtil.checkForUpdates();
hasCheckedUpdates = true;
if (report != null && report.newUpdate) {
FlxG.switchState(new funkin.updating.UpdateAvailableScreen(report));
} else {
FlxG.switchState(new MainMenuState());
#end
});
}
#else
FlxG.switchState(new MainMenuState());
#end
}
public function createCoolText(textArray:Array<String>)
+8 -10
View File
@@ -18,7 +18,7 @@ abstract XMLAnimType(Int) {
public static function fromString(str:String, def:XMLAnimType = NONE) {
return switch(str.trim().toLowerCase()) {
case "none": NONE;
case "beat" | "onbeat": BEAT;
case "beat" | "onbeat": BEAT;
case "loop": LOOP;
default: def;
}
@@ -61,12 +61,10 @@ class FunkinSprite extends FlxSprite implements IBeatReceiver implements IOffset
public function loadSprite(path:String, Unique:Bool = false, Key:String = null) {
var noExt = Path.withoutExtension(path);
if (Assets.exists('$noExt/Animation.json')
&& Assets.exists('$noExt/spritemap1.json')
&& Assets.exists('$noExt/spritemap1.png')) {
atlasPath = noExt;
animateAtlas = new FlxAnimate(x, y, noExt);
}
if (Assets.exists('$noExt/Animation.json')) {
atlasPath = noExt;
animateAtlas = new FlxAnimate(x, y, noExt);
}
else {
frames = CoolUtil.loadFrames(path, Unique, Key, true);
}
@@ -152,8 +150,8 @@ class FunkinSprite extends FlxSprite implements IBeatReceiver implements IOffset
}
public override function destroy() {
animateAtlas = FlxDestroyUtil.destroy(animateAtlas);
super.destroy();
animateAtlas = FlxDestroyUtil.destroy(animateAtlas);
super.destroy();
}
#end
@@ -214,10 +212,10 @@ class FunkinSprite extends FlxSprite implements IBeatReceiver implements IOffset
if (!animation.exists(AnimName)) return;
animation.play(AnimName, Force, Reversed, Frame);
}
var daOffset = getAnimOffset(AnimName);
rotOffset.set(daOffset.x, daOffset.y);
daOffset.putWeak();
lastAnimContext = Context;
}
+15 -6
View File
@@ -13,20 +13,29 @@ class Logs {
public static function init() {
Log.trace = function(v : Dynamic, ?infos : Null<haxe.PosInfos>) {
__showInConsole(prepareColoredTrace([
var data = [
logText('${infos.fileName}:${infos.lineNumber}: ', CYAN),
logText(Std.string(v))
], TRACE));
];
if (infos.customParams != null) {
for (i in infos.customParams) {
data.push(
logText("," + Std.string(i))
);
}
}
__showInConsole(prepareColoredTrace(data, TRACE));
};
LogFrontEnd.onLogs = function(Data, Style, FireOnce) {
var prefix = "[FLIXEL]";
var color:ConsoleColor = LIGHTGRAY;
var level:Level = INFO;
if (Style == LogStyle.CONSOLE) {prefix = "> "; color = WHITE; level = INFO; }
if (Style == LogStyle.ERROR) {prefix = "[FLIXEL]"; color = RED; level = ERROR; }
if (Style == LogStyle.NORMAL) {prefix = "[FLIXEL]"; color = WHITE; level = INFO; }
if (Style == LogStyle.NOTICE) {prefix = "[FLIXEL]"; color = GREEN; level = WARNING;}
if (Style == LogStyle.CONSOLE) {prefix = "> "; color = WHITE; level = INFO; } else
if (Style == LogStyle.ERROR) {prefix = "[FLIXEL]"; color = RED; level = ERROR; } else
if (Style == LogStyle.NORMAL) {prefix = "[FLIXEL]"; color = WHITE; level = INFO; } else
if (Style == LogStyle.NOTICE) {prefix = "[FLIXEL]"; color = GREEN; level = WARNING;} else
if (Style == LogStyle.WARNING) {prefix = "[FLIXEL]"; color = YELLOW; level = WARNING;}
var d:Dynamic = Data;
+50 -52
View File
@@ -15,51 +15,49 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
/**
* Current step
*/
public var curStep(get, never):Int;
/**
* Current beat
*/
public var curBeat(get, never):Int;
/**
* Current beat
*/
public var curMeasure(get, never):Int;
/**
* Current step, as a `Float` (ex: 4.94, instead of 4)
*/
public var curStepFloat(get, never):Float;
/**
* Current beat, as a `Float` (ex: 1.24, instead of 1)
*/
public var curBeatFloat(get, never):Float;
/**
* Current beat, as a `Float` (ex: 1.24, instead of 1)
*/
public var curMeasureFloat(get, never):Float;
/**
* Current song position (in milliseconds).
*/
public var songPos(get, never):Float;
inline function get_curStep():Int
return Conductor.curStep;
inline function get_curBeat():Int
return Conductor.curBeat;
inline function get_curMeasure():Int
return Conductor.curMeasure;
inline function get_curStepFloat():Float
return Conductor.curStepFloat;
inline function get_curBeatFloat():Float
return Conductor.curBeatFloat;
inline function get_curMeasureFloat():Float
return Conductor.curMeasureFloat;
inline function get_songPos():Float
return Conductor.songPosition;
public var curStep(get, never):Int;
/**
* Current beat
*/
public var curBeat(get, never):Int;
/**
* Current beat
*/
public var curMeasure(get, never):Int;
/**
* Current step, as a `Float` (ex: 4.94, instead of 4)
*/
public var curStepFloat(get, never):Float;
/**
* Current beat, as a `Float` (ex: 1.24, instead of 1)
*/
public var curBeatFloat(get, never):Float;
/**
* Current beat, as a `Float` (ex: 1.24, instead of 1)
*/
public var curMeasureFloat(get, never):Float;
/**
* Current song position (in milliseconds).
*/
public var songPos(get, never):Float;
inline function get_curStep():Int
return Conductor.curStep;
inline function get_curBeat():Int
return Conductor.curBeat;
inline function get_curMeasure():Int
return Conductor.curMeasure;
inline function get_curStepFloat():Float
return Conductor.curStepFloat;
inline function get_curBeatFloat():Float
return Conductor.curBeatFloat;
inline function get_curMeasureFloat():Float
return Conductor.curMeasureFloat;
inline function get_songPos():Float
return Conductor.songPosition;
/**
* Current injected script attached to the state. To add one, create a file at path "data/states/stateName" (ex: "data/states/PauseMenuSubstate.hx")
@@ -73,17 +71,17 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver
/**
* Game Controls. (All players / Solo)
*/
public var controls(get, never):Controls;
public var controls(get, never):Controls;
/**
* Game Controls (Player 1 only)
*/
public var controlsP1(get, never):Controls;
/**
* Game Controls (Player 2 only)
*/
public var controlsP2(get, never):Controls;
/**
* Game Controls (Player 1 only)
*/
public var controlsP1(get, never):Controls;
/**
* Game Controls (Player 2 only)
*/
public var controlsP2(get, never):Controls;
inline function get_controls():Controls
return PlayerSettings.solo.controls;
@@ -247,7 +245,7 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver
public var parent:FlxState;
public function onSubstateOpen() {
}
public override function resetSubState() {
+5 -5
View File
@@ -59,7 +59,7 @@ class Paths
{
return 'assets/$file';
}
inline static public function file(file:String, type:AssetType = TEXT, ?library:String)
{
return getPath(file, type, library);
@@ -96,9 +96,9 @@ class Paths
}
inline static public function ps1(key:String, ?library:String)
{
return getPath('data/$key.ps1', TEXT, library);
}
{
return getPath('data/$key.ps1', TEXT, library);
}
static public function sound(key:String, ?library:String)
{
@@ -153,7 +153,7 @@ class Paths
difficulty = difficulty.toLowerCase();
song = song.toLowerCase();
var difficultyEnd = (difficulty == "normal") ? "" : '-$difficulty';
//var difficultyEnd = (difficulty == "normal") ? "" : '-$difficulty';
// songs/your-song/charts/hard.json
var p = getPath('songs/$song/charts/$difficulty.json', TEXT, null);