mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-02-09 21:17:19 +00:00
Replace multiple conditions with array.
This commit is contained in:
parent
fecb4a5ad5
commit
387ff4e816
|
@ -9,6 +9,11 @@ import funkin.play.event.ScriptedSongEvent;
|
||||||
@:forward(name, title, type, keys, min, max, step, units, defaultValue, iterator)
|
@:forward(name, title, type, keys, min, max, step, units, defaultValue, iterator)
|
||||||
abstract SongEventSchema(SongEventSchemaRaw)
|
abstract SongEventSchema(SongEventSchemaRaw)
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* These units look better when placed immediately next to the value, rather than after a space.
|
||||||
|
*/
|
||||||
|
static final NO_SPACE_UNITS:Array<String> = ['x', '°', '%'];
|
||||||
|
|
||||||
public function new(?fields:Array<SongEventSchemaField>)
|
public function new(?fields:Array<SongEventSchemaField>)
|
||||||
{
|
{
|
||||||
this = fields;
|
this = fields;
|
||||||
|
@ -80,10 +85,7 @@ abstract SongEventSchema(SongEventSchemaRaw)
|
||||||
|
|
||||||
var unit:String = field.units;
|
var unit:String = field.units;
|
||||||
|
|
||||||
// These units look better when placed immediately next to the value, rather than after a space.
|
return value + (NO_SPACE_UNITS.contains(unit) ? '' : ' ') + '${unit}';
|
||||||
if (unit == 'x' || unit == '°' || unit == '%') return value + '${unit}';
|
|
||||||
|
|
||||||
return value + ' ${unit}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue