use of com.bladecoder.engine.model.Scene in project bladecoder-adventure-engine by bladecoder.
the class SceneList method copy.
@Override
protected void copy() {
Scene e = list.getSelected();
if (e == null)
return;
clipboard = (Scene) ElementUtils.cloneElement(e);
toolbar.disablePaste(false);
// TRANSLATIONS
Ctx.project.getI18N().putTranslationsInElement(clipboard);
}
use of com.bladecoder.engine.model.Scene in project bladecoder-adventure-engine by bladecoder.
the class ModelWalker method walk.
public void walk(World w) {
Map<String, Scene> scenes = World.getInstance().getScenes();
for (StartVisitor sv : startVisitors) sv.start(w);
for (Scene scn : scenes.values()) {
for (SceneVisitor sv : sceneVisitors) sv.visit(scn);
Map<String, BaseActor> actors = scn.getActors();
// SCENE VERBS
HashMap<String, Verb> verbs = scn.getVerbManager().getVerbs();
for (Verb v : verbs.values()) {
for (VerbVisitor vv : verbVisitors) vv.visit(scn, null, v);
ArrayList<Action> actions = v.getActions();
for (Action act : actions) {
for (ActionVisitor av : actionVisitors) av.visit(scn, null, v, act);
}
}
for (BaseActor a : actors.values()) {
for (ActorVisitor av : actorVisitors) av.visit(a);
if (a instanceof InteractiveActor) {
InteractiveActor ia = (InteractiveActor) a;
// ACTOR VERBS
verbs = ia.getVerbManager().getVerbs();
for (Verb v : verbs.values()) {
for (VerbVisitor vv : verbVisitors) vv.visit(scn, ia, v);
ArrayList<Action> actions = v.getActions();
for (Action act : actions) {
for (ActionVisitor av : actionVisitors) av.visit(scn, ia, v, act);
}
}
}
// DIALOGS
if (a instanceof CharacterActor) {
HashMap<String, Dialog> dialogs = ((CharacterActor) a).getDialogs();
if (dialogs != null) {
for (Dialog d : dialogs.values()) {
for (DialogVisitor dv : dialogVisitors) dv.visit((CharacterActor) a, d);
ArrayList<DialogOption> options = d.getOptions();
for (DialogOption o : options) {
for (DialogOptionVisitor ov : optionVisitors) ov.visit((CharacterActor) a, d, o);
}
}
}
}
}
}
for (EndVisitor ev : endVisitors) ev.end(w);
}
use of com.bladecoder.engine.model.Scene in project bladecoder-adventure-engine by bladecoder.
the class SceneActorInputPanel method sceneSelected.
private void sceneSelected() {
String s = scene.getSelected();
if (s == null || s.isEmpty()) {
s = Ctx.project.getSelectedScene().getId();
}
Scene scn = World.getInstance().getScene(s);
actor.setItems(getActorValues(scn));
}
use of com.bladecoder.engine.model.Scene in project bladecoder-adventure-engine by bladecoder.
the class MoveToSceneAction method run.
@Override
public boolean run(VerbRunner cb) {
final Scene s = actor.getScene();
final String actorId = actor.getActorId();
final World w = World.getInstance();
if (actorId == null) {
// if called in a scene verb and no actor is specified, we do nothing
EngineLogger.error(getClass() + ": No actor specified");
return false;
}
InteractiveActor a = (InteractiveActor) s.getActor(actorId, false);
s.removeActor(a);
if (s == w.getCurrentScene() && a instanceof Disposable)
((Disposable) a).dispose();
Scene ts = null;
if (scene == null)
ts = w.getCurrentScene();
else
ts = w.getScene(scene);
// the scene is cached.
if ((ts == w.getCurrentScene() || w.getCachedScene(ts.getId()) != null) && a instanceof AssetConsumer) {
((AssetConsumer) a).loadAssets();
EngineAssetManager.getInstance().finishLoading();
((AssetConsumer) a).retrieveAssets();
}
ts.addActor(a);
return false;
}
use of com.bladecoder.engine.model.Scene in project bladecoder-adventure-engine by bladecoder.
the class PickUpAction method run.
@Override
public boolean run(VerbRunner cb) {
Scene scn = this.actor.getScene();
InteractiveActor actor = (InteractiveActor) scn.getActor(this.actor.getActorId(), false);
if (actor == null) {
EngineLogger.error("PickUpAction - Actor not found:" + this.actor.getActorId());
return false;
}
scn.removeActor(actor);
if (actor instanceof SpriteActor) {
SpriteActor a = (SpriteActor) actor;
if (scn != World.getInstance().getCurrentScene() && World.getInstance().getCachedScene(scn.getId()) == null) {
a.loadAssets();
EngineAssetManager.getInstance().finishLoading();
a.retrieveAssets();
}
if (a.getRenderer() instanceof AnimationRenderer) {
if (animation != null)
a.startAnimation(animation, null);
else if (((AnimationRenderer) a.getRenderer()).getAnimations().get(a.getId() + ".inventory") != null)
a.startAnimation(a.getId() + ".inventory", null);
}
World.getInstance().getInventory().addItem(a);
}
return false;
}
Aggregations