/** *@brief methods for reflections *@param function name *@param GameParam param *@return void */ public void callFuncWithParam(string functionName, GameParam param) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS) List <GameParam> list = new List <GameParam> (); list.Add(param); GameCrash_nativeCallFuncWithParam(functionName, list.ToArray(), list.Count); #else Debug.Log("This platform does not support!"); #endif }
/** *@brief methods for reflections *@param function name *@param GameParam param *@return string */ public bool callBoolFuncWithParam(string functionName, GameParam param) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS) List <GameParam> list = new List <GameParam> (); list.Add(param); return(GameAnalytics_nativeCallBoolFuncWithParam(functionName, list.ToArray(), list.Count)); #else Debug.Log("This platform does not support!"); return(false); #endif }
/** *@brief methods for reflections *@param function name *@param GameParam param *@return float */ public float callFloatFuncWithParam(string functionName, GameParam param) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS) List <GameParam> list = new List <GameParam> (); list.Add(param); return(GameAdTracking_nativeCallFloatFuncWithParam(functionName, list.ToArray(), list.Count)); #else Debug.Log("This platform does not support!"); return(0); #endif }
/** *@brief methods for reflections *@param function name *@param GameParam param *@param pluginid *@return int */ public int callIntFuncWithParam(string functionName, GameParam param, string pluginId = "") { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS) List <GameParam> list = new List <GameParam> (); list.Add(param); return(GameIAP_nativeCallIntFuncWithParam(functionName, list.ToArray(), list.Count, pluginId)); #else Debug.Log("This platform does not support!"); return(-1); #endif }
/** *@brief methods for reflections *@param function name *@param List<GameParam> param *@return string */ public string callStringFuncWithParam(string functionName, GameParam param) { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS) List <GameParam> list = new List <GameParam> (); list.Add(param); StringBuilder value = new StringBuilder(); value.Capacity = GameUtil.MAX_CAPACITY_NUM; GameCrash_nativeCallStringFuncWithParam(functionName, list.ToArray(), list.Count, value); return(value.ToString()); #else Debug.Log("This platform does not support!"); return(""); #endif }
void UserExternalCall(string msg) { Dictionary <string, string> dic = GameUtil.stringToDictionary(msg); int code = Convert.ToInt32(dic["code"]); string result = dic["msg"]; ClientLog.Instance.Log("UserExternalCall( code: " + +code + " result: " + result + ")"); switch (code) { case (int)UserActionResultCode.kInitSuccess: //初始化SDK成功回调 if (string.IsNullOrEmpty(GlobalValue.channelID)) { GlobalValue.channelID = game.Game.getInstance().getChannelId(); } // string custom = game.Game.getInstance().getCustomParam(); // if(!string.IsNullOrEmpty(custom)) // { // string[] centerAndcdnAddr = custom.Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries); // if(centerAndcdnAddr.Length == 2) // { // GlobalValue.centerservhost = centerAndcdnAddr[0]; // GlobalValue.cdnservhost = string.Format("{0}/{1}/", centerAndcdnAddr[1], XyskAndroidAPI.getPackageVersion()); // Debug.Log(GlobalValue.cdnservhost); // } // } if (GlobalValue.IsDebugMode) { CommonEvent.OnAppPause -= OnAppPause; CommonEvent.OnAppResume -= OnAppResume; CommonEvent.OnAccountChange -= OnAccountChange; //Login regist logout CommonEvent.OnQuestFinish -= OnQuestFinish; CommonEvent.OnQuestFail -= OnQuestFail; CommonEvent.OnQuestStart -= OnQuestStart; CommonEvent.OnException -= OnException; CommonEvent.OnPurchase -= OnPurchase; CommonEvent.OnUseItem -= OnUseItem; CommonEvent.OnRewardVirtualCash -= OnRewardVirtualCash; } _SdkInitSuccess = true; TransferRate._Inst.Send("Init SDK End Success"); break; case (int)UserActionResultCode.kInitFail: //初始化SDK失败回调 ApplicationEntry.Instance.PostSocketErr(1234); TransferRate._Inst.Send("Init SDK End Failed"); break; case (int)UserActionResultCode.kLoginSuccess: //登陆成功回调 GameManager.Instance.loginInfo_ = new COM_LoginInfo(); GameManager.Instance.loginInfo_.username_ = GameUser.getInstance().getPluginId() + "=" + GameUser.getInstance().getUserID(); // GameManager.Instance.loginInfo_.username_ = GameUser.getInstance().getUserID(); GameManager.Instance.loginInfo_.password_ = Application.platform.ToString(); GameManager.Instance.loginInfo_.version_ = Configure.VersionNumber; GameManager.Instance._Account = GameManager.Instance.loginInfo_.username_; GameManager.Instance.loginInfo_.sessionkey_ = Configure.Sessionkey; #if UNITY_IOS || UNITY_IPHONE GameManager.Instance.loginInfo_.idfa_ = XyskIOSAPI.GetIDFA(); #elif UNITY_ANDROID GameManager.Instance.loginInfo_.mac_ = XyskAndroidAPI.getMacAndroid(); #endif game.GameParam param = new game.GameParam((int)game.ToolBarPlace.kToolBarMidRight); if (game.GameUser.getInstance().isFunctionSupported("showToolBar")) { game.GameUser.getInstance().callFuncWithParam("showToolBar", param); } CommonEvent.ExcuteAccountChange(CommonEvent.DefineAccountOperate.REGISTER); TransferRate._Inst.Send("Login SDK End Success"); break; case (int)UserActionResultCode.kLoginNetworkError: //登陆网络出错回调 case (int)UserActionResultCode.kLoginFail: //登陆失败回调 ApplicationEntry.Instance.PostSocketErr(2345); TransferRate._Inst.Send("Login SDK End Failed"); break; case (int)UserActionResultCode.kLoginCancel://登陆取消回调 break; case (int)UserActionResultCode.kLogoutSuccess: //登出成功回调 if (StageMgr.Loading) { StageMgr.OnSceneLoaded += SceneLoaded; } else if (!string.IsNullOrEmpty(StageMgr.Scene_name) && !StageMgr.Scene_name.Equals(GlobalValue.StageName_ReLoginScene)) { ApplicationEntry.Instance.PostSocketErr(2333); } break; case (int)UserActionResultCode.kLogoutFail: //登出失败回调 break; case (int)UserActionResultCode.kPlatformEnter: //平台中心进入回调 break; case (int)UserActionResultCode.kPlatformBack: //平台中心退出回调 break; case (int)UserActionResultCode.kPausePage: //暂停界面回调 break; case (int)UserActionResultCode.kExitPage: //退出游戏回调 CommonEvent.ExcuteAccountChange(CommonEvent.DefineAccountOperate.LOGOUT); Application.Quit(); break; case (int)UserActionResultCode.kAntiAddictionQuery: //防沉迷查询回调 break; case (int)UserActionResultCode.kRealNameRegister: //实名注册回调 break; case (int)UserActionResultCode.kAccountSwitchSuccess: //切换账号成功回调 if (StageMgr.Loading) { StageMgr.OnSceneLoaded += SceneLoaded; } else if (!string.IsNullOrEmpty(StageMgr.Scene_name) && !StageMgr.Scene_name.Equals(GlobalValue.StageName_ReLoginScene)) { ApplicationEntry.Instance.PostSocketErr(2333); } else { game.GameUser.getInstance().login(); } break; case (int)UserActionResultCode.kAccountSwitchFail: //切换账号成功回调 GameUser.getInstance().login(); break; default: break; } CommonEvent.ExcuteUserExternal(code); }