示例#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
    }
示例#2
0
    //更新手机基本信息
    IEnumerator UpdataBasicInfoData()
    {
        while (true)
        {
            float batteryLevel = 0.0f;
#if UNITY_ANDROID && !UNITY_EDITOR
            batteryLevel  = AlipayWeChatPay.GetAndroidActivity().Call <int>("GetBatteryLevel");
            batteryLevel /= 100.0f;
#endif

#if UNITY_IOS && !UNITY_EDITOR
            batteryLevel = WechatPlatfrom_IOS.GetBatteryLevel();
#endif
            //电池电量
            if (BatteryIcon)
            {
                BatteryIcon.fillAmount = batteryLevel;
            }

            //时间
            if (TimeText)
            {
                TimeText.text = System.DateTime.Now.Hour.ToString("D2") + ":"
                                + System.DateTime.Now.Minute.ToString("D2")
                                + (ShowSecond ? (":" + System.DateTime.Now.Second.ToString("D2")) : "");
            }
            yield return(new WaitForSeconds(ShowSecond ? 1f : 5f));
        }
    }
示例#3
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
    }
示例#4
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);
    }
示例#5
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
    }
示例#6
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);
        }
    }
示例#7
0
    /// <summary>
    /// 检查版本号,与服务器资源进行版本号比对
    /// </summary>
    public void CheckVersionUpdate()
    {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
        if (!UpdateWithLuncher)
        {
            eLuancherState = LUANCHERSTATE.LuancherState_VerifyMD5;
            return;
        }
#endif

        //读取服务器资源及程序版本号
        LoadServerResVersionConfig();

#if ScFish
        eLuancherState = LUANCHERSTATE.LuancherState_StartGame;
        return;
#endif
        if (string.IsNullOrEmpty(m_SvrResVerStr))
        {
            DownloadProcessUpdatetextObj.GetComponent <Text>().text = "连接异常,请检查网络...";
            DownloadProcessUpdatetextObj.SetActive(true);
            return;
        }

        //IOS 检测下程序是否需要更新,需要 则提示跳转app store
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            if (m_SvrAppVerStr.CompareTo(Application.version) != 0)
            {
                DownloadProcessUpdatetextObj.GetComponent <Text>().text = "请至AppStore更新APP...";
                DownloadProcessUpdatetextObj.SetActive(true);
                eLuancherState = LUANCHERSTATE.LuancherState_Over;

#if UNITY_IOS
                WechatPlatfrom_IOS.ShowAppUpdateTips("itms-apps://itunes.apple.com/cn/app/qiu-qiu-dou-di-zhu/id1319175293?mt=8");
#endif
                return;
            }
        }

        //bool bNeedUpdate = false;

        //读取本地资源版本
        string localResVerStr = ReadLocalResConfig();

#if ScFish
        //ScFish游戏下不需要解压资源包
        bAppFirstRun = false;
#endif
        //首次运行解压包里的资源,更新资源

        if (bAppFirstRun)
        {
            eLuancherState = LUANCHERSTATE.LuancherState_UnZip;
            DownloadProcessUpdatetextObj.GetComponent <Text>().text = "正在解压游戏资源(此过程不消耗流量)";
            Debug.Log("unzip processs start-------:");
            bAppFirstRun = false;
            FirstRunAppUnzipAssetbundle();
            //bNeedUpdate = true;
        }
        else
        {
            if (m_SvrResVerStr.CompareTo(localResVerStr) != 0)
            {
                //bNeedUpdate = true;
                WriteLocalResConfig();
                DownHotfixAndSerABCsvFile();
            }
            ResourceUpdateVerify();
        }
    }