This commit is contained in:
Jeremy Penner 2011-02-09 21:48:21 -08:00
parent 60b74b4c93
commit dee1904af0

View file

@ -386,11 +386,19 @@ class ActorPlayer
constructor: (@story) ->
@mpnevID_rgnev = {}
RespondTo: (nev, nevResponse) ->
nevResponse.player_nevIDRespondedTo = nev.ID();
rgnev = @mpnevID_rgnev[nev.ID()]
if rgnev?
rgnev.push(nevResponse)
else
@mpnevID_rgnev[nev.ID()] = [nevResponse]
RemoveResponse: (nevResponse) ->
rgnev = @mpnevID_rgnev[nevResponse.player_nevIDRespondedTo]
for nev, inev in rgnev
if nev.ID() == nevResponse.ID()
rgnev.splice(inev, 1)
break
FWillAttempt: (wst, nev) ->
rgnev = @mpnevID_rgnev[wst.nev.ID()]
if rgnev?
@ -403,8 +411,14 @@ class ActorPlayer
if rgnev? then new EniArray(rgnev) else EniEmpty
FilterStHtml: (stHtml, wst) ->
TemplateFromStNev(stHtml, wst)(wst)
stHtmlNew = TemplateFromStNev(stHtml, wst)(wst)
if (wst.nev.player_nevIDRespondedTo?)
stId = wst.gst.RegOnClick(() => @RemoveResponse(wst.nev); wst.gst.Display())
stHtmlNew = "<div class='iffy-player-action'>#{stHtmlNew}</div>" +
"<div class='iffy-player-ui'><a href='javascript:void(0)' id='#{stId}' class='iffy-undo'>Undo</a></div>"
stHtmlNew
class Story
constructor: (@jStory) ->
@actorPlayer = new ActorPlayer(this)