public void SendEvent(TypeEventType _in_type, U3DTypeBaseData _in_data) { U3DTypeEvent evt = new U3DTypeEvent(_in_type, _in_data); if (null != _in_data) { Debug.Log(">>>>send event<<<<< type " + _in_type + "data" + _in_data.DataToString()); } else { Debug.Log(">>>>send event<<<<< type " + _in_type + "null data"); } Debug.Log("delegate dic start"); if (_delegateDic.ContainsKey(_in_type)) { if (_delegateDic[_in_type] != null) { Debug.Log("find delegate " + _delegateDic[_in_type].ToString()); U3DTypeEventDelegate _delegate = _delegateDic[_in_type]; _delegate(evt); // _delegateDic[_in_type](evt); } } else { Debug.Log("dic didnot has key"); } }
void ReloginResult(U3DTypeEvent evt) { Game.Instance.ChangeSceneToLoginAndAutoLogin(() => { LoginResult(evt); }); }
void LoginResult(U3DTypeEvent evt) { Debug.Log("LoginResult:" + evt.evtType); var enumerator = evt.evtData.attMap().GetEnumerator(); while (enumerator.MoveNext()) { Debug.Log("Key:" + enumerator.Current.Key + " Value:" + enumerator.Current.Value); } if (evt.evtType == TypeEventType.EVENT_LOGIN_SUCCESS) { if (SDKUseType == TypeSDKUseType.BIND_FACEBOOK) { user_id = evt.evtData.attMap()["user_id"].ToString(); user_token = evt.evtData.attMap()["user_token"].ToString(); //바인딩시도 - 서버에 바인딩이 이미 되어있는 계정인가 체크 //NetworkClient.instance.SendPMsgUserBindFacebookC(user_id); NetworkClient.instance.SendPMsgUserBindQueryFbGoogleC(); } else if (SDKUseType == TypeSDKUseType.LOGIN_FACEBOOK) { //로그인시도 - 서버에 로그인가능한지 쿼리 user_id = evt.evtData.attMap()["user_id"].ToString(); user_token = evt.evtData.attMap()["user_token"].ToString(); OnFacebookBind(user_id); } } }
void LoginResult(U3DTypeEvent evt) { Debug.Log("LoginResult"); U3DTypeBaseData data = evt.evtData; //string userName = data.GetData(U3DTypeAttName.USER_NAME); string userID = data.GetData(U3DTypeAttName.USER_ID); string userToken = data.GetData(U3DTypeAttName.USER_TOKEN); // Dictionary<string,string> dataArr = new Dictionary<string,string> (); U3DTypeBaseData platform = U3DTypeSDK.Instance.GetPlatformData(); U3DTypeBaseData baseData = new U3DTypeBaseData(); baseData.SetData("id", userID); baseData.SetData("token", userToken); baseData.SetData("data", ""); baseData.SetData("cid", platform.GetData(U3DTypeAttName.CHANNEL_ID)); // baseData.SetData ("sign", userID + "|" + userToken + "|" + ""+"|"+platform.GetData(U3DTypeAttName.CHANNEL_ID)); // string dataArr = changeBaseDataToHttpData (baseData); // Debug.Log ("login sent to server data " + dataArr); DataProxy.Ins.ServerLogic.RequestLogin(this, baseData, ServerCBK_login, null); //send user info to server and exchange playerinfo; }
//支付结果通知回调,CP需根据支付返回结果完成相应逻辑 void NotifyPayResult(U3DTypeEvent evt) { if (evt.evtData.GetData(U3DTypeAttName.PAY_RESULT).Equals("1")) { //支付成功 } else {//支付失败, } }
void ErrorEvent(U3DTypeEvent evt) { Debug.Log("ErrorEvent:" + evt.evtType); var enumerator = evt.evtData.attMap().GetEnumerator(); while (enumerator.MoveNext()) { Debug.Log("Key:" + enumerator.Current.Key + " Value:" + enumerator.Current.Value); } }
void PayResult(U3DTypeEvent evt) { U3DTypeBaseData data = evt.evtData; bool paySuccess = data.GetBool(U3DTypeAttName.PAY_RESULT); if (paySuccess) { StartRepeatRequestIntoAccount(); } }
//初始化完成后回调函数 void NotifyInitFinish(U3DTypeEvent evt) { Debug.LogWarning("初始化完成!!!!"); // Application.LoadLevelAsync("MainScene"); if (onSDKInitComplete != null) { Debug.LogWarning("初始化完成123!!!!"); onSDKInitComplete(evt.evtData); onSDKInitComplete = null; } }
void PayResult(U3DTypeEvent evt) { U3DTypeBaseData data = evt.evtData; // datalock_pay_progress = 0; // // bool paySuccess = data.GetBool(U3DTypeAttName.PAY_RESULT); // if (paySuccess) // { // StartRepeatRequestIntoAccount(); // } }
//支付结果通知回调,CP需根据支付返回结果完成相应逻辑 void NotifyPayResult(U3DTypeEvent evt) { if (evt.evtData.GetData(U3DTypeAttName.PAY_RESULT).Equals("1")) { //支付成功 Debug.Log("pay finished:" + evt.evtData.GetData(U3DTypeAttName.PAY_RESULT_DATA)); onSDKPayComplete(true); } else { //支付失败,或取消 Debug.Log("pay failed:" + evt.evtData.GetData(U3DTypeAttName.PAY_RESULT_REASON)); onSDKPayComplete(false); } }
//登录操作完成后的回调函数 void NotifyLogin(U3DTypeEvent evt) { //解析渠道登录成功返回的信息,一般有user_token,user_id... //CP方需要将信息解析为CP服务器约定的数据格式转发给游戏服务器以完成游戏的登录验证 //此时返回的结果不能作为登录依据,需要进过服务端验证,取的服务器返回的最终数据。 //CP方需要将信息解析为CP服务器约定的数据格式转发给游戏服务器,并由游戏服务器转发至TypeSDK Server以完成游戏的登录验证 //string userId = evt.evtData.GetData(U3DTypeAttName.USER_ID); Debug.LogWarning("登陸完成!!!!"); if (onSDKLoginComplete != null) { Debug.LogWarning("登陸完成12321!!!!"); onSDKLoginComplete(evt.evtData); onSDKLoginComplete = null; } }
void LoginResult(U3DTypeEvent evt) { Debug.Log("LoginResult"); U3DTypeBaseData data = evt.evtData; string userID = data.GetData(U3DTypeAttName.USER_ID); user_token = data.GetData(U3DTypeAttName.USER_TOKEN); var platdata = U3DTypeSDK.Instance.GetPlatformData(); var channelid = platdata.GetData(U3DTypeAttName.CHANNEL_ID); var cpid = platdata.GetData(U3DTypeAttName.CP_ID); var tokens = user_token.Split('|'); if (tokens.Length > 2) { Logger.Error("tokens split error!!! token=" + user_token); return; } //增加了注册类型 tokenforPay = tokens[0].Trim(); var loginType = tokens[1].Trim(); //更换分隔符|为@_@,腾讯的userID中含有| var uid = string.Format("{0}@_@{1}@_@{2}", cpid, channelid, userID); LoginLogic.instance.StartCoroutine(LoginLogic.LoginByThirdCoroutine("typeSDK", GameSetting.Channel, uid, tokenforPay)); //账号或者游客登陆 = 0 //账号注册 = 1 //游客注册 = 2 if (loginType == "1" || loginType == "2") { System.Text.StringBuilder sb = new System.Text.StringBuilder(); JsonWriter writer = new JsonWriter(sb); writer.WriteObjectStart(); writer.WritePropertyName("type"); writer.Write("onRegister"); writer.WritePropertyName("playerId"); writer.Write(userID); writer.WriteObjectEnd(); PlatformHelper.OnRegister(sb.ToString()); } }
void LoginResult(U3DTypeEvent evt) { Debug.Log("LoginResult"); U3DTypeBaseData data = evt.evtData; string userID = data.GetData(U3DTypeAttName.USER_ID); string userToken = data.GetData(U3DTypeAttName.USER_TOKEN); U3DTypeBaseData platform = U3DTypeSDK.Instance.GetPlatformData(); U3DTypeBaseData baseData = new U3DTypeBaseData(); baseData.SetData("id", userID); baseData.SetData("token", userToken); baseData.SetData("data", ""); baseData.SetData("cid", platform.GetData(U3DTypeAttName.CHANNEL_ID)); DataProxy.Ins.ServerLogic.RequestLogin(this, baseData, ServerCBK_login, null); }
void Extrafunction(U3DTypeEvent evt) { Debug.Log("unityr receive 额外函数" + evt.evtData.DataToString()); // TypeSDKTool.AlartMessage.ShowMessage("额外函数", evt.evtData.DataToString()); // U3DTypeBaseData evtData = evt.evtData; // string func_key = evtData.GetData(U3DTypeAttName.EXTERN_FUNCTION_KEY); // string data_1 = evtData.GetData(U3DTypeAttName.EXTERN_FUNCTION_VALUE); // // string data_2 = evtData.GetData (U3DTypeAttName.EXTERN_FUNCTION_VALUE_2); // switch (func_key) // { // case "http_get": // { // this.StartCoroutine(DataProxy.Ins.ServerLogic.HttpGet(data_1, ServerCBK_CommonShowMSG, null)); // } // break; // case "http_post": // { // DataProxy.Ins.ServerLogic.HttpPost(data_1, new Dictionary<string, object>(), ServerCBK_CommonShowMSG, null); // break; // } // } }
//重登录结果通知回调 void NotifyRelogin(U3DTypeEvent evt) { }
//登出结果通知回调 void NotifyLogout(U3DTypeEvent evt) { }
//更新用户信息完成后回调 void NotifyUpdateFinish(U3DTypeEvent evt) { }
//登录操作完成后的回调函数 void NotifyLogin(U3DTypeEvent evt) { //解析渠道登录成功返回的信息,一般有user_token,user_id... //CP方需要将信息解析为CP服务器约定的数据格式转发给游戏服务器以完成游戏的登录验证 }
//获取好友列表通知回调 void NotifyUserFriends(U3DTypeEvent evt) { }
void LogoutResult(U3DTypeEvent evt) { Game.Instance.ChangeSceneToLogin(); }
void LogoutResult(U3DTypeEvent evt) { current_ui_model = UI_LOGIN; }
void InitFinishResult(U3DTypeEvent evt) { Debug.Log("receive u3d init finish"); //current_ui_model = UI_LOGIN; }
//取消退出游戏通知回调 void NotifyCancelExit(U3DTypeEvent evt) { }
//额外功能通知回调 void NotifyExtraFunction(U3DTypeEvent evt) { }
//本地推送通知回调,游戏需根据收到的数据实现相应的游戏逻辑 void NotifyReceiveLocalPush(U3DTypeEvent evt) { }
void ReloginResult(U3DTypeEvent evt) { Debug.Log("ReLoginResult"); LoginResult(evt); }
//分享结果通知回调 void NotifyShareResult(U3DTypeEvent evt) { }
//初始化完成后回调函数 void NotifyInitFinish(U3DTypeEvent evt) { Application.LoadLevelAsync("MainScene"); }