mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 11:22:55 +00:00
Add Custom Params For NoteKind
still need to implement the chart editor stuff
This commit is contained in:
parent
fbcc73dcee
commit
acd8912d16
|
@ -23,11 +23,17 @@ class NoteKind implements INoteScriptedClass
|
||||||
*/
|
*/
|
||||||
public var noteStyleId:Null<String>;
|
public var noteStyleId:Null<String>;
|
||||||
|
|
||||||
public function new(noteKind:String, description:String = "", ?noteStyleId:String)
|
/**
|
||||||
|
* Custom parameters for the chart editor
|
||||||
|
*/
|
||||||
|
public var params:Array<NoteKindParam>;
|
||||||
|
|
||||||
|
public function new(noteKind:String, description:String = "", ?noteStyleId:String, ?params:Array<NoteKindParam>)
|
||||||
{
|
{
|
||||||
this.noteKind = noteKind;
|
this.noteKind = noteKind;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.noteStyleId = noteStyleId;
|
this.noteStyleId = noteStyleId;
|
||||||
|
this.params = params ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toString():String
|
public function toString():String
|
||||||
|
@ -35,6 +41,25 @@ class NoteKind implements INoteScriptedClass
|
||||||
return noteKind;
|
return noteKind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the param with the given name
|
||||||
|
* If there exists no param with the given name then `null` is returned
|
||||||
|
* @param name Name of the param
|
||||||
|
* @return Null<NoteKindParam>
|
||||||
|
*/
|
||||||
|
public function getParam(name:String):Null<NoteKindParam>
|
||||||
|
{
|
||||||
|
for (param in params)
|
||||||
|
{
|
||||||
|
if (param.name == name)
|
||||||
|
{
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve all notes of this kind
|
* Retrieve all notes of this kind
|
||||||
* @return Array<NoteSprite>
|
* @return Array<NoteSprite>
|
||||||
|
@ -61,3 +86,46 @@ class NoteKind implements INoteScriptedClass
|
||||||
|
|
||||||
public function onNoteMiss(event:NoteScriptEvent):Void {}
|
public function onNoteMiss(event:NoteScriptEvent):Void {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract for setting the type of the `NoteKindParam`
|
||||||
|
* This was supposed to be an enum but polymod kept being annoying
|
||||||
|
*/
|
||||||
|
abstract NoteKindParamType(String)
|
||||||
|
{
|
||||||
|
public static var STRING:String = "String";
|
||||||
|
|
||||||
|
public static var INT:String = "Int";
|
||||||
|
|
||||||
|
public static var RANGED_INT:String = "RangedInt";
|
||||||
|
|
||||||
|
public static var FLOAT:String = "Float";
|
||||||
|
|
||||||
|
public static var RANGED_FLOAT:String = "RangedFloat";
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef NoteKindParamData =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Only used for `RangedInt` and `RangedFloat`
|
||||||
|
*/
|
||||||
|
var min:Null<Float>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only used for `RangedInt` and `RangedFloat`
|
||||||
|
*/
|
||||||
|
var max:Null<Float>;
|
||||||
|
|
||||||
|
var value:Dynamic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Typedef for creating custom parameters in the chart editor
|
||||||
|
*/
|
||||||
|
typedef NoteKindParam =
|
||||||
|
{
|
||||||
|
var name:String;
|
||||||
|
var description:String;
|
||||||
|
var type:NoteKindParamType;
|
||||||
|
var data:NoteKindParamData;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue