oomek/attractplus

attractplus-kms "incomplete" layout reload after returning from game

Closed this issue · 2 comments

When getting back from a game in attractplus-kms, the layout is reloaded, but the reload is not "complete" because no StartLayout is triggered.

Sample code:

local gamename = fe.add_text("[title]",0,0,200,10)
local test = "LOAD"

fe.add_transition_callback(this,"on_transition")

function on_transition (ttype,var,ttime){
   if (ttype == Transition.StartLayout){
      test = "START"
      print ("A: "test+"\n")
   }
   if (ttype == Transition.ToGame){
      test = "TOGAME"
      print ("B: "test+"\n")
   }
   if (ttype == Transition.FromGame){
      print ("C: "test+"\n")
   }
   return false
}

Expected behavior: test is set to "LOAD" at layout load, then to "START" when StartLayout is triggered. In non-KMS environment when the game ends the code prints "TOGAME". Under KMS when the game ends the layout restarts, but no StartLayout is triggered, "FromGame" is triggered instead, so the output is "LOAD" because the code in the StartLayout portion is not executed.

Can be an issue for a layout that uses a global variable and change its value during StartLayout, that will cause issues if at the layout reload StartLayout is not re-triggered.

oomek commented

Is it still an issue?

No sorry I forgot to give feedback, the issue can be closed