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) {
|
||||
|
||||
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")
|
||||
|
||||
// Level Infobox
|
||||
|
||||
Binary file not shown.
@ -32,7 +32,7 @@
|
||||
<div id="wrapper">
|
||||
<div id="inner_wrapper">
|
||||
<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 class="ad ad_720x90">
|
||||
<div id="adslot1"></div>
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
"splashScreen": false,
|
||||
"menu": false,
|
||||
"polyfills": false,
|
||||
// "logLevel": "debug",
|
||||
};</script>
|
||||
<script src="{% static 'bloonsa_game/misc/ruffle/ruffle.js' %}"></script>
|
||||
<script src="{% static 'bloonsa_game/js/flash_handler.js' %}"></script>
|
||||
@ -31,7 +32,7 @@
|
||||
const container = document.getElementById("bloonsa-game");
|
||||
container.appendChild(player);
|
||||
player.load({
|
||||
url: "{% static 'bloonsa_game/misc/bloons_unlimited.swf' %}",
|
||||
url: "{% static 'bloonsa_game/misc/bloons_unlimited.swf' %}?{{ flashVars |safe }}",
|
||||
allowScriptAccess: true,
|
||||
backgroundColor: "#000",
|
||||
});
|
||||
|
||||
@ -26,17 +26,15 @@ class GameView(TemplateView):
|
||||
total_levels = Level.objects.count()
|
||||
|
||||
if type(kwargs.get("pk")) is int:
|
||||
level = Level.objects.get(id=kwargs["pk"])
|
||||
level = Level.objects.get(level_id=kwargs["pk"])
|
||||
if level:
|
||||
bloonsa_util.log(player=player,
|
||||
action=actions.bloonsa_load_level_by_url,
|
||||
note=level)
|
||||
return render(request, "bloonsa_game/level.html", context={
|
||||
return render(request, "bloonsa_game/game.html", context={
|
||||
"player": player,
|
||||
"total_levels": total_levels,
|
||||
"flashVars": level.get_flash_vars(seperator="&"),
|
||||
"levelTitle": level.title,
|
||||
"levelAuthor": level.author,
|
||||
"flashVars": level.get_flash_vars(seperator="&"),
|
||||
})
|
||||
return render(request, "bloonsa_game/game.html",
|
||||
context={"player": player,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user