カスタムコマンド WaitableGotoコマンド

Progression に Goto コマンドというものがあり、指定したシーンまで遷移してくれる便利な機能があります。これを SerialList に登録する際に一個だけであれば問題ないのですが、二個三個と連続して登録すると、同時にシーン移動の制御が始まってしまいエラーが起きてしまいます。

そこでカスタムコマンドを作ってみました。

Gotoコマンドを連続して指定した場合

すべての画面遷移が同時に起こってしまい、ちょっと見苦しい感じになっています。

アクションスクリプト

// 通常の Goto コマンドを使った場合
import jp.progression.commands.*;
import jp.progression.scenes.*;

var com:SerialList = new SerialList();

com.addCommand(
     new Goto(new SceneId("/index/photo1")),
     new Goto(new SceneId("/index/photo2")),
     new Goto(new SceneId("/index/photo3")),
     new Goto(new SceneId("/index/photo4"))
)

com.execute();

WaitableGotoコマンドを連続して指定した場合

そこで、画面遷移の完了を待ってから次の画面遷移を行うコマンドを作ってみました。名前は「WaitableGoto」コマンド。

こちらは画面遷移が完了してから、次の画面に遷移するようになっています。

アクションスクリプト

import jp.progression.commands.*;
import jp.progression.scenes.*;
import jp.progression.*;
import jp.clockmaker.commands.*;

var prog:Progression = getProgressionById("index");

var com:SerialList = new SerialList();

com.addCommand(
  new WaitableGoto(new SceneId("/index/photo1"), prog),
  new WaitableGoto(new SceneId("/index/photo2"), prog),
  new WaitableGoto(new SceneId("/index/photo3"), prog),
  new WaitableGoto(new SceneId("/index/photo4"), prog)
)

com.execute();

ダウンロードはこちら

投稿者 : 池田 泰延

BookMark

ブックマークはこちらからどうぞ。

このエントリーをはてなブックマークに追加

Comment/Trackback 3件