use of com.bladecoder.engine.actions.Action in project bladecoder-adventure-engine by bladecoder.
the class I18NHandler method extractStrings.
public void extractStrings(String sceneid, String actorid, Verb v) {
ArrayList<Action> actions = v.getActions();
for (int i = 0; i < actions.size(); i++) {
Action a = actions.get(i);
extractStrings(sceneid, actorid, v.getHashKey(), i, a);
}
}
use of com.bladecoder.engine.actions.Action in project bladecoder-adventure-engine by bladecoder.
the class EditActionDialog method setAction.
private void setAction() {
String id = actionPanel.getText();
getCenterPanel().clear();
addInputPanel(actionPanel);
Action tmp = null;
tmp = ActionDetector.create(id, null);
String info = ActionUtils.getInfo(tmp.getClass());
if (ActionUtils.isDeprecated(tmp.getClass()))
info = "[RED]DEPRECATED[]\n" + info;
setInfo(info);
if (e == null || tmp == null || !(e.getClass().getName().equals(tmp.getClass().getName())))
e = tmp;
if (e != null) {
Param[] params = ActionUtils.getParams(e);
i = new InputPanel[params.length];
for (int j = 0; j < params.length; j++) {
if (params[j].options instanceof Enum[]) {
i[j] = InputPanelFactory.createInputPanel(getSkin(), params[j].name, params[j].desc, params[j].type, params[j].mandatory, params[j].defaultValue, (Enum[]) params[j].options);
} else {
i[j] = InputPanelFactory.createInputPanel(getSkin(), params[j].name, params[j].desc, params[j].type, params[j].mandatory, params[j].defaultValue, (String[]) params[j].options);
}
addInputPanel(i[j]);
if ((i[j].getField() instanceof TextField && params[j].name.toLowerCase().endsWith("text")) || i[j].getField() instanceof ScrollPane) {
i[j].getCell(i[j].getField()).fillX();
}
}
} else {
i = new InputPanel[0];
}
}
use of com.bladecoder.engine.actions.Action in project bladecoder-adventure-engine by bladecoder.
the class ActionList method delete.
@Override
protected void delete() {
if (list.getSelection().size() == 0)
return;
multiClipboard.clear();
int pos = list.getSelectedIndex();
for (Action e : getSortedSelection()) {
if (e instanceof EndAction)
continue;
int pos2 = list.getItems().indexOf(e, true);
list.getItems().removeValue(e, true);
int idx = parent.getActions().indexOf(e);
parent.getActions().remove(e);
multiClipboard.add(e);
// TRANSLATIONS
if (scope.equals(ScopePanel.WORLD_SCOPE))
Ctx.project.getI18N().putTranslationsInElement(e, true);
else
Ctx.project.getI18N().putTranslationsInElement(e, false);
// UNDO
Ctx.project.getUndoStack().add(new UndoDeleteAction(parent, e, idx));
if (isControlAction(e))
deleteControlAction(pos2, (AbstractControlAction) e);
}
if (list.getItems().size == 0) {
list.getSelection().clear();
} else if (pos >= list.getItems().size) {
list.getSelection().choose(list.getItems().get(list.getItems().size - 1));
} else {
list.getSelection().choose(list.getItems().get(pos));
}
toolbar.disablePaste(false);
Ctx.project.setModified();
}
use of com.bladecoder.engine.actions.Action in project bladecoder-adventure-engine by bladecoder.
the class ActionList method insertEndAction.
private void insertEndAction(int pos, String id) {
final Action e = new EndAction();
try {
ActionUtils.setParam(e, CONTROL_ACTION_ID_ATTR, id);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
EditorLogger.error(e1.getMessage());
}
list.getItems().insert(pos, e);
parent.getActions().add(pos, e);
}
use of com.bladecoder.engine.actions.Action in project bladecoder-adventure-engine by bladecoder.
the class ActionList method up.
private void up() {
if (parent == null || list.getSelection().size() == 0)
return;
Array<Action> sel = new Array<Action>();
for (Action a : getSortedSelection()) {
int pos = list.getItems().indexOf(a, true);
if (pos == -1 || pos == 0)
return;
Array<Action> items = list.getItems();
Action e = items.get(pos);
Action e2 = items.get(pos - 1);
sel.add(e);
if (isControlAction(e) && isControlAction(e2)) {
continue;
}
parent.getActions().set(pos - 1, e);
parent.getActions().set(pos, e2);
items.set(pos - 1, e);
items.set(pos, e2);
}
list.getSelection().clear();
list.getSelection().addAll(sel);
upBtn.setDisabled(list.getSelectedIndex() == 0);
downBtn.setDisabled(list.getSelectedIndex() == list.getItems().size - 1);
Ctx.project.setModified();
}
Aggregations