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

设计制作一个 个人主页网站事业单位网站建设费入什么科目

设计制作一个 个人主页网站,事业单位网站建设费入什么科目,商城网站建设系统,网页设计与网站建设是干嘛的关键词#xff1a;UnityEditor、可视化节点编辑、Unity编辑器自定义窗口工具 使用Newtonsoft.Json、UnityEditor相关接口实现 主要代码#xff1a; Handles.DrawBezier(起点#xff0c;终点#xff0c;起点切线向量#xff0c;终点切线向量#xff0c;颜色#xff0c;n…关键词UnityEditor、可视化节点编辑、Unity编辑器自定义窗口工具  使用Newtonsoft.Json、UnityEditor相关接口实现 主要代码 Handles.DrawBezier(起点终点起点切线向量终点切线向量颜色null, 线粗度) 绘制贝塞尔曲线 Handles.DrawAAPolyLine(线粗度顶点1, 顶点2, ...) 根据线段点绘制不规则线段 GUI.Window(id, rect, DrawNodeWindow, 窗口标题);   void DrawNodeWindow(int id) 传入的id即GUI.Window第一个参数一般传节点唯一标识ID。 LinkObj类是节点类里面有一个位置pos数据是存储该节点窗口位于编辑器的位置SerializableVector2类型是一个可被Json序列化的Vector2不然无法被序列化。 using Newtonsoft.Json; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEngine;public class LinkObj {public int id;public Listint preList;public Listint nextList;public SerializableVector2 pos;//位于编辑窗口的位置public LinkObj(int _id, SerializableVector2 _pos){id _id;pos _pos;preList new Listint();nextList new Listint();} }public static class PathConfig {public static string SaveJsonPath Application.dataPath /MyGraphicsEditorDemo/Editor/LinkList.json; }public class MyGraphicsEditorWindow : EditorWindow {private Dictionaryint, LinkObj linkObjDict new Dictionaryint, LinkObj();private int tempAddId;private Vector2 scrollViewPos;private Dictionaryint, Rect linkObjRectDict new Dictionaryint, Rect();private LinkObj currentSelectLinkObj;private Color defaultColor;private Vector2 detailScrollViewPos;private bool isLoaded;[MenuItem(Tools/可视链结构编辑器)]private static void ShowWindow(){Debug.Log(打开可视链结构编辑器);var window EditorWindow.GetWindow(typeof(MyGraphicsEditorWindow)) as MyGraphicsEditorWindow;window.minSize new Vector2(1280, 500);window.Show(true);window.isLoaded false;}MyGraphicsEditorWindow(){this.titleContent new GUIContent(可视链结构编辑器);}private void OnGUI(){defaultColor GUI.color;EditorGUILayout.BeginHorizontal(GUILayout.Width(position.width), GUILayout.Height(position.height));{//左面板操作EditorGUILayout.BeginVertical(GUILayout.Width(80));{EditorGUILayout.BeginHorizontal();{if (GUILayout.Button(加载)){//如果本地没有对应的json 文件重新创建if (File.Exists(PathConfig.SaveJsonPath)){string json File.ReadAllText(PathConfig.SaveJsonPath);linkObjDict JsonConvert.DeserializeObjectDictionaryint, LinkObj(json);if (linkObjDict null){linkObjDict new Dictionaryint, LinkObj();}isLoaded true;}else{isLoaded false;Debug.LogError(加载失败,尚未存在json文件: PathConfig.SaveJsonPath);}}bool isExistFile File.Exists(PathConfig.SaveJsonPath);if ((isLoaded || !isExistFile) GUILayout.Button(保存)){//如果本地没有对应的json 文件重新创建if (!isExistFile){File.Create(PathConfig.SaveJsonPath);}AssetDatabase.Refresh();string json JsonConvert.SerializeObject(linkObjDict);File.WriteAllText(PathConfig.SaveJsonPath, json);Debug.Log(保存成功: json);AssetDatabase.SaveAssets();}}EditorGUILayout.EndHorizontal();EditorGUILayout.BeginVertical();{if (GUILayout.Button(添加节点)){LinkObj obj new LinkObj(tempAddId, new SerializableVector2(scrollViewPos));if (!linkObjDict.ContainsKey(tempAddId)){linkObjDict.Add(tempAddId, obj);}else{Debug.LogError(节点ID已存在: tempAddId);}}tempAddId int.Parse(EditorGUILayout.TextField(节点ID, tempAddId.ToString()));}EditorGUILayout.EndVertical();}EditorGUILayout.EndVertical();//中间面板可视节点EditorGUILayout.BeginVertical(GUILayout.Width(position.width - 500));{EditorGUILayout.LabelField(string.Format(所有链节点), EditorStyles.boldLabel);EditorGUILayout.BeginHorizontal(box, GUILayout.Height(position.height));{scrollViewPos EditorGUILayout.BeginScrollView(scrollViewPos, GUILayout.Height(position.height));{BeginWindows();if (linkObjDict ! null linkObjDict.Count 0){foreach (var item in linkObjDict){int id item.Key;var linkObj item.Value;Rect oRect;if (!linkObjRectDict.TryGetValue(id, out oRect)){Rect windowRect new Rect(180, 50, 180, 100);windowRect.x linkObj.pos.x;windowRect.y linkObj.pos.y;linkObjRectDict.Add(id, windowRect);}string str string.Format({0}-[节点], id);if (currentSelectLinkObj ! null currentSelectLinkObj.id id)GUI.color Color.yellow;else if (currentSelectLinkObj ! null currentSelectLinkObj.preList.Exists((int x) x id))GUI.color Color.blue;else if (currentSelectLinkObj ! null currentSelectLinkObj.nextList.Exists((int x) x id))GUI.color Color.green;//绘画窗口linkObjRectDict[id] GUI.Window(id, linkObjRectDict[id], DrawNodeWindow, str);GUI.color defaultColor;foreach (int nextId in linkObj.nextList){Rect nextRect;if (linkObjRectDict.TryGetValue(nextId, out nextRect)){DrawNodeCurve(linkObjRectDict[id], nextRect, Color.red);}}}}EndWindows();}EditorGUILayout.EndScrollView();}EditorGUILayout.EndHorizontal();}EditorGUILayout.EndVertical();//右面板编辑选中节点EditorGUILayout.BeginVertical(GUILayout.Width(250));{EditorGUILayout.LabelField(节点属性, EditorStyles.boldLabel);EditorGUILayout.BeginHorizontal(box, GUILayout.Height(position.height));{EditorGUILayout.BeginVertical();{detailScrollViewPos EditorGUILayout.BeginScrollView(detailScrollViewPos, GUILayout.Height(position.height));{if (currentSelectLinkObj ! null){DrawCurrentLinkObj();}}EditorGUILayout.EndScrollView();}EditorGUILayout.EndVertical();}EditorGUILayout.EndHorizontal();}EditorGUILayout.EndVertical();}EditorGUILayout.EndHorizontal();}//绘画窗口函数private void DrawNodeWindow(int id){EditorGUILayout.LabelField(string.Format(节点ID:{0}, linkObjDict[id].id), EditorStyles.boldLabel);EditorGUILayout.BeginHorizontal();{//创建一个GUI Buttonif (GUILayout.Button(选择)){currentSelectLinkObj linkObjDict[id];}GUI.color Color.red;if (GUILayout.Button(删除)){if (EditorUtility.DisplayDialog(询问, 确认删除?, 确认, 取消)){linkObjDict.Remove(id);linkObjRectDict.Remove(id);return;}}GUI.color defaultColor;}EditorGUILayout.EndHorizontal();//设置改窗口可以拖动GUI.DragWindow();var oItem linkObjDict[id];Rect oRect;if (oItem ! null linkObjRectDict.TryGetValue(id, out oRect)){oItem.pos new SerializableVector2(linkObjRectDict[id].position);}}//***描绘连线private void DrawNodeCurve(Rect start, Rect end, Color color, float fValue 4){//根据不同相对位置决定线条的起点和终点 (看似复杂,实际简单,可优化写法)float startX, startY, endX, endY;//start左 end右时, 起点是start右侧中点, 终点是end左侧中点if (start.x end.x Mathf.Abs(start.x start.width / 2 - end.x - end.width / 2) 50){ startX start.x start.width; endX end.x; startY start.y start.height / 2; endY end.y end.height / 2; }//start右 end左时, 起点是start左侧中点, 终点是end右侧中点else if (start.x end.x Mathf.Abs(start.x start.width / 2 - end.x - end.width / 2) 50){ startX start.x; endX end.x end.width; startY start.y start.height / 2; endY end.y end.height / 2; }else{//start上 end下时, 起点是start下侧中点, 终点是end上侧中点if (start.y end.y){ startX start.x start.width / 2; startY start.y; endX end.x end.width / 2; endY end.y end.height; }//start下 end上时, 起点是start上侧中点, 终点是end下侧中点else{ startX start.x start.width / 2; startY start.y start.height; endX end.x end.width / 2; endY end.y; }}Vector3 startPos new Vector3(startX, startY, 0);Vector3 endPos new Vector3(endX, endY, 0);//根据起点和终点偏向给出不同朝向的Tan切线Vector3 startTan, endTan;if (start.x end.x){startTan startPos Vector3.right * 50;endTan endPos Vector3.left * 50;}else{startTan startPos Vector3.left * 50;endTan endPos Vector3.right * 50;}//绘制线条 color颜色 fValue控制粗细Handles.DrawBezier(startPos, endPos, startTan, endTan, color, null, fValue);//绘制线条终点的2条斜线 形成箭头Handles.color color;Vector2 to endPos;Vector2 v1, v2;//与上方大同小异,根据相对位置得出不同的箭头线段点if (start.x end.x Mathf.Abs(start.x start.width / 2 - end.x - end.width / 2) 50){v1 new Vector2(-8f, 8f);v2 new Vector2(-8f, -8f);}else if (start.x end.x Mathf.Abs(start.x start.width / 2 - end.x - end.width / 2) 50){v1 new Vector2(8f, 8f);v2 new Vector2(8f, -8f);}else{if (start.y end.y){v1 new Vector2(-8f, 8f);v2 new Vector2(8f, 8f);}else{v1 new Vector2(-8f, -8f);v2 new Vector2(8f, -8f);}}//fValue粗细绘制由3个点构成的线段形成箭头Handles.DrawAAPolyLine(fValue, to v1, to, to v2);}// 当前选中节点详情编辑页面private void DrawCurrentLinkObj(){EditorGUILayout.LabelField(string.Format(节点ID{0}, currentSelectLinkObj.id), EditorStyles.boldLabel);EditorGUILayout.Space(10);EditorGUILayout.LabelField(下一个节点);DrawListMember(currentSelectLinkObj.nextList);EditorGUILayout.Space(10);EditorGUILayout.LabelField(上一个节点);DrawListMember(currentSelectLinkObj.preList);}//列表显示private void DrawListMember(Listint lst, bool isOnlyRead false){EditorGUILayout.BeginVertical();{if (lst.Count ! 0){for (int i 0; i lst.Count; i){EditorGUILayout.BeginHorizontal();{GUILayout.Label((i 1).ToString(), GUILayout.Width(25));lst[i] EditorGUILayout.IntField(lst[i]);GUI.color Color.red;if (GUILayout.Button(-, GUILayout.Width(30))){lst.RemoveAt(i);}GUI.color defaultColor;}EditorGUILayout.EndHorizontal();}}if (GUILayout.Button()){lst.Add(lst.Count);}EditorGUILayout.EndVertical();}} }using Newtonsoft.Json; using System.Collections.Generic; using UnityEngine;[System.Serializable] public class SerializableVector2 {public float x;public float y;[JsonIgnore]public Vector2 UnityVector{get{return new Vector2(x, y);}}public SerializableVector2(Vector2 v){x v.x;y v.y;}public static ListSerializableVector2 GetSerializableList(ListVector2 vList){ListSerializableVector2 list new ListSerializableVector2(vList.Count);for (int i 0; i vList.Count; i){list.Add(new SerializableVector2(vList[i]));}return list;}public static ListVector2 GetSerializableList(ListSerializableVector2 vList){ListVector2 list new ListVector2(vList.Count);for (int i 0; i vList.Count; i){list.Add(vList[i].UnityVector);}return list;} }
http://www.hkea.cn/news/14452217/

相关文章:

  • 电子商务网站建设和管理基于asp网站开发 论文
  • 网站域名解析登陆域名购买成功后怎么做网站
  • 中国建设银行员工学习网站公众号怎么制作红包封面
  • 杭州营销网站制作网站的搭建需要多少钱
  • 重庆转店铺哪个网站平台好网站上传百度多久收录
  • 阿里云网站简单建设wordpress友情链接样式
  • 如何免费注册网站平台做网站要多长时间
  • 做网站需学什么条件建设一个网站可以采用那几方案
  • 网站建设 服务器 预算报价清单wordpress首页显示栏目分类
  • 石家庄营销型网站建设公司华为公司邮箱
  • 做驾校题目用什么网站好文字设计图片在线生成
  • 2015微信网站设计陕西网站建设的目的
  • 服务器和网站空间外汇平台 网站开发
  • 个旧云锡建设集团网站h5教程
  • 公司做完网站怎么搜不到沛县互助网站开发
  • 哪里有网站源文件下载青海城乡住房和建设厅网站
  • 微小店网站建设比较好贵州省城市建设厅网站
  • 贵州省省建设厅网站手机在线ps照片处理
  • wordpress 搬站谷歌网址
  • 环保局网站建设 自查报告医院网站建设与管理ppt
  • 企业网站备案注销建设部网站被黑
  • icp ip 网站备案查询系统wordpress改变链接地址
  • 深圳做网站的公司软件工程师招聘
  • 国外网站卖货平台南京做网站南京乐识专心
  • 做网站寄生虫需要哪些东西做网站视频学什么专业
  • c mvc网站做404黄页88网在线
  • 缪斯设计网站10g空间网站做视频网站
  • 常州网站推母婴网站这么做
  • 17网站一起做网店好不好wordpress这
  • 医院网站asp源码久久建筑有限公司