本文整理汇总了Java中com.artemis.BaseSystem类的典型用法代码示例。如果您正苦于以下问题:Java BaseSystem类的具体用法?Java BaseSystem怎么用?Java BaseSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseSystem类属于com.artemis包,在下文中一共展示了BaseSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:17,代码来源:EngineStateClosing.java
示例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;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:27,代码来源:SceneModuleContainer.java
示例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;
}
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:12,代码来源:EngineStateNotInitialized.java
示例4: onConfigureEntitySystems
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public Array<BaseSystem> onConfigureEntitySystems() {
Array<BaseSystem> systems = new Array<>();
systems.add(new TestNodeSystem());
return systems;
}
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:8,代码来源:Main.java
示例5: registerAllSystemEvents
import com.artemis.BaseSystem; //导入依赖的package包/类
/** Register all systems in this world. */
private void registerAllSystemEvents( )
{
for (BaseSystem entitySystem : world.getSystems()) {
registerEvents(entitySystem);
}
}
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:8,代码来源:EventSystem.java
示例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!
}
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:15,代码来源:EventSystemTest.java
示例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;
}
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:15,代码来源:SystemProfiler.java
示例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);
}
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:12,代码来源:SystemProfiler.java
示例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();
}
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:13,代码来源:ProfilerInvocationStrategy.java
示例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));
}
}
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:8,代码来源:ProfilerInvocationStrategy.java
示例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;
}
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:8,代码来源:ProfilerInvocationStrategy.java
示例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();
}
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:16,代码来源:Scene.java
示例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);
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:9,代码来源:ReflectionSystemProvider.java
示例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!");
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:12,代码来源:EntityEngineConfiguration.java
示例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;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:12,代码来源:EntityEngineConfiguration.java
示例16: process
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
protected void process () {
BaseSystem[] systemsData = systems.getData();
for (int i = 0, s = systems.size(); s > i; i++) {
if (disabled.get(i))
continue;
if (systemsData[i] instanceof BootstrapSystem) {
updateEntityStates();
systemsData[i].process();
}
}
updateEntityStates();
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:16,代码来源:BootstrapInvocationStrategy.java
示例17: 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 < elements.size; i++) {
BaseSystem system = elements.get(i).system;
if (system.getClass() == clazz) return clazz.cast(system);
}
throw new IllegalStateException("Failed to get system: '" + clazz + "', system not added!");
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:12,代码来源:SortedEntityEngineConfiguration.java
示例18: onConfigureEntitySystems
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public Array<BaseSystem> onConfigureEntitySystems() {
return super.onConfigureEntitySystems();
}
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:5,代码来源:NhgEntry.java
示例19: onConfigureEntitySystems
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public Array<BaseSystem> onConfigureEntitySystems() {
return new Array<>();
}
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:5,代码来源:BaseGame.java
示例20: enter
import com.artemis.BaseSystem; //导入依赖的package包/类
@Override
public void enter(NhgEntry nhgEntry) {
NhgLogger.log(this, "Engine is not initialized.");
// Setup the ECS world.
WorldConfigurationBuilder configurationBuilder = new WorldConfigurationBuilder();
// Configure user entity systems
Array<BaseSystem> entitySystems = nhgEntry.onConfigureEntitySystems();
// Configure the most important systems last, especially RenderingSystem which
// should be the last because it renders all the changes happened in all other
// systems.
if (!hasSystemClass(InputSystem.class, entitySystems)) {
entitySystems.add(new InputSystem(nhgEntry.nhg.assets));
} else {
NhgLogger.log(this, "InputSystem already registered, ignoring registration.");
}
if (!hasSystemClass(PhysicsSystem.class, entitySystems)) {
entitySystems.add(new PhysicsSystem());
} else {
NhgLogger.log(this, "PhysicsSystem already registered, ignoring registration.");
}
if (!hasSystemClass(CameraSystem.class, entitySystems)) {
entitySystems.add(new CameraSystem());
} else {
NhgLogger.log(this, "CameraSystem already registered, ignoring registration.");
}
if (!hasSystemClass(LightingSystem.class, entitySystems)) {
entitySystems.add(new LightingSystem());
} else {
NhgLogger.log(this, "LightingSystem already registered, ignoring registration.");
}
if (!hasSystemClass(ParticleRenderingSystem.class, entitySystems)) {
entitySystems.add(new ParticleRenderingSystem(nhgEntry.nhg.entities));
} else {
NhgLogger.log(this, "ParticleRenderingSystem already registered, ignoring registration.");
}
if (!hasSystemClass(ModelRenderingSystem.class, entitySystems)) {
entitySystems.add(new ModelRenderingSystem(nhgEntry.nhg.entities, nhgEntry.nhg.messaging));
} else {
NhgLogger.log(this, "ModelRenderingSystem already registered, ignoring registration.");
}
if (!hasSystemClass(UiSystem.class, entitySystems)) {
entitySystems.add(new UiSystem(nhgEntry.nhg.entities));
} else {
NhgLogger.log(this, "ModelRenderingSystem already registered, ignoring registration.");
}
if (!hasSystemClass(DebugRenderingSystem.class, entitySystems)) {
entitySystems.add(new DebugRenderingSystem(nhgEntry.nhg.entities));
} else {
NhgLogger.log(this, "DebugRenderingSystem already registered, ignoring registration.");
}
if (!hasSystemClass(RenderingSystem.class, entitySystems)) {
entitySystems.add(new RenderingSystem());
} else {
NhgLogger.log(this, "RenderingSystem already registered, ignoring registration.");
}
for (BaseSystem bes : entitySystems) {
configurationBuilder.with(bes);
}
nhgEntry.nhg.entities.setEntityWorld(new World(configurationBuilder.build()));
nhgEntry.getFsm().changeState(EngineStates.INITIALIZED);
}
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:75,代码来源:EngineStateNotInitialized.java
注:本文中的com.artemis.BaseSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论