This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
index.ejs
166 lines (141 loc) · 6.42 KB
/
index.ejs
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<html>
<head>
<title>Taro</title>
<meta name="description" content="A multiplayer HTML5 game engine">
<meta name="keywords" content="modd.io, taro, multiplayer">
<!-- OpenGraph Metadata -->
<meta property="og:title" content="Taro">
<meta property="og:description" content="A multiplayer HTML5 game engine">
<!-- Icon -->
<link rel="icon" href="/assets/images/favicon.png" size="64">
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.9.2/jquery.contextMenu.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
<link rel="stylesheet" href="/assets/css/custom.css">
<link rel="stylesheet" href="/assets/css/common.css">
<!-- jQuery -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.contextMenu.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.ui.position.min.js"></script>
<!-- Bootstrap -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<!-- LZ-String -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/libs/lz-string.min.js"></script>
<!-- Lodash -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<!-- Sweet Alert -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.4.0/sweetalert2.min.js"></script>
<!-- Pixi.JS -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/pixi-legacy.min.js"></script>
<!-- Game Variables -->
<script>
var mode = 'play';
var gameId = '<%= gameId %>';
var userId = '';
var isLoggedIn = false;
window.joinGameSent = {};
//
var playGameBtn;
var connectPlayer = new Event('connectPlayer');
//
// Trying to accomodate the format of production so we don't have the problem with
// duplicate callbacks in MenuUiComponent.js
//
window.onload = (event) => {
playGameBtn = document.querySelector('#play-game-button');
playGameBtn.addEventListener('click', () => {
playGameBtn.dispatchEvent(connectPlayer);
});
};
//
//
function loadJS(file) {
// DOM: Create the script element
var jsElm = document.createElement('script');
// set the type attribute
jsElm.type = 'application/javascript';
// make the script element load file
jsElm.src = file;
// finally insert the element to the body element in order to load the script
document.body.appendChild(jsElm);
}
</script>
</head>
<body>
<div id="game-div" style="overflow: hidden">
<%- include('templates/dev-console'); -%>
<%- include('templates/menu'); -%>
<%- include('templates/shop'); -%>
<%- include('templates/gui'); -%>
<%- include('templates/chat'); -%>
<%- include('templates/inventory'); -%>
<%- include('templates/dialogue'); -%>
<%- include('templates/trade'); -%>
</div>
<%- include('templates/videochat.ejs'); -%>
<div class="modal fade" tabindex="-1" id="server-disconnect-modal" role="dialog" style=" top: 15%">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header d-flex hide-on-mobile">
<h5 class="modal-title">Connection Lost</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Lost connection to the game server. Please refresh this page or visit our homepage.
</div>
</div>
</div>
<!-- load engine -->
<script type="text/javascript">
var igeRoot = './engine/';
window.isStandalone = true;
gameStarted = false;
</script>
<script>
(function ($) {
$.fn.writeText = function (content, duration, callback) {
content = content || '';
var contentArray = content.split(''),
current = 0,
elem = this;
if (isNaN(duration)) {
duration = 20;
}
if (duration <= 0) {
elem.html(content);
callback();
return;
}
var handle = setInterval(function () {
if (current < contentArray.length) {
var text = elem.html();
var newText = contentArray[current];
if (newText === '<' && /\w/.test(contentArray[current + 1])) {
do {
current++;
var nextChar = contentArray[current];
newText += nextChar;
} while (nextChar !== '>');
}
elem.html(text + newText);
current++;
} else {
clearInterval(handle);
callback();
}
}, duration);
return handle;
};
})(jQuery);
</script>
<!-- below loads all uncompiled game files (your source code changes will reflect) -->
<script type="text/javascript" src="/engine/loader.js"></script>
<!-- below loads the compiled game file (much faster, your source code changes won't reflect until you compile again)-->
<!-- <script type="text/javascript" src="./src/game.js"></script> -->
</body>
</html>