Пример #1
0
 public TextScreen(final TextScreenSequence sequence, final Pantext text) {
   this.sequence = sequence;
   this.text = text;
   if (text.getLinesPerPage() <= 0) {
     // scrollPage is a no-op with 0 signs per page, breaks any-key advancing through text
     text.setLinesPerPage(1);
   }
   // Can't add to room in constructor, Panscreen.set will clear it; must do in init
   // Pangame.getGame().getCurrentRoom().addActor(text);
 }
Пример #2
0
 protected final void cancel() {
   if (sequence == null) {
     finish(text);
     return;
   }
   // If we open a new Panscreen, this will be automatic, but do it in case finish does something
   // else
   // Like TempScreen.finish
   text.unregisterListeners();
   sequence.cancel();
   text.destroy();
 }
Пример #3
0
 @Override
 protected final void init() throws Exception {
   Pangame.getGame().getCurrentRoom().addActor(text);
   final ActionStartListener anyKey;
   final Panput esc = Pangine.getEngine().getInteraction().KEY_ESCAPE;
   anyKey =
       new ActionStartListener() {
         @Override
         public final void onActionStart(final ActionStartEvent event) {
           if (esc.equals(event.getInput())) {
             cancel();
             return;
           }
           if (!text.scrollPage()) {
             finish(text);
           }
         }
       };
   text.register(anyKey);
 }