Made level loading via URL work
This commit is contained in:
parent
3d0f4e4353
commit
15e046fab4
@ -48,6 +48,12 @@ function set_stars(rating) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bloonsa_update_html(r) {
|
function bloonsa_update_html(r) {
|
||||||
|
|
||||||
|
var url_path = `/a/game/${r.level_id}`
|
||||||
|
if (window.location.pathname != url_path) {
|
||||||
|
window.history.pushState({}, r.level_title, url_path);
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("level-info-box").classList.remove("invisible")
|
document.getElementById("level-info-box").classList.remove("invisible")
|
||||||
|
|
||||||
// Level Infobox
|
// Level Infobox
|
||||||
|
|||||||
Binary file not shown.
@ -32,7 +32,7 @@
|
|||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<div id="inner_wrapper">
|
<div id="inner_wrapper">
|
||||||
<div id="alpha"></div>
|
<div id="alpha"></div>
|
||||||
<!--<a href="{% url 'bloonsa_game:index' %}" id="header"></a>-->
|
<a href="{% url 'bloonsa_game:index' %}" id="header"></a>
|
||||||
<div id="horizontal_header">
|
<div id="horizontal_header">
|
||||||
<div class="ad ad_720x90">
|
<div class="ad ad_720x90">
|
||||||
<div id="adslot1"></div>
|
<div id="adslot1"></div>
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
"splashScreen": false,
|
"splashScreen": false,
|
||||||
"menu": false,
|
"menu": false,
|
||||||
"polyfills": false,
|
"polyfills": false,
|
||||||
|
// "logLevel": "debug",
|
||||||
};</script>
|
};</script>
|
||||||
<script src="{% static 'bloonsa_game/misc/ruffle/ruffle.js' %}"></script>
|
<script src="{% static 'bloonsa_game/misc/ruffle/ruffle.js' %}"></script>
|
||||||
<script src="{% static 'bloonsa_game/js/flash_handler.js' %}"></script>
|
<script src="{% static 'bloonsa_game/js/flash_handler.js' %}"></script>
|
||||||
@ -31,7 +32,7 @@
|
|||||||
const container = document.getElementById("bloonsa-game");
|
const container = document.getElementById("bloonsa-game");
|
||||||
container.appendChild(player);
|
container.appendChild(player);
|
||||||
player.load({
|
player.load({
|
||||||
url: "{% static 'bloonsa_game/misc/bloons_unlimited.swf' %}",
|
url: "{% static 'bloonsa_game/misc/bloons_unlimited.swf' %}?{{ flashVars |safe }}",
|
||||||
allowScriptAccess: true,
|
allowScriptAccess: true,
|
||||||
backgroundColor: "#000",
|
backgroundColor: "#000",
|
||||||
});
|
});
|
||||||
|
|||||||
@ -26,17 +26,15 @@ class GameView(TemplateView):
|
|||||||
total_levels = Level.objects.count()
|
total_levels = Level.objects.count()
|
||||||
|
|
||||||
if type(kwargs.get("pk")) is int:
|
if type(kwargs.get("pk")) is int:
|
||||||
level = Level.objects.get(id=kwargs["pk"])
|
level = Level.objects.get(level_id=kwargs["pk"])
|
||||||
if level:
|
if level:
|
||||||
bloonsa_util.log(player=player,
|
bloonsa_util.log(player=player,
|
||||||
action=actions.bloonsa_load_level_by_url,
|
action=actions.bloonsa_load_level_by_url,
|
||||||
note=level)
|
note=level)
|
||||||
return render(request, "bloonsa_game/level.html", context={
|
return render(request, "bloonsa_game/game.html", context={
|
||||||
"player": player,
|
"player": player,
|
||||||
"total_levels": total_levels,
|
"total_levels": total_levels,
|
||||||
"flashVars": level.get_flash_vars(seperator="&"),
|
"flashVars": level.get_flash_vars(seperator="&"),
|
||||||
"levelTitle": level.title,
|
|
||||||
"levelAuthor": level.author,
|
|
||||||
})
|
})
|
||||||
return render(request, "bloonsa_game/game.html",
|
return render(request, "bloonsa_game/game.html",
|
||||||
context={"player": player,
|
context={"player": player,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user