I am trying to send/receive some data using B4XSerializator using the subs below:
The problem I am having is that when the code hits the "cDie(i).Value = Cint(rolledDiceMap(i).Get("value"))" line, I get the following error:
Is it not possible to successfully send a list of map arrays using B4XSerializator, or is there something else I'm missing here?
- Colin.
B4X:
Private Sub sendData
Private ser As B4XSerializator
Private Data() As Byte
Private i As Int
Private dataList As List
Private rolledDiceMap(6) As Map
Private gameDiceMap(36) As Map
Private miscMap As Map
For i = 0 To 5
rolledDiceMap(i).Initialize
rolledDiceMap(i).Put("value", cDie(i).Value)
Next
For i = 0 To 35
gameDiceMap(i).Initialize
gameDiceMap(i).Put("value", cGameDie(i).Value)
gameDiceMap(i).Put("match", cGameDie(i).Match)
gameDiceMap(i).Put("locked", cGameDie(i).Locked)
gameDiceMap(i).Put("won", cGameDie(i).Won)
Next
miscMap.Initialize
miscMap.Put("gameScore", gameScore)
dataList.Initialize2(Array(rolledDiceMap, gameDiceMap, miscMap))
Data = ser.ConvertObjectToBytes(dataList)
TurnBasedMatch.TakeTurn(TBMatch, Data, TurnBasedMatch.PARTICIPANT_NEXT, "GP_onTurnBasedMatchUpdated")
End Sub
Private Sub decodeMatchData(data() As Byte)
Private i As Int
Private ser As B4XSerializator
Private dataList As List = ser.ConvertBytesToObject(data)
Private rolledDiceMap() As Map = dataList.Get(0)
Private gameDiceMap() As Map = dataList.Get(1)
Private miscMap As Map = dataList.Get(2)
For i = 0 To 5
cDie(i).Value = Cint(rolledDiceMap(i).Get("value"))
Next
For i = 0 To 35
cGameDie(i).Value = gameDiceMap(i).Get("value")
cGameDie(i).Match = gameDiceMap(i).Get("match")
cGameDie(i).Locked = gameDiceMap(i).Get("locked")
cGameDie(i).Won = gameDiceMap(i).Get("won")
Next
Log(miscMap.Get("gameScore"))
End Sub
The problem I am having is that when the code hits the "cDie(i).Value = Cint(rolledDiceMap(i).Get("value"))" line, I get the following error:
java.lang.RuntimeException: Method: Get not found in: anywheresoftware.b4a.objects.collections.Map$MyMap
Is it not possible to successfully send a list of map arrays using B4XSerializator, or is there something else I'm missing here?
- Colin.