-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·69 lines (64 loc) · 2.4 KB
/
Copy pathindex.html
File metadata and controls
executable file
·69 lines (64 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | Orbital_2</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script>
var unityInstance = UnityLoader.instantiate("unityContainer", "Build/Orbital_web3.json", {onProgress: UnityProgress});
</script>
</head>
<body>
<div class="webgl-content">
<div id="unityContainer" style="width: 960px; height: 600px"></div>
<div class="footer">
<div class="webgl-logo"></div>
<div class="fullscreen" onclick="unityInstance.SetFullscreen(1)"></div>
<div class="title">Orbital_2</div>
</div>
</div>
<div style="border:solid 1px black; width:200px; height:80px; margin:auto; text-align:center" onclick="handlePlay()">RunCode</div>
<div class="blockly-editor" style="display:inline-block">
<div id="blocklyDiv" style="height: 480px; width: 400px;"></div>
<xml id="toolbox" style="display: none">
<block type="controls_repeat_ext">
<value name="TIMES">
<shadow type="math_number">
<field name="NUM">5</field>
</shadow>
</value>
</block>
<block type="Up"></block>
<block type="Down"></block>
<block type="Left"></block>
<block type="Right"></block>
</xml>
</div>
<script src="https://unpkg.com/blockly"></script>
<script src="Blockly/Block_queue.js"></script>
<script src="Blockly/Blocks.js"></script>
<script>
// Inject the workspace into the id 'blockDiv' and get toolbox from id 'toolbox'
var workspace=Blockly.inject('blocklyDiv', {
toolbox: document.getElementById('toolbox'),
scrollbars: false,
})
function handlePlay() {
// generate js code from workspace
Blockly.JavaScript.addReservedWords('code');
let code = Blockly.JavaScript.workspaceToCode((Blockly.getMainWorkspace()));
code+='Block_queue.runcode();';
try {
// run code in console
eval(code);
} catch (error) {
console.log(error);
}
}
</script>
</body>
</html>