'Save name and score on Back button, close after choice, if player named
Sub Activity_KeyPress (KeyCode As Int) As Boolean
'If the first action is Back key then allow close immediately, otherwise ask.
If bStarted=False Then Return False
If KeyCode = KeyCodes.KEYCODE_BACK AND bShutTrap=False Then
bShutTrap=True
pCommon.RemoveView
'Disable Help and Undo, other buttons are disbled by form being called, Common(fc)
bl.Enabled=False
Common(fc)
Return True
Else
'temporary disable keycodes except Back and multi Back? TEST!!;
Return True
End If
End Sub
...'Key_Click code when the answer is YES save game
Case "KbdFinish"
etName=pBack.tag
pKbd=pnl.tag
If etName.Text<>"" AND etName.text<>"Enter Name" Then
Player.Name=etName.text
pKbd.RemoveView
End If
'this removes the 'question' panel, puts up information panel 'saving...'
pCommon.RemoveView
form.Name="Message":form.Title="MESSAGE": form.Msg="Saving Your Game": form.pCol=1: form.tBtn1="": form.tBtn2=""
Common(form)
DoEvents
If Not (File.Exists(File.DirInternal,Player.Name&"#"&Player.Clrs&".dat")) Then
lGames.Add(Player)
WriteGames
End If
raf.Initialize(File.DirInternal,Player.Name&"#"&Player.Clrs&".dat",False)
raf.WriteObject(Player,True,raf.CurrentPosition)
raf.WriteObject(aGrid,True,raf.CurrentPosition)
raf.WriteObject(lUndo,True,raf.CurrentPosition)
raf.WriteInt(Player.Clrs,raf.CurrentPosition)
raf.Close
'removes the information panel
pCommon.RemoveView
Activity.Finish
End Select