Skip to content

Commit bfca9bc

Browse files
committed
Label and text to warning about legacy dialogs.
1 parent 62041d3 commit bfca9bc

File tree

2 files changed

+73
-73
lines changed

2 files changed

+73
-73
lines changed

adventure-editor/src/main/java/com/bladecoder/engineeditor/ui/ActorPanel.java

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -47,74 +47,75 @@ public ActorPanel(Skin skin) {
4747
faList = new SpriteList(skin);
4848
// props = new ActorProps(skin);
4949

50-
5150
setContent(tabPanel);
5251
tabPanel.addTab("Verbs", verbList);
5352

54-
Ctx.project.addPropertyChangeListener(Project.NOTIFY_ACTOR_SELECTED,
55-
new PropertyChangeListener() {
56-
@Override
57-
public void propertyChange(PropertyChangeEvent e) {
58-
BaseActor a = (BaseActor) e.getNewValue();
53+
Ctx.project.addPropertyChangeListener(Project.NOTIFY_ACTOR_SELECTED, new PropertyChangeListener() {
54+
@Override
55+
public void propertyChange(PropertyChangeEvent e) {
56+
BaseActor a = (BaseActor) e.getNewValue();
5957

60-
String selTitle = tabPanel.getSelectedIndex() == -1? null: tabPanel.getTitleAt(tabPanel.getSelectedIndex());
61-
tabPanel.clear();
62-
63-
tabPanel.addTab("Verbs", verbList);
58+
String selTitle = tabPanel.getSelectedIndex() == -1 ? null
59+
: tabPanel.getTitleAt(tabPanel.getSelectedIndex());
60+
tabPanel.clear();
6461

65-
if (a != null) {
66-
67-
if (a instanceof SpriteActor && ((SpriteActor) a).getRenderer() instanceof AnimationRenderer)
68-
tabPanel.addTab("Animations", faList);
62+
tabPanel.addTab("Verbs", verbList);
63+
64+
if (a != null) {
65+
66+
if (a instanceof SpriteActor && ((SpriteActor) a).getRenderer() instanceof AnimationRenderer)
67+
tabPanel.addTab("Animations", faList);
68+
69+
if (a instanceof CharacterActor) {
70+
tabPanel.addTab("Simple Dialogs", dialogList);
71+
}
6972

70-
if (a instanceof CharacterActor) {
71-
tabPanel.addTab("Dialogs", dialogList);
72-
}
73-
74-
7573
// tabPanel.addTab("Actor Props", props);
76-
setTile("ACTOR " + a.getId());
77-
78-
// select previous selected tab
79-
if (selTitle != null) {
80-
for (int i = 0; i < tabPanel.getTabCount(); i++) {
81-
if (tabPanel.getTitleAt(i).equals(selTitle)) {
82-
tabPanel.setTab(i);
83-
}
84-
}
74+
setTile("ACTOR " + a.getId());
75+
76+
// select previous selected tab
77+
if (selTitle != null) {
78+
for (int i = 0; i < tabPanel.getTabCount(); i++) {
79+
if (tabPanel.getTitleAt(i).equals(selTitle)) {
80+
tabPanel.setTab(i);
8581
}
86-
} else {
87-
setTile("ACTOR");
88-
}
89-
90-
if(a instanceof SpriteActor && ((SpriteActor) a).getRenderer() instanceof AnimationRenderer) {
91-
HashMap<String, AnimationDesc> anims = ((AnimationRenderer)((SpriteActor) a).getRenderer()).getAnimations();
92-
if(anims != null)
93-
faList.addElements((SpriteActor)a, Arrays.asList(anims.values().toArray(new AnimationDesc[0])));
94-
else
95-
faList.addElements((SpriteActor)a, null);
96-
} else {
97-
faList.addElements(null, null);
9882
}
99-
100-
verbList.changeActor();
101-
102-
if(a instanceof CharacterActor) {
103-
104-
HashMap<String, Dialog> dialogs = ((CharacterActor) a).getDialogs();
105-
if(dialogs != null)
106-
dialogList.addElements((CharacterActor)a, Arrays.asList(dialogs.values().toArray(new Dialog[0])));
107-
else
108-
dialogList.addElements((CharacterActor)a, null);
109-
} else {
110-
dialogList.addElements(null, null);
111-
}
112-
113-
// props.setActorDocument(a);
114-
11583
}
84+
} else {
85+
setTile("ACTOR");
86+
}
87+
88+
if (a instanceof SpriteActor && ((SpriteActor) a).getRenderer() instanceof AnimationRenderer) {
89+
HashMap<String, AnimationDesc> anims = ((AnimationRenderer) ((SpriteActor) a).getRenderer())
90+
.getAnimations();
91+
if (anims != null)
92+
faList.addElements((SpriteActor) a,
93+
Arrays.asList(anims.values().toArray(new AnimationDesc[0])));
94+
else
95+
faList.addElements((SpriteActor) a, null);
96+
} else {
97+
faList.addElements(null, null);
98+
}
99+
100+
verbList.changeActor();
101+
102+
if (a instanceof CharacterActor) {
103+
104+
HashMap<String, Dialog> dialogs = ((CharacterActor) a).getDialogs();
105+
if (dialogs != null)
106+
dialogList.addElements((CharacterActor) a,
107+
Arrays.asList(dialogs.values().toArray(new Dialog[0])));
108+
else
109+
dialogList.addElements((CharacterActor) a, null);
110+
} else {
111+
dialogList.addElements(null, null);
112+
}
113+
114+
// props.setActorDocument(a);
115+
116+
}
117+
118+
});
116119

117-
});
118-
119120
}
120121
}

adventure-editor/src/main/java/com/bladecoder/engineeditor/ui/EditDialogDialog.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,45 @@
2525
import com.bladecoder.engineeditor.ui.panels.InputPanelFactory;
2626

2727
public class EditDialogDialog extends EditModelDialog<CharacterActor, Dialog> {
28-
public static final String INFO = "Actors can have several dialogs defined. Dialogs have a tree of options to choose";
28+
public static final String INFO = "Actors can have several dialogs defined. Dialogs have a list of options to choose.\nThis is the legacy option to create simple dialogs, for more complex dialogs use the *Ink* language.";
2929

3030
private InputPanel id;
31-
32-
public EditDialogDialog(Skin skin, CharacterActor parent, Dialog e) {
31+
32+
public EditDialogDialog(Skin skin, CharacterActor parent, Dialog e) {
3333
super(skin);
34-
35-
id = InputPanelFactory.createInputPanel(skin, "Dialog ID",
36-
"Select the dialog id to create.", true);
34+
35+
id = InputPanelFactory.createInputPanel(skin, "Dialog ID", "Select the dialog id to create.", true);
3736

3837
setInfo(INFO);
39-
38+
4039
init(parent, e, new InputPanel[] { id });
4140
}
42-
41+
4342
@Override
4443
protected void inputsToModel(boolean create) {
45-
46-
if(create) {
44+
45+
if (create) {
4746
e = new Dialog();
4847
} else {
4948
parent.getDialogs().remove(e.getId());
5049
}
51-
52-
if(parent.getDialogs() != null)
50+
51+
if (parent.getDialogs() != null)
5352
e.setId(ElementUtils.getCheckedId(id.getText(), parent.getDialogs().keySet().toArray(new String[0])));
5453
else
5554
e.setId(id.getText());
56-
55+
5756
parent.addDialog(e);
5857

5958
// TODO UNDO OP
6059
// UndoOp undoOp = new UndoAddElement(doc, e);
6160
// Ctx.project.getUndoStack().add(undoOp);
62-
61+
6362
Ctx.project.setModified();
6463
}
6564

6665
@Override
6766
protected void modelToInputs() {
6867
id.setText(e.getId());
69-
}
68+
}
7069
}

0 commit comments

Comments
 (0)