예제 #1
0
파일: Test.cs 프로젝트: benbon/Sample_Unity
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
     {
         Application.Quit();
         AnySDK.getInstance().release();
     }
 }
예제 #2
0
 private void RestartGame()
 {
     if (GlobalSettings.isLoginByAnySDK)
     {
         InitSDK.instance.SetAnySDKExtData("4");
         AnySDK.getInstance().release();
     }
     GlobalObject.ReStartGame();
 }
예제 #3
0
 public void Init()
 {
     Debug.Log("InitAnySDK  init");
     AnySDK.getInstance().init(this.appKey, this.appSecret, this.privateKey, this.oauthLoginServer);
     Debug.Log("InitAnySDK  setListener");
     this.anySDKUser = AnySDKUser.getInstance();
     this.anySDKUser.setListener(this, "UserExternalCall");
     this.anySDKIAP = AnySDKIAP.getInstance();
     this.anySDKIAP.setListener(this, "IAPExternalCall");
 }
예제 #4
0
        public void Init()
        {
            var appKey           = _configHolder.AnySDKAppKey;
            var appSecret        = _configHolder.AnySDKAppSecret;
            var privateKey       = _configHolder.AnySDKPrivateKey;
            var oauthLoginServer = _configHolder.OauthLoginServer;

            AnySDK.getInstance().init(appKey, appSecret, privateKey, oauthLoginServer);
            AnySDKUser.getInstance().setListener(this, "UserExternalCall");
            AnySDKIAP.getInstance().setListener(this, "IAPExternalCall");
        }
예제 #5
0
    public static void Init()
    {
        if (!IsInitialized)
        {
            GameObject obj = new GameObject();
            manager = obj.AddComponent <MINIAnySDKManager>();
//			manager = new MINIAnySDKManager();
            AnySDK.getInstance().init(appKey, appSecret, privateKey, oauthLoginServer);
            AnySDKUser.getInstance().setListener(manager, "UserExternalCall");
            AnySDKIAP.getInstance().setListener(manager, "IAPExternalCall");
            IsInitialized = true;
        }
    }
 private void ExitCall(bool isConfirm)
 {
     if (isConfirm)
     {
         if (GlobalSettings.isLoginByAnySDK)
         {
             InitSDK.instance.SetAnySDKExtData("4");
             AnySDK.getInstance().release();
         }
         if (Application.platform == RuntimePlatform.IPhonePlayer)
         {
             GlobalObject.ReStartGame();
         }
         else
         {
             GlobalObject.QuitApp();
         }
     }
 }
예제 #7
0
파일: Test.cs 프로젝트: benbon/Sample_Unity
 void Start()
 {
     Init.getInstance();
     Debug.Log("getCustomParam" + AnySDK.getInstance().getCustomParam());
     Debug.Log("getChannelId" + AnySDK.getInstance().getChannelId());
 }
예제 #8
0
파일: Init.cs 프로젝트: benbon/Sample_Unity
 Init()
 {
     AnySDK.getInstance().init(appKey, appSecret, privateKey, oauthLoginServer);
 }
예제 #9
0
 public void SDKLoginFail()
 {
     UIEventListener.Get(this.mask.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnClickMask);
     this.mask.gameObject.SetActive(true);
     this.WarnText.gameObject.SetActive(true);
     if (GlobalSettings.isLoginByAnySDK && InitAnySDK.getInstance().anySDKUser.isLogined() && Singleton <LoginView_New> .Instance.gameObject != null && Singleton <LoginView_New> .Instance.gameObject.active)
     {
         this.mask.gameObject.SetActive(false);
         this.coroutineManager.StartCoroutine(InitSDK.instance.TryLoginByChannelId(AnySDK.getInstance().getChannelId(), InitAnySDK.getInstance().anySDKUser.getUserID()), true);
     }
 }
예제 #10
0
    public void UserExternalCall(string msg)
    {
        Debug.Log("UserExternalCall(" + msg + ")");
        Dictionary <string, string> dictionary = AnySDKUtil.stringToDictionary(msg);
        int    num  = Convert.ToInt32(dictionary["code"]);
        string text = dictionary["msg"];

        switch (num)
        {
        case 0:
            InitSDK.instance.isInit = true;
            if (InitSDK.instance.needLogin)
            {
                NetWorkHelper.Instance.GateReconnection.LeaveGame("leave");
                this.login();
            }
            else
            {
                LoginStateManager.Instance.ChangeState(LoginStateCode.LoginState_Init);
            }
            InitSDK.instance.needLogin = false;
            break;

        case 1:
            InitSDK.instance.isInit = false;
            Debug.Log("InitAnySDK init fail");
            CtrlManager.ShowMsgBox("初始化失败", "是否进行重试?", new Action <bool>(this.AgainCall), PopViewType.PopOneButton, "确定", "取消", null);
            break;

        case 2:
            GlobalObject.Instance.SetCanPause(true);
            this.coroutineManager.StartCoroutine(InitSDK.instance.TryLoginByChannelId(AnySDK.getInstance().getChannelId(), this.anySDKUser.getUserID()), true);
            break;

        case 3:
        case 5:
        case 6:
            Singleton <LoginView_New> .Instance.SDKLoginFail();

            if (Singleton <NewWaitingView> .Instance.IsOpen)
            {
                Singleton <NewWaitingView> .Instance.Destroy();
            }
            break;

        case 7:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号登出", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 8:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号登出失败", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 9:
            NetWorkHelper.Instance.GateReconnection.LeaveGame("leave");
            break;

        case 10:
            if (Singleton <NewWaitingView> .Instance.IsOpen && Singleton <NewWaitingView> .Instance.gameObject != null)
            {
                Singleton <NewWaitingView> .Instance.Destroy();
            }
            break;

        case 12:
            if (msg == "onGameExit" || msg == "onNo3rdExiterProvide")
            {
                CtrlManager.ShowMsgBox("确认退出", "确定退出刺激好玩的《魔霸英雄》吗?", new Action <bool>(this.ExitCall), PopViewType.PopTwoButton, "确定", "取消", null);
            }
            else
            {
                this.ExitCall(true);
            }
            break;

        case 15:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
                this.coroutineManager.StartCoroutine(InitSDK.instance.TryLoginByChannelId(AnySDK.getInstance().getChannelId(), this.anySDKUser.getUserID()), true);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号切换成功", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 16:
            if (Singleton <AreaView> .Instance.gameObject != null && Singleton <AreaView> .Instance.gameObject.active)
            {
                MobaMessageManagerTools.SendClientMsg(ClientV2C.AreaViewNew_goback, null, false);
            }
            else
            {
                CtrlManager.ShowMsgBox("账号切换失败", "重新登陆", new Action <bool>(this.ExitCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            break;

        case 17:
            NetWorkHelper.Instance.GateReconnection.LeaveGame("leave");
            break;

        case 19:
            CtrlManager.ShowMsgBox("确认退出", "确定退出刺激好玩的《魔霸英雄》吗?", new Action <bool>(this.ExitCall), PopViewType.PopTwoButton, "确定", "取消", null);
            break;
        }
    }
예제 #11
0
 private void AgainCall(bool obj)
 {
     AnySDK.getInstance().init(this.appKey, this.appSecret, this.privateKey, this.oauthLoginServer);
 }