add "donext" which forces one nev to follow another

This commit is contained in:
Jeremy Penner 2011-03-03 07:42:54 -08:00
parent 2c8380a776
commit b5b15da057

View file

@ -511,10 +511,25 @@ class ActorPlayer
if (wst.nev.player_nevIDRespondedTo?) if (wst.nev.player_nevIDRespondedTo?)
wst.gst.Link("Undo", (() => @RemoveResponse(wst.nev); wst.gst.Display()), "class='iffy-undo'") wst.gst.Link("Undo", (() => @RemoveResponse(wst.nev); wst.gst.Display()), "class='iffy-undo'")
class ActorNext
constructor: (@story) ->
@mpnevID_rgnev = {}
for section in @story.Rgsection()
for dDoNext in section.jSection.find("donext")
@add(new Nev($(dDoNext.parentNode)), section.NevByName($(dDoNext).attr("nev")))
add: (nev, nevResponse) ->
if not @mpnevID_rgnev[nev.ID()]?
@mpnevID_rgnev[nev.ID()] = []
@mpnevID_rgnev[nev.ID()].push(nevResponse)
EninevResponse: (nev, wst) ->
rgnev = @mpnevID_rgnev[nev.ID()]
if rgnev? then new EniArray(rgnev) else EniEmpty
FilterStHtml: (stHtml, wst) -> stHtml
class Story class Story
constructor: (@jStory) -> constructor: (@jStory) ->
@actorPlayer = new ActorPlayer(this) @actorPlayer = new ActorPlayer(this)
@rgactor = [@actorPlayer] @rgactor = [@actorPlayer, new ActorNext(this)]
SectionByName: (stName) -> SectionByName: (stName) ->
jSection = @jStory.find("section[name=#{stName}]") jSection = @jStory.find("section[name=#{stName}]")
if jSection.length == 1 then new Section(this, jSection) if jSection.length == 1 then new Section(this, jSection)