void SignInCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.SIGNIN); if (handle.Success) { } }
void QuitGameCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOBBY || mode == Mode.INGAME); if (handle.Success) { LoadTables(); } }
void OpenGameCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOBBY); if (handle.Success) { LoadTables(); } }
void GetGameDataCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOBBY || mode == Mode.INGAME); if (handle.Success) { JSONObject data = handle.ResultData; Logger.Instance.Log("DETAIL", "gamedata: " + data.ToString()); handle.dataCallback(data); } }
void CreateGameCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOBBY); if (handle.Success) { JSONObject data = handle.ResultData; string activeTable = data.GetField("table").ToString(); OpenGame(activeTable); } }
public bool SendNotification(string type, Dictionary <string, string> args, Web.RequestHandle.SuccessCallBackType callback) { Debug.Assert(mode == Mode.INGAME); Web.RequestHandle handle = sendRequest(serverData.GameName, type, args, SendNotificationCallBack, "Notify"); if (handle != null) { handle.successCallback = callback; } return(handle != null); }
/////// Send Requests //////// /////// Request callbacks //////// void LoadTablesCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOBBY || mode == Mode.INGAME); if (handle.Success) { JSONObject data = handle.ResultData; JSONObject tables = data.GetField("tables"); Logger.Instance.Log("DETAIL", tables.ToString()); Lobby.UpdateTables(tables); } }
public bool GetGameData(string tableId, Web.RequestHandle.DataCallBackType callback) { Debug.Assert(mode == Mode.LOBBY || mode == Mode.INGAME); var args = new Dictionary <string, string>(); args["table"] = tableId; Web.RequestHandle handle = sendRequest(serverData.GameName, "gamedataonly", args, GetGameDataCallBack, "GetGameData"); if (handle != null) { handle.dataCallback = callback; } return(handle != null); }
void LogOutCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOGIN); logInData.ClearUserInfos(); if (handle.Success) { JSONObject data = handle.ResultData; if (data.GetField("success").b) { } else { Logger.Instance.Log("NW_WARNING", "Not properly disconnected"); } } }
void JoinGameCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOBBY); if (handle.Success) { JSONObject data = handle.ResultData; if (data.str == "ok") { LoadTables(); } else { Logger.Instance.Log("NW_WARNING", "Server Error"); } } }
public bool GetNotificationHistory(string tableId, int from, bool simpleNoteHistoric, Web.RequestHandle.DataCallBackType callback) { Debug.Assert(mode == Mode.INGAME); var args = new Dictionary <string, string>(); args["table"] = tableId; args["from"] = from.ToString(); args["privateinc"] = "1"; args["history"] = simpleNoteHistoric ? "1" : "0"; Web.RequestHandle handle = sendRequest(serverData.GameName, "notificationHistory", args, GetNotificationHistoryCallBack, "GetHistory"); if (handle != null) { handle.dataCallback = callback; } return(handle != null); }
void GetNotificationHistoryCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.INGAME); if (handle.Success) { JSONObject data = handle.ResultData; if (data.GetField("valid").n == 1) { JSONObject history = data.GetField("data"); Logger.Instance.Log("DETAIL", "history: " + history.ToString()); handle.dataCallback(history); } else { Logger.Instance.Log("WARNING", "Server History Result Invalid"); Logger.Instance.Log("DETAIL", "data: " + data.ToString()); handle.dataCallback(null); } } }
void SendNotificationCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.INGAME); bool success = false; if (handle.Success) { JSONObject data = handle.ResultData; if (data.HasField("valid") && data.GetField("valid").n == 1) { success = true; } else { Logger.Instance.Log("WARNING", "Server Notification Result Invalid"); Logger.Instance.Log("DETAIL", "data: " + data.ToString()); } } handle.successCallback(success); }
void LogInCallBack(Web.RequestHandle handle) { Debug.Assert(mode == Mode.LOGIN || mode == Mode.ONLINE); if (handle.Success) { JSONObject data = handle.ResultData; if (data.GetField("success").b) { logInData.UpdateUserInfos(data); SavePersistantData(); } else { Logger.Instance.Log("NW_WARNING", "Incorrect username or password"); logInData.ClearUserInfos(); } } else { logInData.ClearUserInfos(); } }