public int SetCopyPlayerIdWithOTPCallback(Session.CopyPlayerIdWithOTPDelegate callback) { if (null == callback) { return(0); } int handlerNum = CallbackManager.AddHandler(delegate(CallbackMessage message) { Log.Debug("[SessionCallback] CopyPlayerIdWithOTPCallback: " + message.ToString()); Result result = message.GetResult(); RestrictOTPInput restrictOTPInput = null; IDictionary restrictOTPInputDic = message.GetDictionary("restrictOTPInput"); if (null != restrictOTPInputDic) { int failCount = restrictOTPInputDic.GetInt("failCount"); string retryDateTime = restrictOTPInputDic.GetString("retryDateTime"); restrictOTPInput = new RestrictOTPInput(failCount, retryDateTime); } if (null != callback) { callback(result, restrictOTPInput); } }); return(handlerNum); }
public int SetRequestOTPInfoCallback(Session.RequestOTPInfoDelegate callback) { if (null == callback) { return(0); } int handlerNum = CallbackManager.AddHandler(delegate(CallbackMessage message) { Log.Debug("[SessionCallback] RequestOTPInfoCallback: " + message.ToString()); Result result = message.GetResult(); IDictionary otpInfoDic = message.GetDictionary("otpInfo"); OTPInfo otpInfo = null; if (null != otpInfoDic) { string otp = otpInfoDic.GetString("otp"); string playerId = otpInfoDic.GetString("playerId"); string region = otpInfoDic.GetString("region"); List <OTPAuthenticationHistory> otpAuthenticationHistoryList = null; IList historyList = otpInfoDic["otpAuthenticationHistoryList"] as IList; if (historyList != null) { otpAuthenticationHistoryList = new List <OTPAuthenticationHistory>(); foreach (IDictionary history in historyList) { string historyGameCode = history.GetString("gameCode"); string historyPlayerId = history.GetString("playerId"); string creationDate = history.GetString("creationDate"); otpAuthenticationHistoryList.Add(new OTPAuthenticationHistory(historyGameCode, historyPlayerId, creationDate)); } } otpInfo = new OTPInfo(otp, playerId, region, otpAuthenticationHistoryList); } IDictionary restrictOTPInputDic = message.GetDictionary("restrictOTPInput"); RestrictOTPInput restrictOTPInput = null; if (null != restrictOTPInputDic) { int failCount = restrictOTPInputDic.GetInt("failCount"); string retryDateTime = restrictOTPInputDic.GetString("retryDateTime"); restrictOTPInput = new RestrictOTPInput(failCount, retryDateTime); } if (null != callback) { callback(result, otpInfo, restrictOTPInput); } }); return(handlerNum); }