チェンジセット 78
- コミット日時:
- 2007/09/15 18:24:49 (6 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
kuy/as2/sample/KeyIf/Main.as
r77 r78 1 1 import net.endflow.util.KeyIf; 2 import net.endflow.util.Delay; 2 3 3 4 var ship:Ship = new Ship(_root); … … 8 9 LEFT: function(){ship.left()}, 9 10 RIGHT: function(){ship.right()}, 10 SPACE: {CONTROL: function(){ship.shot()}},11 SPACE: {CONTROL: {_90: function(){ship.shot()}}}, 11 12 PGUP: [function(){ship.up()}, function(){ship.shot()}], 12 13 PGDN: [function(){ship.down()}, function(){ship.shot()}], 13 HOME: function(){ship.reset()} 14 HOME: {_82: function(){ship.reset()}}, 15 _88: function(){ 16 ship.shot(); 17 Delay.f(function(){ 18 ship.shot(); 19 Delay.f(function(){ 20 ship.shot(); 21 }, 200); 22 }, 200); 23 } 14 24 }); kuy/as2/src/net/endflow/util/KeyIf.as
r77 r78 26 26 * [0.1.0] 2007-05-27: 改良。Snippets Projectに公開。 27 27 * [0.1.1] 2007-09-14: ちょっとリファクタリング&コメント追加。 28 * [0.2.0] 2007-09-15: Keyクラスで定義されていないキーもキーコードで指定可能にした。 28 29 */ 29 30 class net.endflow.util.KeyIf { … … 39 40 * Key.addListener(this); 40 41 * this.onKeyDown = KeyIf.f({ 42 * HOME: function(){trace('HOME')}, 41 43 * UP: {PGUP: function(){trace('UP/PGUP')}}, 42 44 * DOWN: {PGDN: function(){trace('DOWN/PGDN')}}, … … 44 46 * RIGHT: [function(){trace('RIGHT#1')}, function(){trace('RIGHT#2')}, function(){trace('RIGHT#3')}] 45 47 * SPACE: {CONTROL: function(){trace('SPACE/CTRL')}}, 46 * HOME: function(){trace('HOME')}48 * _90: function(){trace('Z')} 47 49 * }); 48 50 * </code> … … 77 79 return function() { 78 80 for(var k in info) { 79 if(Key[k] === Key.getCode()) { 81 if((k.charAt(0) == "_" && parseInt(k.substr(1)) == Key.getCode()) 82 || (Key[k] == Key.getCode())) { 80 83 info[k](); 81 84 }

