mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-07-04 07:45:03 +03:00
Fixed goBack and backported various UI fixes.
This commit is contained in:
parent
8c5cd01b9a
commit
606629d83f
|
@ -11,7 +11,6 @@ salet = Salet({
|
||||||
})
|
})
|
||||||
$(document).ready(() ->
|
$(document).ready(() ->
|
||||||
salet.beginGame()
|
salet.beginGame()
|
||||||
salet.character.bought_lamp = false
|
|
||||||
)
|
)
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -31,6 +30,8 @@ textcycle = (content, ref) ->
|
||||||
# The first room of the game.
|
# The first room of the game.
|
||||||
# For accessibility reasons the text is provided in HTML, not here.
|
# For accessibility reasons the text is provided in HTML, not here.
|
||||||
room "start", salet,
|
room "start", salet,
|
||||||
|
enter: (salet) ->
|
||||||
|
salet.character.bought_lamp = false
|
||||||
dsc: """
|
dsc: """
|
||||||
""",
|
""",
|
||||||
choices: "#start"
|
choices: "#start"
|
||||||
|
|
|
@ -304,10 +304,12 @@ class Salet
|
||||||
# Go back N rooms. It's not an UNDO.
|
# Go back N rooms. It's not an UNDO.
|
||||||
# Also, steps = 1 is the current room
|
# Also, steps = 1 is the current room
|
||||||
@goBack = (steps = 2) =>
|
@goBack = (steps = 2) =>
|
||||||
if @progress.path.length > steps
|
if @progress.path.length == 1
|
||||||
|
location = @start
|
||||||
|
else if @progress.path.length > steps
|
||||||
location = @progress.path[@progress.path.length - steps]
|
location = @progress.path[@progress.path.length - steps]
|
||||||
else
|
else
|
||||||
location = @start
|
return @goBack(steps - 1)
|
||||||
@processClick(location)
|
@processClick(location)
|
||||||
|
|
||||||
# Transition between rooms.
|
# Transition between rooms.
|
||||||
|
|
|
@ -26,7 +26,7 @@ addClass = (element, className) ->
|
||||||
|
|
||||||
class SaletView
|
class SaletView
|
||||||
init: (salet) =>
|
init: (salet) =>
|
||||||
$("#content, #ways, #buttons").on("click", "a", (event) ->
|
$("#page").on("click", "a", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
a = $(this)
|
a = $(this)
|
||||||
href = a.attr('href')
|
href = a.attr('href')
|
||||||
|
@ -86,7 +86,9 @@ class SaletView
|
||||||
###
|
###
|
||||||
clearContent: (elementSelector = "#content") ->
|
clearContent: (elementSelector = "#content") ->
|
||||||
if (elementSelector == "#content") # empty the intro with the content
|
if (elementSelector == "#content") # empty the intro with the content
|
||||||
document.getElementById("intro").innerHTML = ""
|
intro = document.getElementById("intro")
|
||||||
|
if intro?
|
||||||
|
intro.innerHTML = ""
|
||||||
document.querySelector(elementSelector).innerHTML = ""
|
document.querySelector(elementSelector).innerHTML = ""
|
||||||
|
|
||||||
prepareContent: (content) ->
|
prepareContent: (content) ->
|
||||||
|
|
Loading…
Reference in a new issue