|
@@ -107,9 +107,8 @@
|
|
|
</template>
|
|
|
<style>
|
|
|
.as {
|
|
|
- animation: myfirst 1s;
|
|
|
- -webkit-animation: myfirst 1s; /* Safari and Chrome */
|
|
|
-}
|
|
|
+ animation: myfirst 1s linear infinite;
|
|
|
+ }
|
|
|
|
|
|
.asn {
|
|
|
transform: rotate(0deg);
|
|
@@ -134,8 +133,7 @@
|
|
|
}
|
|
|
|
|
|
.ass {
|
|
|
- animation: myfirst 3s;
|
|
|
- -webkit-animation: myfirst 3s; /* Safari and Chrome */
|
|
|
+ animation: myfirst 3s linear infinite;
|
|
|
}
|
|
|
</style>
|
|
|
<script>
|
|
@@ -313,7 +311,8 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.hand = 1;
|
|
|
- this.zhuan();
|
|
|
+ // this.zhuan();
|
|
|
+ this.$refs.fan.className = "as";
|
|
|
} else if (_58y < 1 && _912y < 1 && _1316y < 1 && _1720y < 1) {
|
|
|
console.log("石头");
|
|
|
if (this.hand == 2) {
|
|
@@ -328,7 +327,8 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.hand = 3;
|
|
|
- this.zhuann();
|
|
|
+ this.$refs.fan.className = "ass";
|
|
|
+ // this.zhuann();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -583,60 +583,109 @@ export default {
|
|
|
return _code;
|
|
|
};
|
|
|
|
|
|
- Blockly.Blocks["iot_lcd_trunLeftinit"] = {
|
|
|
+ Blockly.Blocks["logic_loop"] = {
|
|
|
init: function () {
|
|
|
- this.appendDummyInput().appendField("向左移动");
|
|
|
- this.setInputsInline(false);
|
|
|
- this.setPreviousStatement(true);
|
|
|
- this.setNextStatement(true);
|
|
|
- this.setColour("#1b5873");
|
|
|
+ this.appendStatementInput("NAME")
|
|
|
+ .setCheck(null)
|
|
|
+ .appendField("重复执行");
|
|
|
+ this.setPreviousStatement(true, null);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setColour("#5b80a5");
|
|
|
this.setTooltip("");
|
|
|
this.setHelpUrl("");
|
|
|
},
|
|
|
};
|
|
|
+ Blockly.JavaScript["logic_loop"] = function (block) {
|
|
|
+ var statements_name = Blockly.JavaScript.statementToCode(block, "NAME");
|
|
|
+ // TODO: Assemble JavaScript into code variable.
|
|
|
+ var code = "for;\n";
|
|
|
+ return code;
|
|
|
+ };
|
|
|
|
|
|
- Blockly.JavaScript.iot_lcd_trunLeftinit = function (block) {
|
|
|
- var _code = "trunLeft=1;";
|
|
|
- return _code;
|
|
|
+ Blockly.Blocks.controls_repeat_forever = {
|
|
|
+ init: function () {
|
|
|
+ this.jsonInit({
|
|
|
+ message0: Blockly.Msg.CONTROLS_REPEAT_FOREVER,
|
|
|
+ previousStatement: null,
|
|
|
+ nextStatement: null,
|
|
|
+ colour: "#5ba55b",
|
|
|
+ tooltip: Blockly.Msg.CONTROLS_REPEAT_FOREVER_TOOLTIP,
|
|
|
+ helpUrl: Blockly.Msg.CONTROLS_REPEAT_HELPURL,
|
|
|
+ });
|
|
|
+ this.appendStatementInput("DO").appendField(
|
|
|
+ Blockly.Msg.CONTROLS_REPEAT_INPUT_DO
|
|
|
+ );
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
- Blockly.Blocks["iot_lcd_trunRightinit"] = {
|
|
|
+ Blockly.JavaScript.controls_repeat_forever = function (a) {
|
|
|
+ var d = Blockly.JavaScript.statementToCode(a, "DO");
|
|
|
+ d = Blockly.JavaScript.addLoopTrap(d, a);
|
|
|
+ return "while (true) {\n" + d + "}\n";
|
|
|
+ };
|
|
|
+
|
|
|
+ Blockly.Blocks["logic_number"] = {
|
|
|
init: function () {
|
|
|
- this.appendDummyInput().appendField("向右移动");
|
|
|
- this.setInputsInline(false);
|
|
|
- this.setPreviousStatement(true);
|
|
|
- this.setNextStatement(true);
|
|
|
- this.setColour("#1b5873");
|
|
|
+ this.appendDummyInput().appendField(
|
|
|
+ new Blockly.FieldTextInput("0"),
|
|
|
+ "number"
|
|
|
+ );
|
|
|
+ this.setInputsInline(true);
|
|
|
+ this.setOutput(true, "Number");
|
|
|
+ this.setColour("#5b80a5");
|
|
|
this.setTooltip("");
|
|
|
this.setHelpUrl("");
|
|
|
},
|
|
|
};
|
|
|
-
|
|
|
- Blockly.JavaScript.iot_lcd_trunRightinit = function (block) {
|
|
|
- var _code = "trunRight=1;";
|
|
|
- return _code;
|
|
|
+ Blockly.JavaScript["logic_number"] = function (block) {
|
|
|
+ var text_number = block.getFieldValue("number");
|
|
|
+ // TODO: Assemble JavaScript into code variable.
|
|
|
+ var code = text_number;
|
|
|
+ // TODO: Change ORDER_NONE to the correct strength.
|
|
|
+ return [code, Blockly.JavaScript.ORDER_NONE];
|
|
|
+ };
|
|
|
+ Blockly.Blocks["ai_gesture"] = {
|
|
|
+ init: function () {
|
|
|
+ this.appendDummyInput()
|
|
|
+ .appendField("AI手势识别")
|
|
|
+ .appendField(new Blockly.FieldDropdown([["ID", "ID"]]), "ID");
|
|
|
+ this.setInputsInline(true);
|
|
|
+ this.setOutput(true, null);
|
|
|
+ this.setColour(285);
|
|
|
+ this.setTooltip("");
|
|
|
+ this.setHelpUrl("");
|
|
|
+ },
|
|
|
+ };
|
|
|
+ Blockly.JavaScript["ai_gesture"] = function (block) {
|
|
|
+ var dropdown_id = block.getFieldValue("ID");
|
|
|
+ // TODO: Assemble JavaScript into code variable.
|
|
|
+ var code = "hands";
|
|
|
+ // TODO: Change ORDER_NONE to the correct strength.
|
|
|
+ return [code, Blockly.JavaScript.ORDER_NONE];
|
|
|
+ };
|
|
|
+ Blockly.Blocks["ai_motor"] = {
|
|
|
+ init: function () {
|
|
|
+ this.appendDummyInput()
|
|
|
+ .appendField("马达")
|
|
|
+ .appendField(new Blockly.FieldDropdown([["M1", "M1"]]), "motor")
|
|
|
+ .appendField("以速度")
|
|
|
+ .appendField(new Blockly.FieldTextInput("0"), "speed")
|
|
|
+ .appendField("转动");
|
|
|
+ this.setPreviousStatement(true, null);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setColour(285);
|
|
|
+ this.setTooltip("");
|
|
|
+ this.setHelpUrl("");
|
|
|
+ },
|
|
|
+ };
|
|
|
+ Blockly.JavaScript["ai_motor"] = function (block) {
|
|
|
+ var dropdown_motor = block.getFieldValue("motor");
|
|
|
+ var text_speed = block.getFieldValue("speed");
|
|
|
+ // TODO: Assemble JavaScript into code variable.
|
|
|
+ var code = "motor=" + text_speed;
|
|
|
+ // TODO: Change ORDER_NONE to the correct strength.
|
|
|
+ return code;
|
|
|
};
|
|
|
- var that = this;
|
|
|
- window.addEventListener("message", function (e) {
|
|
|
- // 监听 message 事件
|
|
|
- if (e.data.success) {
|
|
|
- that.loading = true;
|
|
|
- that.$refs.unityvue.contentWindow.postMessage(
|
|
|
- { type: that.type },
|
|
|
- "*"
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- if (e.data.active) {
|
|
|
- that.active = true;
|
|
|
- } else if (e.data.active != undefined) {
|
|
|
- that.active = false;
|
|
|
- }
|
|
|
-
|
|
|
- if (e.data.noCamera) {
|
|
|
- that.$message.error(e.data.noCamera);
|
|
|
- }
|
|
|
- });
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|