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) ->
|
constructor: (@story) ->
|
||||||
@mpnevID_rgnev = {}
|
@mpnevID_rgnev = {}
|
||||||
RespondTo: (nev, nevResponse) ->
|
RespondTo: (nev, nevResponse) ->
|
||||||
|
nevResponse.player_nevIDRespondedTo = nev.ID();
|
||||||
rgnev = @mpnevID_rgnev[nev.ID()]
|
rgnev = @mpnevID_rgnev[nev.ID()]
|
||||||
if rgnev?
|
if rgnev?
|
||||||
rgnev.push(nevResponse)
|
rgnev.push(nevResponse)
|
||||||
else
|
else
|
||||||
@mpnevID_rgnev[nev.ID()] = [nevResponse]
|
@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) ->
|
FWillAttempt: (wst, nev) ->
|
||||||
rgnev = @mpnevID_rgnev[wst.nev.ID()]
|
rgnev = @mpnevID_rgnev[wst.nev.ID()]
|
||||||
if rgnev?
|
if rgnev?
|
||||||
|
@ -403,8 +411,14 @@ class ActorPlayer
|
||||||
if rgnev? then new EniArray(rgnev) else EniEmpty
|
if rgnev? then new EniArray(rgnev) else EniEmpty
|
||||||
|
|
||||||
FilterStHtml: (stHtml, wst) ->
|
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
|
class Story
|
||||||
constructor: (@jStory) ->
|
constructor: (@jStory) ->
|
||||||
@actorPlayer = new ActorPlayer(this)
|
@actorPlayer = new ActorPlayer(this)
|
||||||
|
|
Loading…
Reference in a new issue