Beispiel #1
0
    /// <summary>
    /// 分享URL到微信
    /// </summary>
    /// <param name="bTimeline"></param>
    public static void ShareURLToWechat(string urlstr, string descpstr, bool bTimeline = true)
    {
        if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor)
        {
            return;
        }

#if UNITY_ANDROID
        if (AlipayWeChatPay.IsWxAppInstalled())
        {
            AlipayWeChatPay.WeChat_ShareURL(urlstr, descpstr, bTimeline);
        }
        else
        {
            //还末安装微信失败处理
            CRollTextUI.Instance.AddVerticalRollText(1010);
        }
#endif

#if UNITY_IOS
        if (WechatPlatfrom_IOS.WeChat_IsWXAppInstalled())
        {
            WechatPlatfrom_IOS.WeChat_ShareURL(urlstr, descpstr, bTimeline);
        }
        else
        {
            //还末安装微信失败处理
            CRollTextUI.Instance.AddVerticalRollText(1010);
        }
#endif
    }
Beispiel #2
0
    /// <summary>
    /// 分享当前屏幕截图区域到微信
    /// </summary>
    /// <param name="bTimeline"></param>
    public static void ShareImageRectToWechat(Canvas cans, RectTransform rect, bool bTimeline = true)
    {
        if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor)
        {
            return;
        }

#if UNITY_ANDROID
        if (AlipayWeChatPay.IsWxAppInstalled())
        {
            AlipayWeChatPay.WeChat_ShareRectImage(cans, rect, bTimeline);
        }
        else
        {
            //还末安装微信失败处理
            CRollTextUI.Instance.AddVerticalRollText(1010);
        }
#endif

#if UNITY_IOS
        if (WechatPlatfrom_IOS.WeChat_IsWXAppInstalled())
        {
            WechatPlatfrom_IOS.WeChat_ShareRectImage(cans, rect, bTimeline);
        }
        else
        {
            //还末安装微信失败处理
            CRollTextUI.Instance.AddVerticalRollText(1010);
        }
#endif
    }
Beispiel #3
0
    //玩家支付订单信息处理
    private bool PlayerTradeAppPayInfo(uint msgType, UMessage umsg)
    {
        uint   playerid     = umsg.ReadUInt();
        byte   payplatform  = umsg.ReadByte();
        string paytradeInfo = umsg.ReadString();

        Debug.Log("玩家:" + playerid + "订单:" + paytradeInfo);

        //订单信息过来后就可以关闭购买等待框了
        BuyEnd();

        if (payplatform == (byte)PayPlatform.AliPay)
        {
#if UNITY_ANDROID
            AlipayWeChatPay.RequestAliPay(paytradeInfo, false);
#elif UNITY_IOS
            WechatPlatfrom_IOS.MayunJieZhang_IOS(paytradeInfo);
#endif
        }
        else if (payplatform == (byte)PayPlatform.Wechat)
        {
            string noncestr = umsg.ReadString();
#if UNITY_ANDROID
            if (AlipayWeChatPay.IsWxAppInstalled())
            {
                AlipayWeChatPay.ReqWxPay(paytradeInfo, noncestr);
            }
            else
            {
                //还末安装微信失败处理
                // BuyEnd();
                CCustomDialog.OpenCustomConfirmUI(1010);
            }
#elif UNITY_IOS
            if (WechatPlatfrom_IOS.WeChat_IsWXAppInstalled())
            {
                WechatPlatfrom_IOS.WXLgoinJieZhang_IOS(paytradeInfo, noncestr);
            }
            else
            {
                //还末安装微信失败处理
                //BuyEnd();
                CCustomDialog.OpenCustomConfirmUI(1010);
            }
#endif
        }
        else if (payplatform == (byte)PayPlatform.vvPay_Wechat || payplatform == (byte)PayPlatform.vvPay_Alipay)
        {
            Application.OpenURL(paytradeInfo);
        }

        return(true);
    }
Beispiel #4
0
    /// <summary>
    /// 首次登陆 选择登陆方式
    /// </summary>
    public void LoadChooseLoginType()
    {
        if (CanvasObj == null)
        {
            CanvasObj = GameObject.Find("Canvas/Root");
        }
        InitLoginUIBtnEvent();
#if !ScFish
        //CanvasObj.transform.FindChild("Main_Loading").FindChild("ImageStripBG").gameObject.SetActive(false);
        CanvasObj.transform.Find("Login").gameObject.SetActive(true);
        CanvasObj.transform.Find("Login/Panel_PhoneLogin").gameObject.SetActive(false);
        GameObject loginPanel = CanvasObj.transform.Find("Login").Find("Panel_Login").gameObject;
        loginPanel.SetActive(true);
#endif
        //window平台下启用启用微信扫码登录

#if UNITY_STANDALONE_WIN && !UNITY_EDITOR && !WINDOWS_GUEST
#if !ScFish
        loginPanel.SetActive(false);
#endif
        RequestLogin(LoginType.LoginTyee_WechatQRCode);
#elif UNITY_EDITOR || (UNITY_STANDALONE_WIN && WINDOWS_GUEST)
        RequestLogin();
#else
        //ios 审核版本下要显示游客登陆按钮
        if (Luancher.IsReviewVersion && Application.platform == RuntimePlatform.IPhonePlayer)
        {
#if !ScFish
            loginPanel.transform.Find("Button_TouristLogin").gameObject.SetActive(true);
#endif
            //审核版本下微信未安装直接不显示微信登陆按钮(以免审核人员以登陆不应依赖第三方应用拒绝)

#if UNITY_IOS && !UNITY_EDITOR
            if (!WechatPlatfrom_IOS.WeChat_IsWXAppInstalled())
            {
                loginPanel.transform.FindChild("Button_PhoneLogin").gameObject.SetActive(false);
            }
#endif
        }
#endif

#if !ScFish
        CanvasObj.transform.Find("Login/Toggle_agreement").gameObject.SetActive(true);
        CanvasObj.transform.Find("Login/Panel_Login/Button_PhoneLogin").gameObject.SetActive(false);
#endif
        //切换账号把VisitorAccountId设置为0,避免切换账号登陆上次角色

#if !UNITY_EDITOR
        VisitorAccountId = 0;
#endif
    }
Beispiel #5
0
    /// <summary>
    /// 手机登陆
    /// </summary>
    void OnBtn_PhoneLogin(EventTriggerType eventtype, object button, PointerEventData eventData)
    {
        if (eventtype == EventTriggerType.PointerClick)
        {
            CustomAudio.GetInstance().PlayCustomAudio(1002);
            if (CanvasObj == null)
            {
                CanvasObj = GameObject.Find("Canvas/Root");
            }



#if UNITY_IOS && !UNITY_EDITOR
            if (WechatPlatfrom_IOS.WeChat_IsWXAppInstalled())
            {
                WechatPlatfrom_IOS.WeChat_AuthLogin();
            }
            else
            {
                //还末安装微信失败处理
                CRollTextUI.Instance.AddVerticalRollText(1010);
            }
#elif UNITY_ANDROID && !UNITY_EDITOR
            if (AlipayWeChatPay.IsWxAppInstalled())
            {
                AlipayWeChatPay.ReqWxLoginAuth();
            }
            else
            {
                //还末安装微信失败处理
                CRollTextUI.Instance.AddVerticalRollText(1010);
            }
#elif UNITY_EDITOR || UNITY_STANDALONE_WIN
            //WeChatAuthLogin();
            RequestLogin();
#endif
            return;

            CanvasObj.transform.Find("Login").Find("Panel_Login").gameObject.SetActive(false);

            GameObject PhonePanel = CanvasObj.transform.Find("Login").Find("Panel_PhoneLogin").gameObject;

            //返回按钮
            GameObject btnreturn = PhonePanel.transform.Find("Button_Return").gameObject;
            btnreturn.GetComponent <Image>().raycastTarget = true;
            btnreturn.GetComponent <Button>().interactable = true;

            //获取验证码按钮
            GameObject codeBtn = PhonePanel.transform.Find("Button_GetCode").gameObject;
            codeBtn.GetComponent <Image>().raycastTarget = true;
            codeBtn.GetComponent <Button>().interactable = true;
            Text strCode = codeBtn.transform.Find("Text_GetCode").gameObject.GetComponent <Text>();
            strCode.text = "获取验证码";

            //登陆按钮
            GameObject loginBtn = PhonePanel.transform.Find("Button_FinishLogin").gameObject;
            loginBtn.GetComponent <Image>().raycastTarget = true;
            loginBtn.GetComponent <Button>().interactable = true;

            PhonePanel.transform.Find("InputField_PhoneNum").gameObject.GetComponent <InputField>().text = "";
            PhonePanel.transform.Find("InputField_Code").gameObject.GetComponent <InputField>().text     = "";

            PhonePanel.SetActive(true);

            XPointEvent.AutoAddListener(codeBtn, OnBtn_GetCode, null);
            XPointEvent.AutoAddListener(loginBtn, OnBtn_StartPhoneLogin, null);
            XPointEvent.AutoAddListener(btnreturn, OnBtn_ReturnChooseType, null);
        }
    }