Repository navigation
Expand file tree
/
Copy pathts2.xml
More file actions
268 lines (240 loc) · 8.02 KB
/
Copy pathts2.xml
File metadata and controls
268 lines (240 loc) · 8.02 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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<Module>
<ModulePrefs title="" />
<Content type="html"><![CDATA[
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<title>Time Shooter 2</title>
<link rel="shortcut icon" href="https://abc6782.github.io/games/time-shooter-2/favicon.ico">
<link rel="stylesheet" href="https://abc6782.github.io/games/time-shooter-2/style.css">
</head>
<body class="dark">
<div id="unity-container" class="unity-desktop">
<canvas id="unity-canvas"></canvas>
</div>
<div id="loading-cover" style="display:none;">
<div id="unity-loading-bar">
<div id="unity-logo"><img src="https://abc6782.github.io/games/time-shooter-2/logo.png"></div>
<div id="unity-progress-bar-empty" style="display: none;">
<div id="unity-progress-bar-full"></div>
</div>
<div class="spinner"></div>
</div>
</div>
<div id="unity-fullscreen-button" style="display: none;"></div>
<script>
const hideFullScreenButton = "1";
const buildUrl = "Build";
const loaderUrl ="https://abc6782.github.io/games/time-shooter-2/TimeShooter2_Yandex.loader.js";
const config = {
dataUrl:"https://abc6782.github.io/games/time-shooter-2/TimeShooter2_Yandex.data.unityweb",
frameworkUrl:"https://abc6782.github.io/games/time-shooter-2/TimeShooter2_Yandex.framework.js.unityweb",
codeUrl:"https://abc6782.github.io/games/time-shooter-2/TimeShooter2_Yandex.wasm.unityweb",
streamingAssetsUrl: "https://abc6782.github.io/games/time-shooter-2/StreamingAssets",
companyName: "GoGoMan",
productName: "Time Shooter 2",
productVersion: "0.1",
};
const container = document.querySelector("#unity-container");
const canvas = document.querySelector("#unity-canvas");
const loadingCover = document.querySelector("#loading-cover");
const progressBarEmpty = document.querySelector("#unity-progress-bar-empty");
const progressBarFull = document.querySelector("#unity-progress-bar-full");
const fullscreenButton = document.querySelector("#unity-fullscreen-button");
const spinner = document.querySelector('.spinner');
const canFullscreen = (function() {
for (const key of [
'exitFullscreen',
'webkitExitFullscreen',
'webkitCancelFullScreen',
'mozCancelFullScreen',
'msExitFullscreen',
]) {
if (key in document) {
return true;
}
}
return false;
}());
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
container.className = "unity-mobile";
config.devicePixelRatio = 1;
}
canvas.style.background = "url('TimeShooter2_Yandex.jpg') center / cover";
loadingCover.style.display = "";
const script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
spinner.style.display = "none";
progressBarEmpty.style.display = "";
progressBarFull.style.width = `${100 * progress}%`;
}).then((unityInstance) => {
window.unityInstance = unityInstance;
loadData();
loadingCover.style.display = "none";
if (canFullscreen) {
if (!hideFullScreenButton) {
fullscreenButton.style.display = "";
}
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1);
};
}
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script);
</script>
<script src="v2.js"></script>
<script type="text/javascript">
var player = null;
var sdk;
var payments = null;
YaGames.init({
adv: {
onAdvClose: wasShown => {
console.info('adv closed!');
}
}
})
.then(ysdk => {
sdk = ysdk;
ysdk.getPlayer({ signed: true }).then(_player => {
player = _player;
}).catch(err => {
});
sdk.adv.showFullscreenAdv({ callbacks: {} });
});
function checkCom()
{
var isCom = 0;
var output;
if (sdk != null) {
var output = sdk.environment.i18n.tld;
if(output == "com")
isCom = 1;
}
console.log(output);
console.log(isCom);
window.unityInstance.SendMessage('GameManager', 'IsCom', isCom);
}
function checkLanguage()
{
var currentLanguage = 1;
var output;
if (sdk != null) {
var output = sdk.environment.i18n.lang;
if(output == "ru" || output == "be" || output == "kk" || output == "uk" || output == "uz")
currentLanguage = 0;
else if(output == "tr")
currentLanguage = 2;
else
currentLanguage = 1;
}
console.log(output);
console.log(currentLanguage);
window.unityInstance.SendMessage('GameManager', 'SetLanguage', currentLanguage);
}
function loadData() {
checkCom();
if (player != null) {
player.getData(["levels", "sounds", "music", "language", "tutor", "sensitivity"]).then(data => {
if (data.levels) {
var sounds;
var music;
var tutor;
if (data.sounds) {
sounds = 1;
}
else {
sounds = 0;
}
if (data.music) {
music = 1;
}
else {
music = 0;
}
if (data.tutor) {
tutor = 1;
}
else {
tutor = 0;
}
var dataStr = data.levels + ' ' + sounds + ' ' + music + ' ' + data.language + ' ' + tutor + ' ' + data.sensitivity;
console.log('Get Data ', dataStr);
window.unityInstance.SendMessage('GameManager', 'LoadData', dataStr);
}
}).catch(() => {
console.log('No Data');
});
}
}
</script>
<script>
function saveData(level, isSound, isMusic, language, tutor, sensitivity) {
console.log('Saving....');
if (player != null) {
player.getData(["levels", "sounds", "music", "language", "tutor", "sensitivity"]).then(data => {
if (data.levels) {
if (data.levels <= level) {
player.setData({
levels: level,
sounds: isSound,
music: isMusic,
language: language,
tutor: tutor,
sensitivity: sensitivity
}).then(() => {
console.log('data is set -update');
});
}
}
else {
player.setData({
levels: level,
sounds: isSound,
music: isMusic,
language: language,
tutor: tutor,
sensitivity: sensitivity
}).then(() => {
console.log('data is set -first');
});
}
}).catch(() => {
player.setData({
levels: level,
sounds: isSound,
music: isMusic,
language: language,
tutor: tutor,
sensitivity: sensitivity
}).then(() => {
console.log('data is set -first');
});
});
}
}
</script>
<script>
function showFullscrenAd() {
}
</script>
<script>
function rate() {
}
</script>
<script>
function showRewardedAd(id) {
}
</script>
</body>
</html>
]]></Content>
</Module>