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"); } }