File tree Expand file tree Collapse file tree 5 files changed +15
-24
lines changed
blade-engine/src/com/bladecoder/engine Expand file tree Collapse file tree 5 files changed +15
-24
lines changed Original file line number Diff line number Diff line change @@ -74,10 +74,6 @@ else if(next.equalsIgnoreCase("root"))
74
74
else
75
75
currentOption = findSerOption (next );
76
76
}
77
-
78
- if (ended ()) {
79
- World .getInstance ().setCurrentDialog (null );
80
- }
81
77
}
82
78
83
79
public void addOption (DialogOption o ) {
Original file line number Diff line number Diff line change @@ -406,6 +406,17 @@ public void setCurrentDialog(Dialog dialog) {
406
406
if (dialog != null )
407
407
dialog .reset ();
408
408
}
409
+
410
+ public void selectDialogOption (int i ) {
411
+ if (currentDialog == null )
412
+ return ;
413
+
414
+ currentDialog .selectOption (i );
415
+
416
+ if (currentDialog .ended ()) {
417
+ currentDialog = null ;
418
+ }
419
+ }
409
420
410
421
public int getWidth () {
411
422
return width ;
Original file line number Diff line number Diff line change 17
17
18
18
import java .util .ArrayList ;
19
19
20
- import com .bladecoder .engine .ui .Recorder ;
21
- import com .bladecoder .engine .ui .SceneScreen ;
22
-
23
20
import com .badlogic .gdx .graphics .Color ;
24
21
import com .badlogic .gdx .graphics .g2d .Batch ;
25
22
import com .badlogic .gdx .graphics .g2d .BitmapFont ;
28
25
import com .badlogic .gdx .scenes .scene2d .InputListener ;
29
26
import com .badlogic .gdx .scenes .scene2d .utils .Drawable ;
30
27
import com .bladecoder .engine .i18n .I18N ;
31
- import com .bladecoder .engine .model .Dialog ;
32
28
import com .bladecoder .engine .model .DialogOption ;
33
29
import com .bladecoder .engine .model .World ;
34
30
import com .bladecoder .engine .util .DPIUtils ;
@@ -146,19 +142,12 @@ private int getOption(float x, float y) {
146
142
}
147
143
148
144
private void select (int i ) {
149
- Dialog d = World .getInstance ().getCurrentDialog ();
150
-
151
145
// RECORD
152
146
if (recorder .isRecording ()) {
153
147
recorder .add (i );
154
148
}
155
149
156
- d .selectOption (i );
157
-
158
- // if (World.getInstance().getCurrentDialog().ended()) {
159
- // selected = -1;
160
- // setVisible(false);
161
- // }
150
+ World .getInstance ().selectDialogOption (i );
162
151
}
163
152
164
153
/** The style for the DialogUI */
Original file line number Diff line number Diff line change @@ -75,13 +75,8 @@ public void update(float delta) {
75
75
// while (playing && v.time < time) {
76
76
if (playing && v .time < time ) {
77
77
if (v .verb == null ) {
78
- if (v .pos == null ) { // DIALOG OPTION
79
- Dialog d = World .getInstance ().getCurrentDialog ();
80
- d .selectOption (v .dialogOption );
81
-
82
- if (World .getInstance ().getCurrentDialog ().ended ()) {
83
- World .getInstance ().setCurrentDialog (null );
84
- }
78
+ if (v .pos == null ) { // DIALOG OPTION
79
+ World .getInstance ().selectDialogOption (v .dialogOption );
85
80
86
81
stringBuilder .append (" SELECT DIALOG OPTION: " ).append (v .dialogOption );
87
82
} else { // GOTO
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ public void update(float d) {
198
198
if (visibleOptions .size () > 0 ) {
199
199
int pos = MathUtils .random (visibleOptions .size () - 1 );
200
200
EngineLogger .debug ("<TESTERBOT> SELECT OPTION: " + pos );
201
- w .getCurrentDialog (). selectOption (pos );
201
+ w .selectDialogOption (pos );
202
202
}
203
203
}
204
204
}
You can’t perform that action at this time.
0 commit comments