use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.
the class AnimMaster method bindEvents.
public void bindEvents() {
DC_SoundMaster.bindEvents();
GuiEventManager.bind(GuiEventType.ADD_FLOATING_TEXT, p -> {
FloatingText floatingText = (FloatingText) p.get();
// if (!floatingText.isInitialized())
floatingText.init();
addActor(floatingText);
});
GuiEventManager.bind(GuiEventType.MOUSE_HOVER, p -> {
if (!isOn()) {
return;
}
if (!(p.get() instanceof Unit)) {
return;
}
if (showBuffAnimsOnHoverLength == null) {
return;
}
try {
mouseHover((Unit) p.get());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
GuiEventManager.bind(GuiEventType.ACTION_INTERRUPTED, p -> {
if (!isOn()) {
return;
}
leadAnimation.interrupt();
});
GuiEventManager.bind(GuiEventType.ACTION_BEING_RESOLVED, p -> {
// CompositeAnim animation = constructor.getOrCreate((DC_ActiveObj) portrait.get());
});
GuiEventManager.bind(GuiEventType.ACTION_RESOLVES, p -> {
if (!isOn()) {
return;
}
ActionInput input = (ActionInput) p.get();
try {
initActionAnimation(input.getAction(), (AnimContext) input.getContext());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
// GuiEventManager.bind(GuiEventType.UPDATE_BUFFS, p -> {
// updateContinuousAnims();
// });
// GuiEventManager.bind(GuiEventType.ABILITY_RESOLVES, p -> {
// if (!isOn()) {
// return;
// }
// Ability ability = (Ability) p.get();
// what about triggers?
// getParentAnim(ability.getRef().getActive()).addAbilityAnims(ability);
// });
GuiEventManager.bind(GuiEventType.INGAME_EVENT_TRIGGERED, p -> {
if (!isOn()) {
return;
}
try {
initEventAnimation((Event) p.get());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
GuiEventManager.bind(GuiEventType.EFFECT_APPLIED, p -> {
if (!isOn()) {
return;
}
try {
initEffectAnimation((Effect) p.get());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
}
use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.
the class RadialManager method configureSelectiveTargetedNode.
protected static RadialValueContainer configureSelectiveTargetedNode(DC_ActiveObj active, DC_Obj target) {
boolean wasValid;
// if (target == null|| target.equals(active.getOwnerObj())){
// Set<Obj> objSet = CoreEngine.isActionTargetingFiltersOff() ?
// DC_Game.game.getUnits().parallelStream().distinct().collect(Collectors.toSet())
// : getFilter(active).getObjects();
// wasValid = objSet.size() > 0 &&
// active.canBeManuallyActivated();
// } else
wasValid = active.canBeManuallyActivated();
final boolean valid = wasValid;
TextureRegion textureRegion = getOrCreateR(active.getImagePath());
// valid ? now via Shader!
// getOrCreateR(active.getImagePath()) :
// getOrCreateGrayscaleR(active.getImagePath());
Runnable runnable = () -> {
if (valid) {
Context context = new Context(active.getOwnerObj().getRef());
if (target != null)
if (!target.equals(active.getOwnerObj())) {
context.setTarget(target.getId());
}
Eidolons.getGame().getGameLoop().actionInput(new ActionInput(active, context));
} else {
FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.CANNOT_ACTIVATE, "", active);
}
};
return new RadialValueContainer(textureRegion, runnable, valid, active, target);
}
use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.
the class Executor method activateOn.
public void activateOn(Ref ref) {
targeter.setForcePresetTarget(true);
Eidolons.getGame().getGameLoop().actionInput(new ActionInput(getAction(), new Context(ref)));
}
use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.
the class Executor method activateOn.
public void activateOn(DC_Obj t) {
if (Thread.currentThread() == getGame().getGameLoopThread()) {
// for triggered activation, e.g. Extra Attacks
targeter.presetTarget = t;
activate();
return;
}
Eidolons.getGame().getGameLoop().actionInput(new ActionInput(getAction(), t));
}
use of eidolons.game.core.ActionInput in project Eidolons by IDemiurge.
the class Executor method activate.
public boolean activate() {
reset();
syncActionRefWithSource();
getTargeter().initTarget();
if ((isCancelled()) != null) {
cancelled();
return false;
}
if (isInterrupted()) {
return interrupted();
}
Obj target = getAction().getTargetObj();
AnimContext animContext = new AnimContext(getAction());
animContext.setTarget(target);
boolean gameLog = getAction().getLogger().isActivationLogged();
String targets = " ";
if (getAction().getLogger().isTargetLogged())
if (target != null) {
if (game.isDebugMode())
targets = getAction().getTargetObj().getNameAndCoordinate();
else
targets = getAction().getTargetObj().getNameIfKnown();
} else if (getAction().getTargetGroup() != null) {
targets = getAction().getTargetGroup().toString();
}
log(getAction().getOwnerObj().getNameAndCoordinate() + " activates " + getAction().getName() + " " + targets, false);
if (gameLog)
log(getAction().getOwnerObj().getNameIfKnown() + " activates " + getAction().getNameIfKnown() + " " + targets, true);
beingActivated();
if (isInterrupted()) {
return interrupted();
}
initActivation();
if (isInterrupted()) {
return interrupted();
}
resolve();
if (!BooleanMaster.isTrue(cancelled)) {
payCosts();
}
if (AnimMaster.isOn())
if (!AnimMaster.getInstance().getConstructor().isReconstruct())
AnimMaster.getInstance().getConstructor().preconstruct(getAction());
GuiEventManager.trigger(GuiEventType.ACTION_RESOLVES, new ActionInput(getAction(), animContext));
actionComplete();
return isResult();
}
Aggregations