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

多用户商城系统哪里有seo引擎搜索网址

多用户商城系统哪里有,seo引擎搜索网址,沉默是金,h5响应式网站公司使用Unity编辑器扩展技术实现快速截图功能 效果: 里面没有什么太难的技术,直接上源码吧 注意!代码需要放在Editor文件下才能正常运行 using System; using UnityEditor; using UnityEngine;[ExecuteInEditMode] public class Screenshot …

使用Unity编辑器扩展技术实现快速截图功能

效果:请添加图片描述

里面没有什么太难的技术,直接上源码吧

  • 注意!代码需要放在Editor文件下才能正常运行
using System;
using UnityEditor;
using UnityEngine;[ExecuteInEditMode]
public class Screenshot : EditorWindow
{int MaxShowSelectGo = 5;//最多显示选中的物体int resWidth = Screen.width * 4;int resHeight = Screen.height * 4;public Camera myCamera;int scale = 1;float delayCreateTime = 0.5f;string path = "";bool showPreview = true;RenderTexture renderTexture;GameObject[] selectGOs;bool isTransparent = true;bool isCaptureMultiple = false;// Add menu item named "My Window" to the Window menu[MenuItem("Tools/图片生成器")]public static void ShowWindow(){//Show existing window instance. If one doesn't exist, make one.EditorWindow editorWindow = EditorWindow.GetWindow(typeof(Screenshot));editorWindow.autoRepaintOnSceneChange = true;editorWindow.Show();editorWindow.title = "图片生成器";}float lastTime;void OnGUI(){EditorGUILayout.LabelField("分辨率", EditorStyles.boldLabel);resWidth = EditorGUILayout.IntField("宽", resWidth);resHeight = EditorGUILayout.IntField("高", resHeight);EditorGUILayout.Space();EditorGUILayout.BeginHorizontal();EditorGUILayout.LabelField("默认设置", EditorStyles.boldLabel);if (GUILayout.Button("使用Game视图的分辨率")){resHeight = (int)Handles.GetMainGameViewSize().y;resWidth = (int)Handles.GetMainGameViewSize().x;}if (GUILayout.Button("使用默认大小。H:1440,W:2560")){resHeight = 1440;resWidth = 2560;scale = 1;}EditorGUILayout.EndHorizontal();EditorGUILayout.Space();scale = EditorGUILayout.IntSlider("尺寸", scale, 1, 15);EditorGUILayout.HelpBox("截图的默认模式是裁剪,所以选择合适的宽度和高度。比例是在不损失质量的情况下倍增或放大渲染的一个因素.", MessageType.None);EditorGUILayout.Space();EditorGUILayout.LabelField("截图分辨率为 " + resWidth * scale + " x " + resHeight * scale + " p", EditorStyles.boldLabel);EditorGUILayout.Space();EditorGUILayout.BeginHorizontal();GUILayout.Label("选择相机", EditorStyles.boldLabel);myCamera = EditorGUILayout.ObjectField(myCamera, typeof(Camera), true, null) as Camera;if (myCamera == null) myCamera = Camera.main;if (myCamera != null) myCamera.clearFlags = CameraClearFlags.SolidColor;isTransparent = EditorGUILayout.Toggle("透明背景", isTransparent);EditorGUILayout.EndHorizontal();EditorGUILayout.HelpBox("选择要捕捉渲染的相机。勾选则背景透明", MessageType.None);EditorGUILayout.Space();isCaptureMultiple = EditorGUILayout.Toggle("一次性捕捉多个物体", isCaptureMultiple);if (isCaptureMultiple){selectGOs = Selection.gameObjects;GUILayout.Label((selectGOs.Length == 0 ? "你还什么都没有选。使用鼠标选中场景中的物体,用Shift或者Ctrl多选。" : "当前选择物体数量:"+ selectGOs.Length), EditorStyles.boldLabel);int ShowSelectGo = 0;foreach (var item in selectGOs){if (ShowSelectGo>=MaxShowSelectGo&& MaxShowSelectGo < selectGOs.Length){GUILayout.Label("......", EditorStyles.boldLabel);break;}GUILayout.Label(item.name, EditorStyles.boldLabel);ShowSelectGo++;}}EditorGUILayout.Space();GUILayout.Label("保存路径", EditorStyles.boldLabel);EditorGUILayout.BeginHorizontal();EditorGUILayout.TextField(path, GUILayout.ExpandWidth(false));if (GUILayout.Button("选择路径", GUILayout.ExpandWidth(false)))path = EditorUtility.SaveFolderPanel("保存图片的路径", path, Application.dataPath);EditorGUILayout.EndHorizontal();EditorGUILayout.HelpBox("选择保存屏幕截图的文件夹", MessageType.None);EditorGUILayout.Space();delayCreateTime = EditorGUILayout.Slider("延时生成时间", delayCreateTime, 0.5f, 5);EditorGUILayout.HelpBox("请注意!时间越短,生成图片出错的概率就越高。建议调整为1", MessageType.None);if (GUILayout.Button("生成", GUILayout.MinHeight(60))){if (path == "") path = EditorUtility.SaveFolderPanel("保存图片的路径", path, Application.dataPath);if (isCaptureMultiple){StartTakeHiResShot();}else{TakeHiResShot();Application.OpenURL("file://" + path);}}EditorGUILayout.Space();EditorGUILayout.BeginHorizontal();if (GUILayout.Button("打开最后一个截图", GUILayout.MaxWidth(160), GUILayout.MinHeight(40))){if (lastScreenshot != ""){Application.OpenURL("file://" + lastScreenshot);Debug.Log("Opening File " + lastScreenshot);}}if (GUILayout.Button("打开截图文件夹", GUILayout.MaxWidth(100), GUILayout.MinHeight(40))){Application.OpenURL("file://" + path);}EditorGUILayout.EndHorizontal();}GameObject go = null;void StartTakeHiResShot(){if (selectGOs.Length==0){EditorUtility.DisplayDialog("提示", "请注意!你没有选择任何物体,这不会生成图片。\n\n请取消勾选'一次性捕捉多个物体'这个选项生成单张图片.", "确定");return;}foreach (var item in selectGOs){item.SetActive(false);}go = null;Take(0,0);//Take(0);}void Take(int index,float delayTime){if (index < selectGOs.Length){if (go != null) go.SetActive(false);selectGOs[index].SetActive(true);go = selectGOs[index];if (delayTime > delayCreateTime){delayTime = 0;TakeHiResShot();index++;}EditorApplication.delayCall += () => { Take(index, delayTime + 0.1f); };}else{Application.OpenURL("file://" + path);}}void Take(int index){if (index < selectGOs.Length){if (go != null) go.SetActive(false);selectGOs[index].SetActive(true);go = selectGOs[index];//EditorApplication.delayCall += () =>//{//    TakeHiResShot(() => { Take(index + 1); });//};TakeHiResShot(() =>{Take(index + 1);});}else{Application.OpenURL("file://" + path);}}//private bool takeHiResShot = false;public string lastScreenshot = "";public string ScreenShotName(int width, int height){string strPath = "";strPath = string.Format("{0}/screen_{1}x{2}_{3}.png",path,width, height,System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));lastScreenshot = strPath;return strPath;}public void TakeHiResShot(Action Callback= null){Debug.Log("采取截图");int resWidthN = resWidth * scale;int resHeightN = resHeight * scale;RenderTexture rt = new RenderTexture(resWidthN, resHeightN, 24);myCamera.targetTexture = rt;TextureFormat tFormat;if (isTransparent)tFormat = TextureFormat.ARGB32;elsetFormat = TextureFormat.RGB24;Texture2D screenShot = new Texture2D(resWidthN, resHeightN, tFormat, false);myCamera.Render();RenderTexture.active = rt;screenShot.ReadPixels(new Rect(0, 0, resWidthN, resHeightN), 0, 0);myCamera.targetTexture = null;RenderTexture.active = null;byte[] bytes = screenShot.EncodeToPNG();string filename = ScreenShotName(resWidthN, resHeightN);System.IO.File.WriteAllBytes(filename, bytes);Debug.Log(string.Format("截图如下: {0}", filename));//Application.OpenURL(filename);Callback?.Invoke();}
}

点击下载Demo

http://www.ds6.com.cn/news/34586.html

相关文章:

  • 网站开发知识版权推推蛙seo顾问
  • 获取文章内容 wordpressgoogle关键词seo
  • 在线diy网站国内最新消息新闻
  • 建立企业网站的缺点网络seo
  • 做58一样的网站百度官网电话客服24小时
  • 外币信用卡怎么做网站上用全网营销推广方式
  • 国外网站设计模板如何利用seo赚钱
  • 网站建设制作确认单百度前三推广
  • 卓越建站快车网站推广网络营销方案
  • php做网站软件百度推广代理商
  • 广州网站建设业务谷歌手机版浏览器官网
  • 做一个网站一般费用汕头seo推广外包
  • python 网站开发实例上海百度推广电话客服
  • 动态网站语言排名轻松seo 网站
  • 用dedecms做的网站北京整站线上推广优化
  • html5手机app网站模板微信营销技巧
  • 杭州市网站建设阳江seo
  • 网站建设 视频sem推广竞价托管
  • 做空港币人民币网站上海关键词seo
  • 收到网站打入0.1元怎么做分录百度投放广告收费标准
  • 怎样做金融网站营销型网站建设案例
  • 做网站挣钱么站长之家域名信息查询
  • 推荐昆明做网站建设黄山seo推广
  • 长安外贸网站建设太原关键词优化报价
  • idea怎么做网站南宁在哪里推广网站
  • 做网站用jsp还是html网推怎么做
  • 关于建筑设计的网站广告营销包括哪些方面
  • 微信网页宣传网站怎么做打开百度一下你就知道
  • 做自己的网站发表文章后怎么能让钱赚到手是不是点击率高就可以有收入?请高人指教!感激涕零!网络营销有哪些方式
  • 做网站宽高怎么决定网站系统