Example #1
0
 public void SelectTwoFAVerificationOption(string option, string value)
 {
     try
     {
         if (option.ToLower().Contains("sms"))
         {
             //Assert.IsFalse(MobileNumText.GetAttribute("value").ToString().Contains(""), "Mobile number cant be blank for regitered user..");
             // MobileNumText.Clear();
             MobileNumText.EnterText(value);
         }
         else if (option.ToLower().Contains("authapp"))
         {
             AuthAppInput.MouseClick();
             GenerateQRCode.MouseClick();
             System.Threading.Thread.Sleep(10000);
         }
         else if (option.ToLower().Contains("email"))
         {
             EmailInput.MouseClick();
             System.Threading.Thread.Sleep(5000);
             EmailAddText.EnterText(value);
         }
     }
     catch (Exception e)
     {
         throw new Exception("Error while entering the text in .." + option + "Error received-" + e.Message);
     }
 }
        private IEnumerator StartShare(int offset)
        {
            yield return(new WaitForEndOfFrame());

            var texture       = TextureHelper.CaptureByRect(new Rect(0, 0, Screen.width, Screen.height));
            var inGameConmfig = _inGameConfig.Read();

            if (inGameConmfig == null)
            {
                _dialogManager.ShowToast("数据发生错误,无法分享T_T", 2, true);
                _analyticManager.Event("game_wx_share_capture_screen_fail");
                yield break;
            }

            var inviteUrl = inGameConmfig.wx_invite_url;

            if (string.IsNullOrEmpty(inviteUrl))
            {
                _dialogManager.ShowToast("数据发生错误,无法分享T_T", 2, true);
                _analyticManager.Event("game_wx_share_capture_screen_fail");
                yield break;
            }

            var qrCodeTexture = GenerateQRCode.GenerateQRCodeTexture2DFromUrl(inviteUrl);

            var startX = Screen.width - offset;
            var startY = Screen.height - offset;

            //融合图片
            TextureHelper.ComposeTwoTexture(texture, qrCodeTexture, startX, startY);

            var bytes = texture.EncodeToPNG();
            var path  = _filePicManager.SavePic(bytes, WechatShareFile);

            if (!string.IsNullOrEmpty(path))
            {
                _dialogManager.ShowDialog <WeChatShareDialog>(DialogName.WeChatShareDialog, false, true,
                                                              (dialog) =>
                {
                    dialog.ApplyData("截图分享", null, null, path, null, null, null);
                    dialog.Show();
                });

                _analyticManager.Event("game_wx_share");
            }
            else
            {
                _dialogManager.ShowToast("截屏失败了T_T", 2, true);
                _analyticManager.Event("game_wx_share_capture_screen_fail");
            }
        }
        public void Apply(RaceAward msg)
        {
            var raceAward = msg;

            if (raceAward == null)
            {
                Reset();
                return;
            }
            RankTxt.text            = "" + raceAward.race_rank;
            ShareRankTxt.text       = "" + raceAward.race_rank;
            RaceNameTxt.text        = raceAward.race_name;
            ShareRaceNameTxt.text   = raceAward.race_name;
            HelpDescriptionTxt.text = raceAward.help;

            if (string.IsNullOrEmpty(raceAward.wx_share_url))
            {
                QrCodeImageBg.SetActive(false);
            }
            else
            {
                var sprite = GenerateQRCode.GenerateQRCodeSpriteFromUrl(raceAward.wx_share_url);
                if (sprite == null)
                {
                    QrCodeImageBg.SetActive(false);
                }
                else
                {
                    ShareQrCodeImage.sprite = sprite;
                    QrCodeImageBg.SetActive(true);
                }
            }

            if (string.IsNullOrEmpty(raceAward.description))
            {
                AwardHongbaoTxt.gameObject.SetActive(false);
                ShareAwardHongbaoTxt.gameObject.SetActive(false);
            }
            else
            {
                AwardHongbaoTxt.text      = raceAward.description;
                ShareAwardHongbaoTxt.text = raceAward.description;
                AwardHongbaoTxt.gameObject.SetActive(true);
                ShareAwardHongbaoTxt.gameObject.SetActive(true);
            }

            if (_currencyList.Count > 0)
            {
                for (var i = 0; i < _currencyList.Count; i++)
                {
                    Destroy(_currencyList[i].gameObject);
                }

                _currencyList.Clear();
            }

            var currencys = raceAward.currency;

            _currency.Clear();

            if (currencys == null || currencys.Count == 0)
            {
                AwardCurrency.SetActive(false);
                ShareAwardCurrency.SetActive(false);
            }
            else
            {
                _currency.AddRange(currencys);
                for (var i = 0; i < currencys.Count; i++)
                {
                    var cur      = _currencyValueFactory.Create();
                    var shareCur = _currencyValueFactory.Create();
                    if (cur)
                    {
                        cur.transform.SetParent(AwardCurrency.transform, false);
                        cur.SetCurrency(currencys[i].count, currencys[i].type);
                        cur.AmountTxt.color = Color.yellow;
                        _currencyList.Add(cur);
                    }
                    if (shareCur)
                    {
                        shareCur.transform.SetParent(ShareAwardCurrency.transform, false);
                        shareCur.SetCurrency(currencys[i].count, currencys[i].type);
                        shareCur.AmountTxt.color = Color.yellow;
                        _currencyList.Add(shareCur);
                    }
                }
                AwardCurrency.SetActive(true);
                ShareAwardCurrency.SetActive(true);
            }

            var user = raceAward.user;

            if (user == null)
            {
                HeadIcon.Reset();
                ShareNickname.text = "";
            }
            else
            {
                ShareNickname.text = user.nickname;
                if (string.IsNullOrEmpty(user.headicon_url))
                {
                    HeadIcon.gameObject.SetActive(false);
                }
                else
                {
                    HeadIcon.SetTargetPic(HeadIconPic(user), null, user.headicon_url);
                }
            }
        }