add undo
This commit is contained in:
parent
60b74b4c93
commit
dee1904af0
18
iffy.coffee
18
iffy.coffee
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue