/// <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 }
/// <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 }
//玩家支付订单信息处理 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); }
/// <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); } }