LNXSDK/leenkx/Sources/iron/data/ParticleData.hx

28 lines
617 B
Haxe
Raw Normal View History

2025-01-22 16:18:30 +01:00
package iron.data;
import iron.data.SceneFormat;
class ParticleData {
public var name: String;
public var raw: TParticleData;
public function new(raw: TParticleData, done: ParticleData->Void) {
this.raw = raw;
this.name = raw.name;
done(this);
}
public static function parse(name: String, id: String, done: ParticleData->Void) {
Data.getSceneRaw(name, function(format: TSceneFormat) {
var raw: TParticleData = Data.getParticleRawByName(format.particle_datas, id);
if (raw == null) {
trace('Particle data "$id" not found!');
done(null);
}
new ParticleData(raw, done);
});
}
}