I know there’s a lot of question about this topic but i guess mine is a little bit different so here what my problem is . I have this script
public void Start()
{
NetworkManager.instance.WebSocketServer.OnCallBack_SC_WEBSOCKET_BcSetGame += CallBack_CS_WEBSOCKET_BcSetGame;
}
private void CallBack_CS_WEBSOCKET_BcSetGame(bool success, Int32 table_no, Int32 gametable_no, Int32 gameset, Int32 gap)
{
if (tzPlayInfo.Instance.BcGameTableNo == gametable_no)
{
switch ((GameCommon.GAMEBC_COMMAND)gameset)
{
case GameCommon.GAMEBC_COMMAND.end:
//SEND THE PACKET
//ORIGINAL CODE
for (int i = 0; i < tzPlayInfo.Instance.bc_gametablelist.Count; i++)
{
NetworkManager.Instance.WebSocketServer.CS_WEBSOCKET_BcGametableHistory(
tzPlayInfo.Instance.bc_gametablelist[i].gametable_no,
0,
0,
0,
0);
}
WinLog();
break;
}
}
}
IEnumerator WinLog_big_road()
{
string history = "";
SerializeString dataParser = new SerializeString
{
dataToParse = history += tzPlayInfo.Instance.historytablevalue
};
//Convert to Json Format
string StringToJson = JsonUtility.ToJson(dataParser);
Debug.Log(StringToJson);
SerializeString obj = JsonUtility.FromJson<SerializeString>(StringToJson);
DeleteChildrens(pos_big_road);
yield return new WaitForEndOfFrame();
//remove the [ and ] and "," and ""
for (int i = 1; i < obj.dataToParse.Length - 1; i+= 3) {
char individualChar = obj.dataToParse[i];
Debug.Log(individualChar.ToString());
int x = i % rh.Const._HISTORY_COUNT_;
int y = i / rh.Const._HISTORY_HEIGHT_;
float xl = 2.0f;
float yl = -5.0f;
GameObject o = Instantiate(prefab_big_road) as GameObject;
o.transform.SetParent(pos_big_road);
o.transform.localScale = Vector3.one;
o.transform.localPosition = new Vector3(x * xl, y * yl, 0f);
if (individualChar == 'P')
{
o.GetComponent<UISprite>().spriteName = "layout_player_bigline-01";
NGUITools.SetActive(o, true);
}
else if (individualChar == 'B')
{
o.GetComponent<UISprite>().spriteName = "layout_banker_bigline-01";
NGUITools.SetActive(o, true);
}
else if(individualChar == 'T')
{
o.GetComponent<UISprite>().spriteName = "layout_tie_bigline-01";
NGUITools.SetActive(o, true);
}
else
{
Debug.Log("No Sprites Yet");
}
yield return new WaitForEndOfFrame();
}
yield break;
}
public void WinLog()
{
StopCoroutine("WinLog_big_road");
StartCoroutine("WinLog_big_road");
}
[Serializable]
public class SerializeString
{
public string dataToParse;
}
which is i send a request to the server the the server response me
Logs:
-
Gametable 1 History = P ,P ,P ,B ,B ,B ,P P,P ,B ,P ,
-
Gametable 2 History = B ,B ,P ,B ,B ,P ,B ,PP ,B ,
-
Gametable 3 History = B ,B ,P ,B ,B ,P ,B ,PP ,B ,
-
Gametable 4 History = P ,B ,PP ,P P,BP ,B ,P ,P ,PP ,
as you can see on my logs(Gametable 1 History) here you have P _ _,
i have spaces well originally 3 if there’s no character in there I reserve that for some cases that i have this characters PBP or PBB etc.
The problem here is that i can only parse 1 history table and that is only the Gametable 4 History
and i logged it and it has me this output
I could not parse the other tables