当前位置: 首页 > news >正文

广东网站设计招工.免费咨询贷款

广东网站设计招工.,免费咨询贷款,网站接口需求,seo网站系统截图参考#xff1a;Unity3D 局部截图、全屏截图、带UI截图三种方法_unity 截图_野区捕龙为宠的博客-CSDN博客 文档下载#xff1a; Unity WebGL 生成doc保存到本地电脑_unity webgl 保存文件_野区捕龙为宠的博客-CSDN博客 中文输入#xff1a;Unity WebGL中文输入 支持输…截图参考Unity3D 局部截图、全屏截图、带UI截图三种方法_unity 截图_野区捕龙为宠的博客-CSDN博客 文档下载 Unity WebGL 生成doc保存到本地电脑_unity webgl 保存文件_野区捕龙为宠的博客-CSDN博客 中文输入Unity WebGL中文输入 支持输入法跟随 支持全屏内附Dome_unity中文插件-CSDN博客  1.调用代码 private void Awake(){ //点击提交下载 按钮Btn_download.onClick.AddListener(() {Btn_download.gameObject.SetActive(value: false);GetComponentCapture_Long().Cap_LongTex();//截图拼图 //下载PDFGetComponentCapture_Long().CapCallBack ((png_byte) {string filename CQOOC.Instance.userName _ DateTime.Now.ToString(g);Btn_download.gameObject.SetActive(true);Application.ExternalCall(downloadPng, png_byte, filename);//调用 webgl 方法// Debug.Log(filename filename);}); //上传 截图GetComponentCapture_Long().CapByteCallBack ((png_byte) {string filename CQOOC.Instance.userName _ DateTime.Now.ToString(g);Debug.Log(filename filename);//上传实验报告 截图CQOOC.Instance.UploadFile(png_byte, filename.png, ((b) {if (b){Debug.Log(上传截图成功);}else{Debug.Log(上传截图失败);}}));//上传实验报告 数据CQOOC.Instance.UploadData_((b) {if (b){UITipDialogMini.Instance.SetState(true, 提交数据成功);}else{UITipDialogMini.Instance.SetState(true, 提交数据失败);}});});});DateTime now DateTime.Now.AddMinutes(-15);string formattedTime now.ToString(yyyy 年 M 月 d 日 HH:mm:ss);text_StartTime.text formattedTime;DateTime now02 DateTime.Now;string formattedTime02 now02.ToString(yyyy 年 M 月 d 日 HH:mm:ss);text_EndTime.text formattedTime02;// text_StartTime.text DateTime.Now.AddMinutes(-15).ToString(F);//text_EndTime.text DateTime.Now.ToString(F);text_UserName.text CQOOC.Instance.userName;text_Score.text UnityEngine.Random.Range(80f, 95f).ToString(0);} 2.截图 拼图 代码 using System; using System.Collections; using UnityEngine; using UnityEngine.UI;public class Capture_Long : MonoBehaviour {public RectTransform svrt;public RectTransform contentRT;public Actionstring CapCallBack;public Actionbyte[] CapByteCallBack;public Vector2 vec;/// summary/// 接长图进行拼接/// /summary/// param nameSVRTScroll Rect/param/// param nameContentRTContent/parampublic void Cap_LongTex(){StartCoroutine(Cap(svrt, contentRT));}private IEnumerator Cap(RectTransform SVRT, RectTransform ContentRT){//画布中的高度 950float SV_Y SVRT.sizeDelta.y;//content显示的区域高度 0float Content_Y ContentRT.anchoredPosition.y;//图片的整体高度 2660float Content_Height contentRT.sizeDelta.y SV_Y;var mult (float)(Content_Height / SV_Y);//整数倍int mult_int (int)mult;//最后的小数倍float mult_float mult - mult_int;//滚动条的宽度float verticalScrollbar_weight SVRT.GetComponentScrollRect().verticalScrollbar.GetComponentRectTransform().sizeDelta.x;yield return new WaitForEndOfFrame();//合成图片的总高度int totalHeight (int)Content_Height;Texture2D endTex new Texture2D((int)vec.y, totalHeight, TextureFormat.RGBA32, false);int x 0, y 0;Color32[] colors;//整数倍的截图for (int i 0; i mult_int; i){ContentRT.anchoredPosition new Vector2(0, SV_Y * i);yield return new WaitForEndOfFrame();//Rect rect_int new Rect(Screen.width / 2 - SVRT.sizeDelta.x / 2 SVRT.anchoredPosition.x, Screen.height / 2 - SVRT.sizeDelta.y / 2 SVRT.anchoredPosition.y, SVRT.sizeDelta.x - verticalScrollbar_weight, SVRT.sizeDelta.y);//Rect rect_int new Rect(420, 166.5f, 1365, SVRT.sizeDelta.y);Rect rect_int new Rect(420, vec.x, vec.y, SVRT.sizeDelta.y);var tex_int CaptureScreenshot(rect_int, i );//合成colors tex_int.GetPixels32(0);if (i 0){y - tex_int.height;}else{y totalHeight - tex_int.height;}endTex.SetPixels32(x, y, tex_int.width, tex_int.height, colors);}//小数倍的截图ContentRT.anchoredPosition new Vector2(0, SV_Y * (mult - 1));yield return new WaitForEndOfFrame();//Rect rect_float new Rect(Screen.width / 2 - SVRT.sizeDelta.x / 2 SVRT.anchoredPosition.x, Screen.height / 2 - SVRT.sizeDelta.y / 2 SVRT.anchoredPosition.y, SVRT.sizeDelta.x - verticalScrollbar_weight, SVRT.sizeDelta.y * mult_float);Rect rect_float new Rect(420, vec.x, vec.y, SVRT.sizeDelta.y * mult_float);var tex_float CaptureScreenshot(rect_float, end);//合成colors tex_float.GetPixels32(0);y - tex_float.height;endTex.SetPixels32(x, y, tex_float.width, tex_float.height, colors);endTex.Apply();byte[] bytes endTex.EncodeToPNG();//然后将这些纹理数据成一个png图片文件var strPng Convert.ToBase64String(bytes);#if UNITY_EDITORstring filename Application.dataPath /PNG/合成.png;System.IO.File.WriteAllBytes(filename, bytes);Debug.Log(string.Format(截屏了一张图片: {0}, filename)); #endifSVRT.GetComponentScrollRect().verticalNormalizedPosition 1;CapCallBack?.Invoke(strPng);CapByteCallBack?.Invoke(bytes);}/// summary/// 开始截图/// /summary/// returnsThe screenshot2./returns/// param namerectRect.截图的区域左下角为o点/paramprivate Texture2D CaptureScreenshot(Rect rect, string name){//Debug.Log(rect.ToString());Texture2D screenShot new Texture2D((int)rect.width, (int)rect.height, TextureFormat.RGBA32, false);//先创建一个的空纹理大小可根据实现需要来设置screenShot.ReadPixels(rect, 0, 0);//读取屏幕像素信息并存储为纹理数据screenShot.Apply();#if UNITY_EDITORbyte[] bytes screenShot.EncodeToPNG();//然后将这些纹理数据成一个png图片文件string filename Application.dataPath /PNG/Screenshot name .png;System.IO.File.WriteAllBytes(filename, bytes);//Debug.Log(string.Format(截屏了一张图片: {0}, filename)); #endifreturn screenShot;} } 3.web端代码 !DOCTYPE html html langen-usheadmeta charsetutf-8meta http-equivContent-Type contenttext/html; charsetutf-8titleXiaoLuoDai/titlelink relshortcut icon hrefTemplateData/favicon.icolink relstylesheet hrefTemplateData/style.cssscript srcTemplateData/UnityProgress.js/scriptscript srcBuild/UnityLoader.js/scriptscriptvar unityInstance UnityLoader.instantiate(unityContainer, Build/WebGL.json, {onProgress: UnityProgress});function GetWebGLURI(){unityInstance.SendMessage(CQOOC, GetURI_CallBack, window.location.href);}/scriptscript srchttps://cdn.bootcss.com/jspdf/1.3.4/jspdf.debug.js/scriptscriptfunction downloadPng(base64, filename) {var baseData data:image/png;base64, base64///// 获取图片文件的宽高///let image new Image();image.src baseData;image.onload function () {console.log(image.width, image.height);var contentWidth image.width;var contentHeight image.height;//一页pdf显示html页面生成的canvas高度;var pageHeight contentWidth / 592.28 * 841.89;//未生成pdf的html页面高度var leftHeight contentHeight;//页面偏移var position 0;//a4纸的尺寸[595.28,841.89]html页面生成的canvas在pdf中图片的宽高var imgWidth 595.28;var imgHeight 592.28 / contentWidth * contentHeight;//有两个高度需要区分一个是html页面的实际高度和生成pdf的页面高度(841.89)//当内容未超过pdf一页显示的范围无需分页var pdf new jsPDF(, pt, a4);if (leftHeight pageHeight) {pdf.addImage(baseData, PNG, 0, 0, imgWidth, imgHeight);} else {while (leftHeight 0) {pdf.addImage(baseData, PNG, 0, position, imgWidth, imgHeight)leftHeight - pageHeight;position - 841.89;//避免添加空白页if (leftHeight 0) {pdf.addPage();}}}pdf.save(filename .pdf)}}/script scriptfunction FullScreenMetthod()//中文输入{document.getElementById(unityContainer).requestFullscreen();}/script/headbodydiv classwebgl-contentdiv idunityContainer stylewidth: 1920px; height: 1080px/divdiv classfooterdiv classwebgl-logo/divdiv classfullscreen onclickFullScreenMetthod()/divdiv classtitleXiaoLuoDai/div/div/div/body /html
http://www.w-s-a.com/news/378826/

相关文章:

  • 做试题网站在线做c 题的网站
  • 青岛发现51例阳性南京专业网站优化公司
  • 南昌建站如何上wordpress
  • 洛阳网站建设优惠公司建筑企业上市公司有哪些
  • 营销型网站建设营销型网站建设手机网站设计需要学什么
  • 在线视频网站 一级做爰片南通网站建设找哪家
  • 网站优化文章东莞专业网站建设价钱
  • 哈尔滨网页设计网站模板泰兴建设局网站
  • 响应式网站设计公司报纸做垂直门户网站
  • 陕西旭泽建设有限公司网站企业网站建设软件需求分析
  • 上海公司网站建设方案中企动力西安分公司
  • dedecms网站后台怎样才能上百度
  • 云互联的网站名字亚马逊雨林生物
  • 电商网站功能企查查企业信息查询网
  • 特色网站建设中国住房和城乡建设局官网
  • 长春市住房城乡建设厅网站做白酒网站
  • 自己的网站怎么做的成品免费ppt网站
  • 番禺区网站建设哪里有泰安公司
  • 网站制作详细过程网站开发最强工具
  • 孟村县做网站长春城投建设投资有限公司网站
  • 国家重大建设项目库网站wordpress安装 var
  • 供求信息网站建设报价网站制作 苏州
  • 动漫建模代做网站百度一下wordpress nginx 固定链接
  • 广州网站开发网络公司网站建设的书
  • php手机网站开发教程家政网站怎么做
  • 视频网站的建设预算通信科技网站设计
  • 糖果网站建设策划书淘宝客网站开源
  • 建站公司还有前途吗cf网站编程
  • 网站建设需求确认表建站工具 比较
  • 刚建设的网站多久能在百度查到考试系统 微网站是什么样的