※このページは書きかけです。


解説/中級編

シナリオ操作

new Theater({
  img: [
    "img/sample1.gif"
  ],
  scenario: [
    function(){
      this.act({
        img: "img/sample1.gif",
        msg: "シナリオ操作テスト開始。"
      });
    },
    function(){
      this.speak("サブシナリオ開始前。pushメソッドでサブシナリオを設定します・・・");
    },
    function(){
      this.push(sub);
      this.keep();
    },
    function(){
      this.speak("メインシナリオに復帰しました。");
    },
    
    function(){
      this.speak("シナリオ操作テスト終了。");
    }
  ]
});

var sub = [
  function(){
    this.speak("サブシナリオ開始。");
  },
  function(){
    this.speak("操作を選択してください。");
  },
  function(){
    this.choice(["retake", "skip", "repeat", "back", "reset"]);
  },
  function(result){
    var str = result + "が選択されました。"
    switch(result){
      case "retake":
        str += "このサブシナリオの先頭に戻ります・・・";
        this.retake();
        break;
      case "skip":
        str += "メインシナリオに復帰します・・・";
        this.skip();
        break;
      case "repeat":
        str += "このシナリオ関数を繰り返します・・・※「はじめから」ボタンで戻ってください。";
        this.repeat();
        break;
      case "back":
        str += "一つ前のシナリオ関数に戻ります・・・";
        this.back();
        break;
      case "reset":
        str += "メインシナリオの先頭に戻ります・・・";
        this.reset();
        break;
    }
    this.speak(str);
    return result;
  },
  function(result){
    this.speak("サブシナリオ終了。");
  }
];

サブシナリオの選択ダウンロードと実行

画像の選択ダウンロード

※このページは書きかけです。


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS