//------------------------------------------------------------------------- bool _checkResponse <TResponse>(WWW www, Action <UCenterResponseStatus, TResponse, UCenterError> handler) { if (www != null) { if (www.isDone) { UCenterResponse <TResponse> response = null; if (string.IsNullOrEmpty(www.error)) { try { response = EbTool.jsonDeserialize <UCenterResponse <TResponse> >(www.text); } catch (Exception ex) { EbLog.Error("ClientUCenterSDK.update() UCenterResponse Error"); EbLog.Error(ex.ToString()); } } else { EbLog.Error(www.url); EbLog.Error(www.error); } www = null; if (handler != null) { if (response != null) { handler(response.Status, response.Result, response.Error); } else { var error = new UCenterError(); error.ErrorCode = UCenterErrorCode.ServiceUnavailable; error.Message = ""; handler(UCenterResponseStatus.Error, default(TResponse), error); } handler = null; } return(true); } } return(false); }
//------------------------------------------------------------------------- void _onUCenterUploadProfileImage(UCenterResponseStatus status, AccountUploadProfileImageResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterUploadProfileImage() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } }
//------------------------------------------------------------------------- void _onUCenterResetPassword(UCenterResponseStatus status, AccountResetPasswordResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterResetPassword() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } }
//------------------------------------------------------------------------- void _onUCenterConvert(UCenterResponseStatus status, GuestConvertResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterConvert() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } //else //{ // EbLog.Note("AccountId=" + response.AccountId); // EbLog.Note("AccountName=" + response.AccountName); //} }
//------------------------------------------------------------------------- void _onUCenterGuestAccess(UCenterResponseStatus status, GuestAccessResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterGuestLogin() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } else { EbLog.Note("AccountId=" + response.AccountId); EbLog.Note("AccountName=" + response.AccountName); } }
//------------------------------------------------------------------------- void _onUCenterLogin(UCenterResponseStatus status, AccountLoginResponse response, UCenterError error) { string s = "ClientSampleApp._onUCenterLogin() UCenterResult=" + status; EbLog.Note(s); MbSample.Instance.ListInfo.Add(s); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } }
//------------------------------------------------------------------------- //void _onUCenterGetIpAddress(UCenterResponseStatus status, IPInfoResponse response, UCenterError error) //{ // EbLog.Note("ClientSampleApp._onUCenterGetIpAddress() UCenterResult=" + status); // if (error != null) // { // EbLog.Note("ErrorCode=" + error.ErrorCode); // EbLog.Note("ErrorMessage=" + error.Message); // } // else if (status == UCenterResponseStatus.Success) // { // EbLog.Note("Code=" + response.Code); // EbLog.Note("Area=" + response.Content.Area); // EbLog.Note("City=" + response.Content.City); // EbLog.Note("Country=" + response.Content.Country); // EbLog.Note("Region=" + response.Content.Region); // EbLog.Note("IP=" + response.Content.IP); // } //} //------------------------------------------------------------------------- void _onUCenterGetAppConfig(UCenterResponseStatus status, AppConfigurationResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterGetAppConfig() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } else if (status == UCenterResponseStatus.Success) { EbLog.Note("AppId=" + response.AppId); EbLog.Note("Configuration=" + response.Configuration); } }
//------------------------------------------------------------------------- void _onUCenterGetIpAddress(UCenterResponseStatus status, IPInfoResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterGetIpAddress() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } else if (status == UCenterResponseStatus.Success) { EbLog.Note("Code=" + response.Code); EbLog.Note("Area=" + response.Content.Area); EbLog.Note("City=" + response.Content.City); EbLog.Note("Country=" + response.Content.Country); EbLog.Note("Region=" + response.Content.Region); EbLog.Note("IP=" + response.Content.IP); } }
//------------------------------------------------------------------------- void _onUCenterLogin(UCenterResponseStatus status, AccountLoginResponse response, UCenterError error) { EbLog.Note("ClientLogin._onUCenterLogin() Status=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode + " ErrorMsg=" + error.Message); } if (status == UCenterResponseStatus.Success) { CoApp.CoNetMonitor.AccId = response.AccountId; CoApp.CoNetMonitor.Acc = response.AccountName; CoApp.CoNetMonitor.Token = response.Token; //FloatMsgInfo f_info; //f_info.msg = "登陆成功"; //f_info.color = Color.green; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); // DataEye登陆 //CoApp.CoDataEye.login(Acc, AccId); ClientConfig cc = MbMain.Instance.ClientConfig; CoApp.CoNetMonitor.connectBase(cc.BaseIp, cc.BasePort); } else if (error != null) { if (error.ErrorCode == UCenterErrorCode.AccountNotExist) { //FloatMsgInfo f_info; //f_info.msg = "帐号不存在"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); if (mGuestPlayerInfo != null) { //if(mGuestPlayerInfo.account_id==) mGuestPlayerInfo = null; PlayerPrefs.DeleteKey(mGuestPlayerKey); } } else if (error.ErrorCode == UCenterErrorCode.AccountLoginFailedPasswordNotMatch) { //FloatMsgInfo f_info; //f_info.msg = "帐号或密码错误"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } else if (error.ErrorCode == UCenterErrorCode.Failed) { //FloatMsgInfo f_info; //f_info.msg = "登陆失败"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } else { //FloatMsgInfo f_info; //f_info.msg = "其他登陆错误"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } } //UiHelper.DestroyWaiting(); }
//------------------------------------------------------------------------- void _uCenterGuestCallBack(UCenterResponseStatus status, AccountGuestLoginResponse response, UCenterError error) { if (status == UCenterResponseStatus.Success) { if (mGuestPlayerInfo == null) { mGuestPlayerInfo = new _tGuestPlayerInfo(); } mGuestPlayerInfo.account_id = response.AccountId; mGuestPlayerInfo.account_name = response.AccountName; mGuestPlayerInfo.pwd = response.Password; PlayerPrefs.SetString(mGuestPlayerKey, EbTool.jsonSerialize(mGuestPlayerInfo)); _requestLogin(mGuestPlayerInfo.account_name, mGuestPlayerInfo.pwd); } else if (error != null) { //if (error.ErrorCode == GF.UCenter.Common.Portable.UCenterErrorCode.AccountRegisterFailedAlreadyExist) //{ // FloatMsgInfo f_info; // f_info.msg = "帐号已存在"; // f_info.color = Color.red; // UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); //} //UiHelper.DestroyWaiting(); Debug.LogError(string.Format("_uCenterGuestCallBack::Error::ErrorCode::{0} ErrorMsg::{1}", error.ErrorCode.ToString(), error.Message)); } else { //FloatMsgInfo f_info; //f_info.msg = "注册失败"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); //UiHelper.DestroyWaiting(); } }
//------------------------------------------------------------------------- void _onUCenterConvert(UCenterResponseStatus status, AccountConvertResponse response, UCenterError error) { //UiHelper.DestroyWaiting(); if (status == UCenterResponseStatus.Success) { //FloatMsgInfo f_info; //f_info.msg = "游客帐号转正成功"; //f_info.color = Color.green; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); CoApp.CoNetMonitor.AccId = response.AccountId; CoApp.CoNetMonitor.Acc = response.AccountName; _clearGuest(); _requestLogin(response.AccountName, mPassword); } else if (error != null) { if (error.ErrorCode == UCenterErrorCode.AccountRegisterFailedAlreadyExist) { //FloatMsgInfo f_info; //f_info.msg = "游客帐号转正失败,帐号已存在"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } else { //FloatMsgInfo f_info; //f_info.msg = "游客帐号转正失败"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } } }
//------------------------------------------------------------------------- void _onUCenterRegister(UCenterResponseStatus status, AccountRegisterResponse response, UCenterError error) { //UiHelper.DestroyWaiting(); if (status == UCenterResponseStatus.Success) { //FloatMsgInfo f_info; //f_info.msg = "帐号注册成功"; //f_info.color = Color.green; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); CoApp.CoNetMonitor.AccId = response.AccountId; CoApp.CoNetMonitor.Acc = response.AccountName; _requestLogin(response.AccountName, mPassword); //ClientLoginRequest login_request = new ClientLoginRequest(); //login_request.acc = CoApp.CoNetMonitor.Acc; //login_request.pwd = RegisterPwdCache; //EcEngine.Instance.CoUCenterSDK.login(login_request, _onUCenterLogin); //RegisterPwdCache = null; } else if (error != null) { if (error.ErrorCode == UCenterErrorCode.AccountRegisterFailedAlreadyExist) { //FloatMsgInfo f_info; //f_info.msg = "帐号注册失败,帐号已存在"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } else { //FloatMsgInfo f_info; //f_info.msg = "帐号注册失败"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } } }