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

网站搭建报价单怎么新建一个网站

网站搭建报价单,怎么新建一个网站,山东建设发展研究院网站,外链发布平台有哪些以下内容是根据Unity 2020.1.0f1版本进行编写的   实现一个自定义图集,该怎么入手呢。首先简单思考一下unity是怎么实现图集的。 因为unity的ui部分是开源的,所以我们可以看到UGUI的源代码,另外,Unity的内置Shader也是开源的,可以直接在官网下载(在下载的网页选择Built…以下内容是根据Unity 2020.1.0f1版本进行编写的   实现一个自定义图集,该怎么入手呢。首先简单思考一下unity是怎么实现图集的。 因为unity的ui部分是开源的,所以我们可以看到UGUI的源代码,另外,Unity的内置Shader也是开源的,可以直接在官网下载(在下载的网页选择Built in shaders下载即可):https://unity.com/releases/editor/archive 首先,图集在Unity编辑器中是可编辑的,因此,需要实现一个自定义图集的Inspector面板,并定义好图集的基础属性,方便使用。 1、实现自定义图集类MyAtlas using System.Collections.Generic; using UnityEngine;[CreateAssetMenu(fileName = "MyAtlas", menuName = "My Atlas")] public class MyAtlas : ScriptableObject {public string atlasName = "";public Liststring guids = new Liststring();public Liststring packableObjects = new Liststring();public Liststring realPackObjs = new Liststring();public ListUnityEngine.Object objs = new ListObject(); }首先,定义自定义的图集类MyAtlas,这里只定义Inspector面板需要用到的变量。需要继承ScriptableObject类,否则无法实现自定义类型的后处理导入 其中,atlasName是图集名字,guids是图集包含全部图片的guid,realPackObjs是图集包含全部图片的路径,Objs是显示在Inspector面板的Object,packableObjects是Objs对应的路径,因为有可能是文件夹,所以需要和realPackObjs区分开来。 右键新建一个MyAtlas文件,如上图,这样可以了   2、实现自定义图集类的Inspector面板 using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Security.Cryptography; using UnityEngine;public class CommonFunc : MonoBehaviour {public static void SeachFile(string path, Liststring files, string[] extensions){if (Directory.Exists(path)){DirectoryInfo di = new DirectoryInfo(path);FileSystemInfo[] fsInfos = di.GetFileSystemInfos();bool isSkip;foreach (FileSystemInfo fsInfo in fsInfos){isSkip = true;if (fsInfo is DirectoryInfo){SeachFile(fsInfo.FullName, files, extensions);}if (fsInfo.Name.Contains(".meta")){continue;}foreach (string extension in extensions){if (fsInfo.Name.Contains(extension)){isSkip = false;break;}}if (!isSkip){string fileN = fsInfo.FullName;string ss = "Assets" + fileN.Replace("\\", "/").Replace(Application.dataPath, "");if (!files.Contains(ss)){files.Add(ss);}}}}}public static Liststring GetAllFilesInDirectory(string path, string searchParttern, Liststring list = null, bool isUnityPath = false){if (list == null){list = new Liststring();}var files = Directory.GetFiles(path, searchParttern, SearchOption.AllDirectories);foreach (var file in files){string filePath = file.Replace("\\", "/");if (isUnityPath){filePath = GetUnityPath(filePath);}list.Add(filePath);}return list;}public static string GetMD5Hash(string filePath){MD5 md5 = new MD5CryptoServiceProvider();return BitConverter.ToString(md5.ComputeHash(File.ReadAllBytes(filePath))).Replace("-", "").ToLower();}public static string GetUnityPath(string path){string newPath = path;if (newPath.Contains(Application.dataPath)){newPath = newPath.Replace(Application.dataPath, "Assets");}if (newPath.Contains(Application.dataPath.Replace("/", "\\"))){newPath = newPath.Replace(Application.dataPath.Replace("/", "\\"), "Assets");}if (newPath.Contains(Application.dataPath.Replace("\\", "/"))){newPath = newPath.Replace(Application.dataPath.Replace("\\", "/"), "Assets");}newPath = newPath.Replace("\\", "/");return newPath;}public static string GetSystemPath(string path){string newPath = path;if (newPath.StartsWith("Assets")){newPath = Application.dataPath.Replace("Assets", "") + newPath;}newPath = newPath.Replace("/", "\\");return newPath;}public class Messagebox{[DllImport("User32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)]public static extern int MessageBox(IntPtr handle, String message, String title, int type);} }首先实现一个通用的类CommonFunc,包含一些通用方法,如文件路径转换UnityPath,或者转换为系统路径,等等。 using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEditor.UI; using UnityEditorInternal; using UnityEngine;[
http://www.w-s-a.com/news/635849/

相关文章:

  • 高端手机网站定制网站网络推广推广
  • 做网站的颜色大学网站群建设方案
  • 淄博学校网站建设哪家好网站集约化建设规范
  • 专业论坛网站有哪些如何制作h5页面视频
  • 南京整站优化网站备案负责人一定要法人
  • 北京正规网站建设公司php网站开发实训感想
  • 织梦网站地图怎么做腾讯网站开发语言
  • 站长之家alexa排名wordpress html 标签
  • WordPress建站主机推荐工程公司的经营范围
  • 做网站要注意哪一点网站需求分析的重要
  • 设计作品网站怎么开网站
  • 上海网站开发制作建设网站的建设费用包括
  • 上海网站建设网站开发亚洲杯篮球直播在什么网站
  • 网站做seo第一步h5制作公司
  • 软件外包产业网络优化工程师是干嘛的
  • 怎么用服务器做局域网网站河西网站建设
  • 工业企业网站建设企业门户网站解决方案
  • 网站运营与管理论文网上商城都有哪些
  • 常德网站制作建设毕设电商网站设计
  • 西安企业模板建站福州+网站建设+医疗
  • 邹城市住房和建设局网站仙居网站建设贴吧
  • 为什么要用CGI做网站网站手机优化显示
  • 做袜子娃娃的网站做网站要学的东西
  • 类qq留言网站建设企业做网站公司
  • 如何查到网站建设三足鼎立小程序开发公司
  • 交互网站怎么做的wordpress ssl 错位
  • 公司宣传 如何做公司网站郑州做网站那
  • 衡阳市城乡建设协会官方网站免费游戏网站模板
  • 小程序怎么做优惠券网站合肥建站网站平台
  • 民制作网站价格株洲企业seo优化