|
| 1 | +var _invervalId; |
| 2 | +var _isLive = false; |
| 3 | +var _blips = []; |
| 4 | +var _blipCount = 0; |
| 5 | +var _showBlips = true; |
| 6 | +var _isConnected = false; |
| 7 | +var _trackPlayer = null; |
| 8 | + |
1 | 9 | function globalInit() {
|
2 | 10 | mapInit("map-canvas");
|
3 |
| - initPage() |
| 11 | + initPage(); |
| 12 | + initBlips(); |
4 | 13 | }
|
5 | 14 |
|
6 | 15 | function initPage() {
|
7 | 16 | $(window).on("load resize", function() {
|
8 | 17 | $(".map-tab-content").height((($("#tab-content").height() - $(".page-title-1").height()) - ($("#map-overlay-global-controls").height() * 4.2)))
|
9 |
| - }) |
| 18 | + }); |
| 19 | +} |
| 20 | + |
| 21 | +function createBlip(blip){ |
| 22 | + var obj = new MarkerObject(blip.name, new Coordinates(blip.x, blip.y, blip.z), MarkerTypes[blip.type], blip.description, "", ""); |
| 23 | + |
| 24 | + _blips[_blipCount++] = blip; |
| 25 | + |
| 26 | + createMarker(false, false, obj, ""); |
| 27 | +} |
| 28 | + |
| 29 | +function blipSuccess(data, textStatus){ |
| 30 | + if (data.error){ |
| 31 | + //Do something about the error i guess. |
| 32 | + console.error("Error: " + data.error); |
| 33 | + return; |
| 34 | + } |
| 35 | + |
| 36 | + for (var spriteId in data) { |
| 37 | + if (data.hasOwnProperty(spriteId)) { |
| 38 | + // data[spriteId] == array of blips for that type |
| 39 | + var blipArray = data[spriteId]; |
| 40 | + |
| 41 | + for (var i in blipArray) { |
| 42 | + var blip = blipArray[i]; |
| 43 | + blip.name = (blip.hasOwnProperty("name") || blip.name != undefined) ? blip.name : MarkerTypes[spriteId].name; |
| 44 | + blip.description = (blip.hasOwnProperty("description") || blip.description != undefined) ? blip.description : ""; |
| 45 | + |
| 46 | + blip.type = spriteId; |
| 47 | + |
| 48 | + createBlip(blip); |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + console.log(_blipCount + " blips created"); |
| 54 | + $("#blip_count").text(_blipCount); |
| 55 | + |
| 56 | +} |
| 57 | + |
| 58 | +function blipError( textStatus, errorThrown){ |
| 59 | + console.error("Error \"" + textStatus + "\": " + errorThrown); |
| 60 | +} |
| 61 | + |
| 62 | +function initBlips(){ |
| 63 | + _blipCount = 0; |
| 64 | + _blips = []; |
| 65 | + |
| 66 | + console.log("Sending ajax request to " + _SETTINGS_blipUrl); |
| 67 | + $.ajax(_SETTINGS_blipUrl, { |
| 68 | + error: blipError, |
| 69 | + dataType: "json", |
| 70 | + success: blipSuccess |
| 71 | + }); |
10 | 72 | }
|
11 | 73 |
|
12 | 74 | function initMarkers(debugOnly) {
|
13 | 75 | if (debugOnly) {
|
14 |
| - createMarker(false, true, new MarkerObject("@DEBUG@@Locator", new Coordinates(0, 500, 0), MarkerTypes[999], "", ""), "") |
| 76 | + createMarker(false, true, new MarkerObject("@DEBUG@@Locator", new Coordinates(0, 500, 0), MarkerTypes[999], "", ""), ""); |
15 | 77 | console.log("MarkerType: " + MarkerTypes[999]);
|
16 | 78 | } else {
|
17 | 79 | createMarker(false, false, new MarkerObject("True Map Center", new Coordinates(0, 0, 0), MarkerTypes[6], "", ""), "");
|
|
0 commit comments