mirror of
https://gitlab.com/Oreolek/salet-module.git
synced 2024-05-18 17:08:30 +03:00
New version finally fixes the effects.
This commit is contained in:
parent
268808bb4f
commit
a9f7ef762a
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salet",
|
||||
"version": "1.5.4",
|
||||
"version": "1.6",
|
||||
"description": "A general client-side framework for cybertext interactive fiction games.",
|
||||
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
|
||||
"homepage": "http://salet.oreolek.ru",
|
||||
|
|
|
@ -39,12 +39,11 @@ class SaletRoom
|
|||
return true
|
||||
|
||||
###
|
||||
Salet's Undum version calls Situation.entering every time a situation is entered, and
|
||||
Salet calls Situation.entering every time a situation is entered, and
|
||||
passes it a string referencing the previous situation, or null if there is
|
||||
none (ie, for the starting situation).
|
||||
|
||||
My version of `enter` splits the location description from the effects.
|
||||
Also if f == this.name (we're in the same location) the `before` and `after` callbacks are ignored.
|
||||
If f == this.name (we're in the same location) the `before` and `after` callbacks are ignored.
|
||||
###
|
||||
@entering = (f, force = false) =>
|
||||
if (
|
||||
|
@ -62,8 +61,6 @@ class SaletRoom
|
|||
|
||||
if @clear and f?
|
||||
salet.view.clearContent()
|
||||
else
|
||||
salet.view.removeTransient()
|
||||
|
||||
if f != @name and salet.rooms[f]?
|
||||
@visited++
|
||||
|
@ -100,6 +97,9 @@ class SaletRoom
|
|||
if @afterChoices?
|
||||
@afterChoices.fcall(this, f)
|
||||
|
||||
if not @clear
|
||||
salet.view.removeTransient(f)
|
||||
|
||||
if salet.autosave and @canSave
|
||||
salet.saveGame()
|
||||
|
||||
|
|
|
@ -120,12 +120,19 @@ class SaletView
|
|||
text. This can be used to remove action options when an action
|
||||
is no longer available. It is used automatically when you give
|
||||
a link the 'once' class.
|
||||
|
||||
@param code remove all links to given target (optional)
|
||||
@param container remove all links inside given block (optional)
|
||||
###
|
||||
@clearLinks = (code) ->
|
||||
@clearLinks = (code, container) ->
|
||||
if code
|
||||
links = $("#page").find("a[href='" + code + "']")
|
||||
unless container?
|
||||
container = "#page"
|
||||
links = $(container).find("a[href='" + code + "']")
|
||||
else
|
||||
links = $("#content").find("a")
|
||||
unless container?
|
||||
container = "#content"
|
||||
links = $(container).find("a")
|
||||
for a in links
|
||||
a = $(a)
|
||||
if not code and (a.hasClass('sticky') || a.attr("href").match(/[?&]sticky[=&]?/))
|
||||
|
@ -177,14 +184,20 @@ class SaletView
|
|||
$('.new').removeClass('new')
|
||||
|
||||
# Removes links and transient sections.
|
||||
@removeTransient = () =>
|
||||
contentToHide = $('#content .transient')
|
||||
contentToHide = contentToHide.add('#content .options')
|
||||
contentToHide = contentToHide.add($("#content a").filter(() ->
|
||||
@removeTransient = (room = undefined) =>
|
||||
container = "#content"
|
||||
if (room)
|
||||
container = ".room-#{room}"
|
||||
|
||||
transientFilter = () ->
|
||||
return $(this).attr("href").match(/[?&]transient[=&]?/)
|
||||
))
|
||||
contentToHide = $("#{container} .transient")
|
||||
contentToHide = contentToHide.add("#{container} .options")
|
||||
contentToHide = contentToHide.add(
|
||||
$("#{container} a").filter(transientFilter)
|
||||
)
|
||||
@hideBlock(contentToHide, true)
|
||||
@clearLinks()
|
||||
@clearLinks(undefined, container)
|
||||
|
||||
# At last, we scroll the view so that .new objects are in view.
|
||||
@endOutputTransaction = () ->
|
||||
|
@ -253,7 +266,7 @@ class SaletView
|
|||
return block.hide()
|
||||
|
||||
callback = () ->
|
||||
block.remove()
|
||||
$(this).remove()
|
||||
if remove == false
|
||||
callback = undefined
|
||||
block.finish().fadeTo(500, 0, () ->
|
||||
|
|
Loading…
Reference in a new issue