Ejemplo n.º 1
0
    public override void PayResultCallBack(string arg)
    {
        base.PayResultCallBack(arg);
        Debug.Log("------------PayResult=" + arg);

        string str = "";

        SFJSONObject sfjson = new SFJSONObject(arg);
        string       type   = (string)sfjson.get("result");
        string       data   = (string)sfjson.get("data");

        if (APaymentHelper.PayResult.PAY_SUCCESS == type)
        {
            str = "pay result = pay success " + data;
        }
        else if (APaymentHelper.PayResult.PAY_FAILURE == type)
        {
            str = "pay result = pay failure" + data;
        }
        else if (APaymentHelper.PayResult.PAY_ORDER_NO == type)
        {
            str = "pay result = pay order No" + data;
        }

        SDKLogManager.DebugLog(str);
    }
Ejemplo n.º 2
0
    public override void ExitGameCallBack(string arg)
    {
        base.ExitGameCallBack(arg);
        //TODO
        Debug.Log("------------ExitResult=" + arg);
        SFJSONObject sfjson = new SFJSONObject(arg);
        string       type   = (string)sfjson.get("result");
        string       data   = (string)sfjson.get("data");

        if (APaymentHelper.ExitResult.SDKEXIT == type)
        {
            //SDK退出
            if (data.Equals("true"))
            {
                Application.Quit();
            }
            else if (data.Equals("false"))
            {
                Debug.Log("------------ExitResult=" + data);
            }
        }
        else if (APaymentHelper.ExitResult.SDKEXIT_NO_PROVIDE == type)
        {
            Debug.Log("------------退出游戏sdk没有退出框:启动游戏自带的退出界面:");
            //游戏自带退出界面
            CallAndroidFunc("ShowExitGameView");

            //Application.Quit();
        }
    }
Ejemplo n.º 3
0
    public override void LoginCallBack(string arg)
    {
        base.LoginCallBack(arg);
        //TODO 登入验证
        Debug.Log("------------loginResult=" + arg);
        string str = "";

        SFJSONObject sfjson = new SFJSONObject(arg);

        string type         = (string)sfjson.get("result");
        string customParams = (string)sfjson.get("customParams");

        if (APaymentHelper.LoginResult.LOGOUT == type)
        {
            str = "login result = logout" + customParams;
            if (onLogoutComplete != null)
            {
                onLogoutComplete(true);
            }
        }
        else if (APaymentHelper.LoginResult.LOGIN_SUCCESS == type)
        {
            SFJSONObject userinfo = (SFJSONObject)sfjson.get("userinfo");
            string       oldchanneluserid;
            currentSDKParmer.TryGetValue("channeluserid", out oldchanneluserid);
            if (userinfo != null && (string)userinfo.get("channeluserid") != oldchanneluserid)
            {
                //long id = long.Parse((string)userinfo.get("id"));
                //string channelId = (string)userinfo.get("channelid");
                //string ChannelUserId = (string)userinfo.get("channeluserid");
                //string UserName = (string)userinfo.get("username");
                //string Token = (string)userinfo.get("token");
                //string ProductCode = (string)userinfo.get("productcode");
                currentSDKParmer["id"]            = (string)userinfo.get("id");            //易接内部 userid,该值可能为 0,请不要以此参数作为判定。
                currentSDKParmer["channelid"]     = (string)userinfo.get("channelid");     //易接平台标示的渠道 SDK ID,
                currentSDKParmer["channeluserid"] = (string)userinfo.get("channeluserid"); //渠道 SDK 标示的用户 ID。
                currentSDKParmer["username"]      = (string)userinfo.get("username");      //渠道 SDK 的用户名称。
                currentSDKParmer["token"]         = (string)userinfo.get("token");         //渠道 SDK 登录完成后的 Session ID。特别提醒:部分渠道此参数会包含特殊值如‘+’,空格之类的,如直接使用 URL 参数传输到游戏服务器请求校验,请使用 URLEncoder 编码
                currentSDKParmer["productcode"]   = (string)userinfo.get("productcode");   //易接平台创建的游戏 ID,appId

                onLoginComplete(true);                                                     //标志登入成功
                str = "login result = login success" + customParams;
            }
            else
            {
                str = "login result = sdk login success , but game loginfailed ~~~~~" + currentSDKParmer["channeluserid"];
            }
        }
        else if (APaymentHelper.LoginResult.LOGIN_FAILED == type)
        {
            str = "login result = login failed" + customParams;
        }

        SDKLogManager.DebugLog(str);
    }
Ejemplo n.º 4
0
    void callback2(string result)
    {
        Debug.Log("------------callback2=" + result);
        SFJSONObject sfjson = new SFJSONObject(result);
        string       tag    = (string)sfjson.get("tag");
        string       value  = (string)sfjson.get("value");

        Debug.Log("tag:" + tag + " value:" + value);
        if (tag.Equals("success"))
        {
            Debug.Log("成功");
        }
        else
        {
            Debug.Log("失败");
        }
    }
Ejemplo n.º 5
0
    // 登陆监听函数
    void LoginResult(string result)
    {
        Debug.Log("------------loginResult=" + result);
        SFJSONObject sfjson       = new SFJSONObject(result);
        string       type         = (string)sfjson.get("result");
        string       customParams = (string)sfjson.get("customParams");

        if (APaymentHelper.LoginResult.LOGOUT == type)
        {
            str  = "login result = logout" + customParams;
            user = null;
            if (!isDebug)
            {
                bLogined = false;
            }
            Invoke("doLogin", 0.2f);
        }
        else if (APaymentHelper.LoginResult.LOGIN_SUCCESS == type)
        {
            SFJSONObject userinfo = (SFJSONObject)sfjson.get("userinfo");
            if (userinfo != null)
            {
                long   id            = long.Parse((string)userinfo.get("id"));
                string channelId     = (string)userinfo.get("channelid");
                string ChannelUserId = (string)userinfo.get("channeluserid");
                string UserName      = (string)userinfo.get("username");
                string Token         = (string)userinfo.get("token");
                string ProductCode   = (string)userinfo.get("productcode");
                user = new SFOnlineUser(id, channelId, ChannelUserId,
                                        UserName, Token, ProductCode);
                Debug.Log("## id:" + id + " channelId:" + channelId + " ChannelUserId:" + ChannelUserId
                          + " UserName:"******" Token:" + Token + " ProductCode:" + ProductCode);
            }

            str = "login result = login success" + customParams;
            LoginCheck();
        }
        else if (APaymentHelper.LoginResult.LOGIN_FAILED == type)
        {
            str = "login result = login failed" + customParams;
        }
    }
Ejemplo n.º 6
0
    // 支付监听函数
    void PayResult(string result)
    {
        Debug.Log("------------PayResult=" + result);
        SFJSONObject sfjson = new SFJSONObject(result);
        string       type   = (string)sfjson.get("result");
        string       data   = (string)sfjson.get("data");

        if (APaymentHelper.PayResult.PAY_SUCCESS == type)
        {
            str = "pay result = pay success " + data;
        }
        else if (APaymentHelper.PayResult.PAY_FAILURE == type)
        {
            str = "pay result = pay failure" + data;
        }
        else if (APaymentHelper.PayResult.PAY_ORDER_NO == type)
        {
            str = "pay result = pay order No" + data;
        }
    }
Ejemplo n.º 7
0
    //ExitResult 退出监听函数
    void ExitResult(string result)
    {
        Debug.Log("------------ExitResult=" + result);
        SFJSONObject sfjson = new SFJSONObject(result);
        string       type   = (string)sfjson.get("result");
        string       data   = (string)sfjson.get("data");

        if (APaymentHelper.ExitResult.SDKEXIT == type)
        {
            //SDK退出
            if (data.Equals("true"))
            {
                Application.Quit();
            }
            else if (data.Equals("false"))
            {
            }
        }
        else if (APaymentHelper.ExitResult.SDKEXIT_NO_PROVIDE == type)
        {
            //游戏自带退出界面
            Application.Quit();
        }
    }