-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepo.js
88 lines (86 loc) · 2.73 KB
/
repo.js
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
'use strict';
function repo_init(){
core_repo_init({
'events': {
'level-load-file': {
'onclick': function(){
const element = document.getElementById('level-file');
if(element.files.length === 0){
return;
}
core_menu_lock = false;
core_file({
'file': element.files[0],
'todo': function(event){
if(webgl_level_load({
'character': -1,
'json': JSON.parse(event.target.result),
})){
document.title = (webgl_properties['title'] || element.files[0].name) + ' - ' + core_repo_title;
}else{
element.value = null;
}
},
'type': 'readAsText',
});
},
},
'level-load-textarea': {
'onclick': function(){
core_menu_lock = false;
const level_json = JSON.parse(document.getElementById('level-textarea').value);
webgl_level_load({
'character': -1,
'json': level_json,
});
document.title = level_json['title']
? level_json['title'] + ' - ' + core_repo_title
: core_repo_title;
},
},
'screenshot': {
'onclick': webgl_screenshot,
},
},
'info': '<button id=screenshot type=button>Screenshot</button>',
'keybinds': {
'Backquote': {
'todo': function(){
webgl_characters[webgl_character_id]['automove'] = !webgl_characters[webgl_character_id]['automove'];
},
},
},
'menu-lock': true,
'mousebinds': {
'contextmenu': {
'preventDefault': true,
},
'mousemove': {
'todo': function(event){
webgl_controls_mouse(webgl_character_id);
},
},
'mouseup': {
'todo': webgl_pick_entity,
},
'wheel': {
'todo': function(event){
webgl_controls_wheel(
webgl_character_id,
event.deltaY
);
},
},
},
'tabs': {
'load': {
'content': '<input id=level-file type=file><button id=level-load-file type=button>Load Level from File</button><br>'
+ '<button id=level-load-textarea type=button>Load Level from Textarea</button><br><textarea id=level-textarea>{}</textarea>',
'default': true,
'group': 'core-menu',
'label': 'Load Levels',
},
},
'title': 'MultiverseViewer.htm',
});
}