Example #1
0
 /// <summary>
 /// MSDK init,游戏关闭的时候调用
 /// </summary>
 public static void UnInstall()
 {
     MSDKLogin.UnInstall();
     MSDKLog.Log("MSDK UnInstall");
 }
Example #2
0
        private static void ParaseDelegate(object arg)
        {
            var argsWrapper = (RetArgsWrapper)arg;
            var methodId    = argsWrapper.MethodId;
            var json        = argsWrapper.RetJson;

            MSDKLog.Log("the methodId is ( " + methodId + " ) and json=\n " + json);
            var className  = "";
            var methodName = "";

            switch (methodId)
            {
            case (int)MSDKMethodNameID.MSDK_LOGIN_AUTOLOGIN:
            case (int)MSDKMethodNameID.MSDK_LOGIN_LOGIN:
            case (int)MSDKMethodNameID.MSDK_LOGIN_BIND:
            case (int)MSDKMethodNameID.MSDK_LOGIN_GETLOGINRESULT:
            case (int)MSDKMethodNameID.MSDK_LOGIN_SWITCHUSER:
            case (int)MSDKMethodNameID.MSDK_LOGIN_QUERYUSERINFO:
            case (int)MSDKMethodNameID.MSDK_LOGIN_LOGINWITHCONFIRMCODE:
            case (int)MSDKMethodNameID.MSDK_LOGIN_LOGINUI:
            case (int)MSDKMethodNameID.MSDK_LOGIN_BINDUI:
                className  = "GCloud.MSDK.MSDKLogin";
                methodName = "OnLoginRet";
                MSDKLogin.OnLoginRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_LOGIN_CONNECT:
            case (int)MSDKMethodNameID.MSDK_LOGIN_GETCONNECTRESULT:
                className  = "GCloud.MSDK.MSDKLogin";
                methodName = "OnConnectRet";
                MSDKLogin.OnConnectRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_LOGIN_LOGOUT:
            case (int)MSDKMethodNameID.MSDK_LOGIN_WAKEUP:
            case (int)MSDKMethodNameID.MSDK_LOGIN_SCHEME:
            case (int)MSDKMethodNameID.MSDK_LOGIN_RESETGUEST:
                className  = "GCloud.MSDK.MSDKLogin";
                methodName = "OnLoginBaseRet";
                MSDKLogin.OnLoginBaseRet(json);
                break;

#if GCLOUD_MSDK_WINDOWS
            case (int)MSDKMethodNameID.MSDK_LOGIN_QRCODE:
                className  = "GCloud.MSDK.MSDKLogin";
                methodName = "OnQrCodeRet";
                MSDKLogin.OnQrCodeRet(json);
                break;
#else
            /// account
            case (int)MSDKMethodNameID.MSDK_ACCOUNT_VERIFY_CODE:
            case (int)MSDKMethodNameID.MSDK_ACCOUNT_RESET_PASSWORD:
            case (int)MSDKMethodNameID.MSDK_ACCOUNT_MODIFY:
            case (int)MSDKMethodNameID.MSDK_ACCOUNT_REGISTER_STATUS:
            case (int)MSDKMethodNameID.MSDK_ACCOUNT_VERIFY_CODE_STATUS:
                className  = "GCloud.MSDK.MSDKAccount";
                methodName = "OnAccountRet";
                MSDKAccount.OnAccountRet(json);
                break;

            /// friend
            case (int)MSDKMethodNameID.MSDK_FRIEND_SHARE:
            case (int)MSDKMethodNameID.MSDK_FRIEND_SEND_MESSAGE:
            case (int)MSDKMethodNameID.MSDK_FRIEND_ADD_FRIEND:
                className  = "GCloud.MSDK.MSDKFriend";
                methodName = "OnFriendMessage";
                MSDKFriend.OnFriendMessage(json);
                break;

            case (int)MSDKMethodNameID.MSDK_FRIEND_QUERY_FRIEND:
                className  = "GCloud.MSDK.MSDKFriend";
                methodName = "OnFriendQueryFriend";
                MSDKFriend.OnFriendQueryFriend(json);
                break;

            //group
            case (int)MSDKMethodNameID.MSDK_GROUP_CREATE:
            case (int)MSDKMethodNameID.MSDK_GROUP_BIND:
            case (int)MSDKMethodNameID.MSDK_GROUP_GET_GROUP_LIST:
            case (int)MSDKMethodNameID.MSDK_GROUP_GET_GROUP_STATE:
            case (int)MSDKMethodNameID.MSDK_GROUP_JOIN:
            case (int)MSDKMethodNameID.MSDK_GROUP_UNBIND:
            case (int)MSDKMethodNameID.MSDK_GROUP_REMIND_TO_BIND:
            case (int)MSDKMethodNameID.MSDK_GROUP_SEND_GROUP_MESSAGE:
            case (int)MSDKMethodNameID.MSDK_GROUP_GET_GROUP_RELATION:
                className  = "GCloud.MSDK.MSDKGroup";
                methodName = "OnGroupRet";
                MSDKGroup.OnGroupRet(json);
                break;

            // webview
            case (int)MSDKMethodNameID.MSDK_WEBVIEW_CLOSE:
            case (int)MSDKMethodNameID.MSDK_WEBVIEW_GET_ENCODE_URL:
            case (int)MSDKMethodNameID.MSDK_WEBVIEW_JS_CALL:
            case (int)MSDKMethodNameID.MSDK_WEBVIEW_JS_SHARE:
            case (int)MSDKMethodNameID.MSDK_WEBVIEW_JS_SEND_MESSAGE:
                className  = "GCloud.MSDK.MSDKWebView";
                methodName = "OnWebViewRet";
                MSDKWebView.OnWebViewRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_PUSH_REGISTER_PUSH:
            case (int)MSDKMethodNameID.MSDK_PUSH_UNREGISTER_PUSH:
            case (int)MSDKMethodNameID.MSDK_PUSH_SET_TAG:
            case (int)MSDKMethodNameID.MSDK_PUSH_DELETE_TAG:
            case (int)MSDKMethodNameID.MSDK_PUSH_SET_ACCOUNT:
            case (int)MSDKMethodNameID.MSDK_PUSH_DELETE_ACCOUNT:
                className  = "GCloud.MSDK.MSDKPush";
                methodName = "OnPushBaseRet";
                MSDKPush.OnPushBaseRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_PUSH_ADD_LOCAL_NOTIFICATION:
            case (int)MSDKMethodNameID.MSDK_PUSH_CLEAR_LOCAL_NOTIFICATION:
            case (int)MSDKMethodNameID.MSDK_PUSH_NOTIFICAITON_CALLBACK:
            case (int)MSDKMethodNameID.MSDK_PUSH_NOTIFICATION_SHOW:
            case (int)MSDKMethodNameID.MSDK_PUSH_NOTIFICATION_CLICK:
                className  = "GCloud.MSDK.MSDKPush";
                methodName = "OnPushRet";
                MSDKPush.OnPushRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_NOTICE_LOAD_DATA:
                className  = "GCloud.MSDK.MSDKNotice";
                methodName = "OnNoticeRet";
                MSDKNotice.OnNoticeRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_GAME_SETUP:
            case (int)MSDKMethodNameID.MSDK_GAME_SHOW_LEADER_BOARD:
            case (int)MSDKMethodNameID.MSDK_GAME_SET_SCORE:
            case (int)MSDKMethodNameID.MSDK_GAME_SHOW_ACHIEVEMENT:
            case (int)MSDKMethodNameID.MSDK_GAME_UNLOCK_ACHIEVE:
                className  = "GCloud.MSDK.MSDKGame";
                methodName = "OnGameRet";
                MSDKGame.OnGameRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_TOOLS_FREE_FLOW:
                className  = "GCloud.MSDK.MSDKTools";
                methodName = "OnToolsFreeFlowRet";
                MSDKTools.OnToolsFreeFlowRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_TOOLS_OPEN_DEEPLINK:
                className  = "GCloud.MSDK.MSDKTools";
                methodName = "OnToolsRet";
                MSDKTools.OnToolsRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_EXTEND:
                className  = "GCloud.MSDK.MSDKExtend";
                methodName = "OnExtendRet";
                MSDKExtend.OnExtendRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_LBS_GETIPINFO:
                className  = "GCloud.MSDK.MSDKLBS";
                methodName = "OnLBSIPInfoRet";
                MSDKLBS.OnLBSIPInfoRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_LBS_GETLOCATION:
                className  = "GCloud.MSDK.MSDKLBS";
                methodName = "OnLBSLocationRet";
                MSDKLBS.OnLBSLocationRet(json);
                break;

            case (int)MSDKMethodNameID.MSDK_LBS_GETNEARBY:
                className  = "GCloud.MSDK.MSDKLBS";
                methodName = "OnLBSRelationRet";
                MSDKLBS.OnLBSRelationRet(json);
                break;

            case (int)MSDKMethodNameID.MSKD_LBS_CLEARLOCATION:
                className  = "GCloud.MSDK.MSDKLBS";
                methodName = "OnLBSBaseRet";
                MSDKLBS.OnLBSBaseRet(json);
                break;
#endif
            }

#if USING_ITOP
            className = className.Replace("MSDK", "ITOP");
            MSDKLog.Log("className=" + className + "  methodName=" + methodName);

            if (string.IsNullOrEmpty(className) || string.IsNullOrEmpty(methodName))
            {
                MSDKLog.LogError("something wrong with the plugins, className = " + className + "  methodName = " + methodName);
                return;
            }
            try {
                var assembly = Assembly.GetExecutingAssembly();
                var type     = assembly.GetType(className, true, true);
                if (type != null)
                {
                    var methodInfo = type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static, null, new [] { typeof(string) }, null);
                    if (methodInfo != null)
                    {
                        methodInfo.Invoke(null, new object [] { json });
                    }
                    else
                    {
                        MSDKLog.LogError("cannot get this method, methodName=" + methodName);
                    }
                }
                else
                {
                    MSDKLog.LogError("current className is wrong,className=" + className);
                }
            } catch (Exception e) {
                MSDKLog.LogError("call method error\n" + e.StackTrace);
            }
#endif
        }