@@ -2735,10 +2735,14 @@ Blockly.Blocks['joystick_off'] = {
27352735} ;
27362736
27372737
2738- Blockly . Blocks [ 'document_onkeydown ' ] = {
2738+ Blockly . Blocks [ 'document_keyboard ' ] = {
27392739 init : function ( ) {
27402740 this . appendDummyInput ( )
2741- . appendField ( Blockly . Msg . WEBDUINO_KEYBOARD , "開始偵測 鍵盤行為" ) ;
2741+ . appendField ( Blockly . Msg . WEBDUINO_KEYBOARD , "開始偵測 鍵盤" )
2742+ . appendField ( new Blockly . FieldDropdown ( [
2743+ [ Blockly . Msg . WEBDUINO_KEYBOARD_KEYDOWN , "onkeydown" ] ,
2744+ [ Blockly . Msg . WEBDUINO_KEYBOARD_KEYUP , "onkeyup" ]
2745+ ] ) , "event_" )
27422746 this . appendStatementInput ( "do_" ) ;
27432747 this . setInputsInline ( false ) ;
27442748 this . setPreviousStatement ( true ) ;
@@ -2749,7 +2753,7 @@ Blockly.Blocks['document_onkeydown'] = {
27492753 }
27502754} ;
27512755
2752- Blockly . Blocks [ 'document_onkeydown_stop ' ] = {
2756+ Blockly . Blocks [ 'document_keyboard_stop ' ] = {
27532757 init : function ( ) {
27542758 this . appendDummyInput ( )
27552759 . appendField ( Blockly . Msg . WEBDUINO_KEYBOARD_STOP , "停止偵測 鍵盤行為" ) ;
@@ -2762,10 +2766,10 @@ Blockly.Blocks['document_onkeydown_stop'] = {
27622766 }
27632767} ;
27642768
2765- Blockly . Blocks [ 'document_alphabet_keycode ' ] = {
2769+ Blockly . Blocks [ 'document_keycode ' ] = {
27662770 init : function ( ) {
27672771 this . appendStatementInput ( "do_" )
2768- . appendField ( Blockly . Msg . WEBDUINO_KEYBOARD_KEYDOWN , "如果按下 " )
2772+ . appendField ( Blockly . Msg . WEBDUINO_KEYBOARD_KEY , "如果是 " )
27692773 . appendField ( new Blockly . FieldDropdown ( [
27702774 [ "A" , "65" ] ,
27712775 [ "B" , "66" ] ,
@@ -2792,23 +2796,7 @@ Blockly.Blocks['document_alphabet_keycode'] = {
27922796 [ "W" , "87" ] ,
27932797 [ "X" , "88" ] ,
27942798 [ "Y" , "89" ] ,
2795- [ "Z" , "90" ]
2796- ] ) , "keycode_" )
2797- . appendField ( Blockly . Msg . WEBDUINO_KEYBOARD_DO , ",執行:" ) ;
2798- this . setInputsInline ( false ) ;
2799- this . setPreviousStatement ( true ) ;
2800- this . setNextStatement ( true ) ;
2801- this . setTooltip ( '' ) ;
2802- this . setColour ( 35 ) ;
2803- this . setHelpUrl ( 'http://www.example.com/' ) ;
2804- }
2805- } ;
2806-
2807- Blockly . Blocks [ 'document_other_keycode' ] = {
2808- init : function ( ) {
2809- this . appendStatementInput ( "do_" )
2810- . appendField ( Blockly . Msg . WEBDUINO_KEYBOARD_KEYDOWN , "如果按下" )
2811- . appendField ( new Blockly . FieldDropdown ( [
2799+ [ "Z" , "90" ] ,
28122800 [ Blockly . Msg . WEBDUINO_KEYBOARD_SPACE , "32" ] ,
28132801 [ "enter" , "13" ] ,
28142802 [ Blockly . Msg . WEBDUINO_KEYBOARD_UP , , "38" ] ,
0 commit comments