![JAR search and dependency download from the Maven repository](/logo.png)
com.uwsoft.editor.renderer.components.ScriptComponent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of overlap2d-runtime-libgdx Show documentation
Show all versions of overlap2d-runtime-libgdx Show documentation
overlap2d-runtime-libgdx provides functionality to load, manipulate and render scenes generated by Overlap2D.
The newest version!
package com.uwsoft.editor.renderer.components;
import com.badlogic.ashley.core.Component;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.ReflectionException;
import com.uwsoft.editor.renderer.scripts.IScript;
import java.util.Iterator;
/**
* Created by azakhary on 6/19/2015.
*/
public class ScriptComponent implements Component {
public Array scripts = new Array();
public void addScript(IScript script) {
scripts.add(script);
}
public void addScript(String className) {
try {
IScript script = (IScript) ClassReflection.newInstance(ClassReflection.forName(className));
addScript(script);
} catch (ReflectionException e) {
// well, if it's not there, then we don't care
}
}
public void removeScript(Class className) {
Iterator i = scripts.iterator();
while (i.hasNext()) {
IScript s = i.next();
if(s.getClass().getName().equals(className)) {
i.remove();
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy