From cfadea775a04723364c3424bd48fe169489c8b1e Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Thu, 10 Mar 2016 21:03:54 +0700 Subject: [PATCH] Hiding fixes --- lib/room.coffee | 10 ++++------ lib/view.coffee | 7 ++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/room.coffee b/lib/room.coffee index 6c5aac2..6a90671 100644 --- a/lib/room.coffee +++ b/lib/room.coffee @@ -169,13 +169,11 @@ class SaletRoom @entering.fcall(this, system, @name) return system.view.write(thing.take.fcall(thing, system).toString()) if thing.act - system.view.changeLevel(thing.level) - return system.view.write( - system.view.wrapLevel( - thing.act.fcall(thing, system).toString(), - thing.level - ) + text = system.view.wrapLevel( + thing.act.fcall(thing, system).toString(), + thing.level ) + return system.view.changeLevel(thing.level, text) # the loop is done but no return came - match not found console.error("Could not find #{link[2]} in current room.") diff --git a/lib/view.coffee b/lib/view.coffee index 71437b4..88c0be8 100644 --- a/lib/view.coffee +++ b/lib/view.coffee @@ -205,7 +205,7 @@ class SaletView # Remove every section marked as a different level. # For a link level 0, we hide every link of level 1 and above. # It's for the player to focus. - changeLevel: (level) => + changeLevel: (level, text) => maxLevel = 6 if level < maxLevel i = level + 1 @@ -214,10 +214,11 @@ class SaletView hideArray.push("#content .lvl"+i) i++ directive = hideArray.join(", ") - $(directive).fadeOut("slow") + $(directive).hide() + @write text wrapLevel: (text, level) => - return ""+text+'' + return "
"+markdown(text)+'
' # At last, we scroll the view so that .new objects are in view. endOutputTransaction: () =>