Log from a modified version of AddLogs (writes all lines that will be executed. In brackets the name of the module, when a routine starts).
[actGameRoom] the Activity "automatically" restarted
[clsPlayer] a Class
[cvPlayer] a custom View
[srvComm] a Service
[WSHandler] a websocket handler class
[actGameRoom] code...
Private Sub btnExit_Click
code...Dim Answ As Int
code...Dim txt As String
code...txt = "Exit from room: are you sure?"
code...If mStatus = STATUS_PLAYING Then
code...txt = txt & CRLF & CRLF & "IF YOU EXIT NOW, YOU WILL PAY xxx"
code...End If
code...Answ = Msgbox2(txt, "ATTENTION", "Yes", "", "No", Null)
code...If Answ = DialogResponse.POSITIVE Then
code...RemovePlayer(mMyTurnOrder)
[actGameRoom] code...Private Sub RemovePlayer(TurnOrder As Int)
code...Dim Player As clsPlayer = mmapPlayers.Get(TurnOrder)
code...mPlaces(Player.PlaceIndex).GetLabelTop.Text = "Vacancy"
[clsPlayer] code...Public Sub getPlaceIndex As Int
code...Return mPlaceIndex
[cvPlayer] code...Public Sub GetLabelTop As Label
code...Return mlblTop
code...mPlaces(Player.PlaceIndex).Photo = mDefaultPhoto
[clsPlayer] code...Public Sub getPlaceIndex As Int
code...Return mPlaceIndex
[cvPlayer] code...Public Sub setPhoto(Photo As Bitmap)
code...mPhoto = Photo
code...mivPhoto.Color = mPhotoColor
code...FitCenterBitmap(mivPhoto, Photo)
[cvPlayer] code...Private Sub FitCenterBitmap(Imv As ImageView, bmp As Bitmap)
code...Private cvs As Canvas
code...cvs.Initialize(Imv)
code...Dim rectDest As Rect
code...Dim delta As Int
code...If bmp.Width / bmp.Height > Imv.Width / Imv.Height Then
code...delta = (Imv.Width - bmp.Width / bmp.Height * Imv.Height) / 2
code...rectDest.Initialize(delta, 0, Imv.Width - delta, Imv.Height)
code...End If
code...SetAntiAlias(cvs, FILTER_BITMAP_FLAG) ' non cambia alcunché, in questo caso!
[cvPlayer] code...Private Sub SetAntiAlias (c As Canvas, FilterFlag As Int)
code...Dim r As Reflector
code...Dim NativeCanvas As Object
code...r.Target = c
code...NativeCanvas = r.GetField("canvas")
code...Dim PaintFlagsDrawFilter As Object
code...PaintFlagsDrawFilter = r.CreateObject2("android.graphics.PaintFlagsDrawFilter",Array As Object(0, FilterFlag), Array As String("java.lang.int", "java.lang.int"))
code...r.Target = NativeCanvas
code...r.RunMethod4("setDrawFilter", Array As Object(PaintFlagsDrawFilter), Array As String("android.graphics.DrawFilter"))
code...cvs.DrawBitmap(bmp, Null, rectDest)
code...Imv.Gravity = Gravity.FILL
code...Imv.Invalidate
code...Player = Null
code...mMyTurnOrder = -1
code...CallSubDelayed2(srvComm, "RunOnServerPlayerExitsGameRoom", True)
code...LogColor("Chiudo actGameRoom", Colors.Red)
Chiudo actGameRoom <---
code...
Activity.Finish
code...End If
[srvComm] code...Private Sub RunOnServerPlayerExitsGameRoom(Voluntary As Boolean)
code...Dim Data As Map : Data.Initialize
code...Data.Put("Voluntary", Voluntary)
code...wsh.SendEventToServer("PlayerExitsGameRoom", Data)
[WSHandler] code...Public Sub SendEventToServer(Event As String, Data As Map)
code...Dim m As Map
code...m.Initialize
code...m.Put("type", "event")
code...m.Put("event", "FromClient_" & Event)
code...m.Put("params", Data)
code...Dim jg As JSONGenerator
code...jg.Initialize(m)
code...ws.SendText(jg.ToString)
** Activity (actgameroom) Pause, UserClosed = true **
[actGameRoom] code...Sub Activity_Pause (UserClosed As Boolean)
code...ActivityIsStarted = Not(UserClosed)
** Activity (actgameroom) Create, isFirst = false **
[actGameRoom] code...Sub Activity_Create(FirstTime As Boolean)
code...Activity.LoadLayout("layGameRoom")
As you can see (not so easily
) no messages from server are arrived.