本文整理汇总了Java中com.artemis.BaseSystem类的典型用法代码示例。如果您正苦于以下问题:Java BaseSystem类的具体用法?Java BaseSystem怎么用?Java BaseSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseSystem类属于com.artemis包,在下文中一共展示了BaseSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enter
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public void enter(NhgEntry nhgEntry) {
NhgLogger.log(this, "Engine is closing.");
nhgEntry.onClose();
ImmutableBag<BaseSystem> systems = nhgEntry.nhg.entities.getEntitySystems();
for (BaseSystem bs : systems) {
if (bs instanceof Disposable) {
((Disposable) bs).dispose();
}
}
nhgEntry.nhg.assets.dispose();
nhgEntry.nhg.threading.terminate();
Gdx.app.exit();
}
示例2: injectField
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
protected boolean injectField (Object target, Field field, Class<?> type) throws ReflectiveOperationException {
boolean alreadyInjected = super.injectField(target, field, type);
if (alreadyInjected) return true;
//artemis already handles injecting objects inside systems
if (target instanceof BaseSystem) return false;
if (BaseSystem.class.isAssignableFrom(type)) {
field.setAccessible(true);
field.set(target, engine != null ? engine.getSystem(type.asSubclass(BaseSystem.class)) : config.getSystem(type.asSubclass(BaseSystem.class)));
return true;
}
if (ComponentMapper.class.isAssignableFrom(type)) {
field.setAccessible(true);
if (engine == null)
delayedCompMapperToInject.add(new BiHolder<>(target, field));
else
injectComponentMapper(target, field);
return true;
}
return false;
}
示例3: hasSystemClass
import com.artemis.BaseSystem; //导入依赖的package包/类
private boolean hasSystemClass(Class<? extends BaseSystem> systemClass, Array<BaseSystem> entitySystems) {
boolean res = false;
for (BaseSystem es : entitySystems) {
if (systemClass.isInstance(es)) {
res = true;
}
}
return res;
}
示例4: onConfigureEntitySystems
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public Array<BaseSystem> onConfigureEntitySystems() {
Array<BaseSystem> systems = new Array<>();
systems.add(new TestNodeSystem());
return systems;
}
示例5: registerAllSystemEvents
import com.artemis.BaseSystem; //导入依赖的package包/类
/** Register all systems in this world. */
private void registerAllSystemEvents( )
{
for (BaseSystem entitySystem : world.getSystems()) {
registerEvents(entitySystem);
}
}
示例6: Registration_AllTypesWithNoListeners_NoExceptions
import com.artemis.BaseSystem; //导入依赖的package包/类
@Test
public void Registration_AllTypesWithNoListeners_NoExceptions() {
config.setSystem(new BaseSystem() {
@Override
protected void processSystem() {
}
});
config.setSystem(new Manager() {
});
final World w = new World(config);
w.getSystem(EventSystem.class).registerEvents(new Object() {});
w.getSystem(EventSystem.class).dispatch(new SimpleEvent());
// no exception? happy!
}
示例7: getFor
import com.artemis.BaseSystem; //导入依赖的package包/类
/**
* Get profiler for given system
* @return profiler or null
*/
public static SystemProfiler getFor (BaseSystem system) {
Object[] items = profilers.items;
for (int i = 0; i < profilers.size; i++) {
SystemProfiler profiler = (SystemProfiler)items[i];
if (profiler.system == system) {
return profiler;
}
}
return null;
}
示例8: initialize
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public void initialize(BaseSystem baseSystem, World world) {
system = baseSystem;
if (name == null) {
name = toString();
}
if (color == null) {
calculateColor(toString().hashCode(), color = new Color());
}
SystemProfiler.add(this);
}
示例9: processProfileSystems
import com.artemis.BaseSystem; //导入依赖的package包/类
private void processProfileSystems(Bag<BaseSystem> systems) {
final Object[] systemsData = systems.getData();
for (int i = 0, s = systems.size(); s > i; i++) {
if (disabled.get(i))
continue;
updateEntityStates();
processProfileSystem(profilers[i], (BaseSystem) systemsData[i]);
}
updateEntityStates();
}
示例10: createSystemProfilers
import com.artemis.BaseSystem; //导入依赖的package包/类
private void createSystemProfilers() {
final ImmutableBag<BaseSystem> systems = world.getSystems();
profilers = new SystemProfiler[systems.size()];
for (int i = 0; i < systems.size(); i++) {
profilers[i] = createSystemProfiler(systems.get(i));
}
}
示例11: createSystemProfiler
import com.artemis.BaseSystem; //导入依赖的package包/类
private SystemProfiler createSystemProfiler(BaseSystem system) {
SystemProfiler old = SystemProfiler.getFor(system);
if (old == null) {
old = SystemProfiler.createFor(system, world);
}
return old;
}
示例12: init
import com.artemis.BaseSystem; //导入依赖的package包/类
/**
* Finishes loading scene and inflate all entities. This must be called manually if scene wasn't loaded
* using {@link VisAssetManager} loadSceneNow methods.
*/
public void init () {
engine.setInvocationStrategy(new BootstrapInvocationStrategy());
engine.process();
engine.setInvocationStrategy(new InvocationStrategy());
for (BaseSystem system : engine.getSystems()) {
if (system instanceof AfterSceneInit) {
((AfterSceneInit) system).afterSceneInit();
}
}
}
示例13: create
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public BaseSystem create (EntityEngineConfiguration config, RuntimeContext context, SceneData data) {
try {
return ClassReflection.newInstance(systemClass);
} catch (ReflectionException e) {
throw new IllegalStateException("Failed to create system using reflection", e);
}
}
示例14: getSystem
import com.artemis.BaseSystem; //导入依赖的package包/类
public <C extends BaseSystem> C getSystem (Class<C> clazz) {
if (built)
throw new IllegalStateException("This configuration was already build and it's contents cannot be accessed!");
for (int i = 0; i < systems.size; i++) {
BaseSystem system = systems.get(i);
if (system.getClass() == clazz) return clazz.cast(system);
}
throw new IllegalStateException("Failed to get system: '" + clazz + "', system not added!");
}
示例15: build
import com.artemis.BaseSystem; //导入依赖的package包/类
public WorldConfiguration build () {
if (built) throw new IllegalStateException("Cannot built configuration twice!");
built = true;
WorldConfiguration config = new WorldConfiguration();
for (BaseSystem system : systems) {
config.setSystem(system);
}
return config;
}