new highscore system
This commit is contained in:
@@ -28,6 +28,16 @@ class CoolUtil
|
||||
return v == null ? defaultValue : v;
|
||||
}
|
||||
|
||||
public static function setFieldDefault<T>(v:Dynamic, name:String, defaultValue:T):T {
|
||||
if (Reflect.hasField(v, name)) {
|
||||
var f = Reflect.field(v, name);
|
||||
if (f != null && Std.isOfType(f, T))
|
||||
return cast f;
|
||||
}
|
||||
Reflect.setField(v, name, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public static function addZeros(str:String, num:Int) {
|
||||
while(str.length < num) str = '0${str}';
|
||||
return str;
|
||||
@@ -130,11 +140,6 @@ class CoolUtil
|
||||
}), volume);
|
||||
}
|
||||
|
||||
public static function difficultyString():String
|
||||
{
|
||||
return difficultyArray[PlayState.storyDifficulty];
|
||||
}
|
||||
|
||||
public static function coolTextFile(path:String):Array<String>
|
||||
{
|
||||
return [for(e in Assets.getText(path).trim().split('\n')) e.trim()];
|
||||
|
||||
@@ -26,10 +26,10 @@ class Logs {
|
||||
var color:ConsoleColor = LIGHTGRAY;
|
||||
var level:Level = INFO;
|
||||
if (Style == LogStyle.CONSOLE) {prefix = "> "; color = WHITE; level = INFO; }
|
||||
if (Style == LogStyle.ERROR) {prefix = "[FLIXEL ERROR]"; color = RED; level = ERROR; }
|
||||
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 NOTICE]"; color = GREEN; level = WARNING;}
|
||||
if (Style == LogStyle.WARNING) {prefix = "[FLIXEL WARNING]"; color = YELLOW; level = WARNING;}
|
||||
if (Style == LogStyle.NOTICE) {prefix = "[FLIXEL]"; color = GREEN; level = WARNING;}
|
||||
if (Style == LogStyle.WARNING) {prefix = "[FLIXEL]"; color = YELLOW; level = WARNING;}
|
||||
|
||||
var d:Dynamic = Data;
|
||||
if (!(d is Array))
|
||||
@@ -45,9 +45,9 @@ class Logs {
|
||||
public static function prepareColoredTrace(text:Array<LogText>, level:Level = INFO) {
|
||||
var time = Date.now();
|
||||
var superCoolText = [
|
||||
logText('[ '),
|
||||
logText('[ '),
|
||||
logText('${Std.string(time.getHours()).addZeros(2)}:${Std.string(time.getMinutes()).addZeros(2)}:${Std.string(time.getSeconds()).addZeros(2)}', DARKMAGENTA),
|
||||
logText(' |'),
|
||||
logText(' |'),
|
||||
switch(level) {
|
||||
case WARNING: logText(' WARNING ', DARKYELLOW);
|
||||
case ERROR: logText(' ERROR ', DARKRED);
|
||||
|
||||
@@ -95,14 +95,16 @@ class Paths
|
||||
return getPath('music/$key.$SOUND_EXT', MUSIC, library);
|
||||
}
|
||||
|
||||
inline static public function voices(song:String)
|
||||
inline static public function voices(song:String, difficulty:String = "normal")
|
||||
{
|
||||
return getPath('songs/${song.toLowerCase()}/Voices.$SOUND_EXT', MUSIC, null);
|
||||
var diff = getPath('songs/${song.toLowerCase()}/Voices-$difficulty.$SOUND_EXT', MUSIC, null);
|
||||
return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/Voices.$SOUND_EXT', MUSIC, null);
|
||||
}
|
||||
|
||||
inline static public function inst(song:String)
|
||||
inline static public function inst(song:String, difficulty:String = "normal")
|
||||
{
|
||||
return getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC, null);
|
||||
var diff = getPath('songs/${song.toLowerCase()}/Inst-$difficulty.$SOUND_EXT', MUSIC, null);
|
||||
return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC, null);
|
||||
}
|
||||
|
||||
inline static public function image(key:String, ?library:String)
|
||||
|
||||
Reference in New Issue
Block a user