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

济南网站建设报价网站推广的全过程

济南网站建设报价,网站推广的全过程,网页设计网站大全,wordpress邮件验证评论[导读]最近.....废话不多说上效果图用的是UGUI我先说思路通过判断元素的位置信息来改变Hierarchy的顺序 实现无限滚动改变位置的同时也要不断的调整Content的位置防止乱跳元素锁定就是直接锁死的元素的移动范围 当只有拖动大于一定程度时最近.....废话不多说上效果图用的是UGUI…[导读]最近.....废话不多说上效果图用的是UGUI我先说思路通过判断元素的位置信息来改变Hierarchy的顺序 实现无限滚动改变位置的同时也要不断的调整Content的位置防止乱跳元素锁定就是直接锁死的元素的移动范围 当只有拖动大于一定程度时最近.....废话不多说上效果图用的是UGUI我先说思路通过判断元素的位置信息来改变Hierarchy的顺序 实现无限滚动改变位置的同时也要不断的调整Content的位置防止乱跳元素锁定就是直接锁死的元素的移动范围 当只有拖动大于一定程度时才会发生改变然后是面板设置整体结构是这样子的需要注意的是Content需要的两个组件Content的爸爸只需要一个脚本大小改变曲线(大致就行)颜色渐变曲线最后是脚本using System;using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;using UnityEngine.UI;public class DateControl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {public enum ItemType { _year, _month, _day }public ItemType _itemtype;RectTransform conentRect;RectTransform targetRec;Vector3 oldDragPos;Vector3 newDragPos;public AnimationCurve curve_scale;//改变大小曲线public AnimationCurve curve_color;//渐变效果曲线List textList  new List();Button testBtn;floatitemHeight,             //子项item的高contentParentHeight,    //Content爸爸的高itemNum,                //子项数量itemHeight_min,         //子项最小发生改变位置itemHeight_max,         //子项最大发生改变位置conentLimit,            //Conent纠正位置conentSpacing;          //子项间隔大小float deltaX, deltaY;[HideInInspector]public static int _year, _month, _day;[HideInInspector]int dateItemNum;Color itemColor_hig  new Color32(255, 255, 255, 255);void Awake() {conentRect  transform.FindChild(Content).GetComponent();targetRec  transform.parent.FindChild(HighlightTarget).GetComponent();}void OnEnable() {ItemList();}void Start() {switch (_itemtype) {case ItemType._year: InstantiateData(15, 2017); break;case ItemType._month: InstantiateData(12, 12); break;case ItemType._day: InstantiateData(31, 31); break;}itemNum  transform.FindChild(Content).childCount - 1;contentParentHeight  conentRect.parent.GetComponent().sizeDelta.y;conentSpacing  conentRect.GetComponent().spacing / 2;itemHeight  textList[0].rectTransform.sizeDelta.y  conentSpacing;if (itemNum % 2  0) conentLimit  (itemHeight  5) / 2;else conentLimit  0;conentRect.anchoredPosition  new Vector2(conentRect.anchoredPosition.x, conentLimit);deltaX  textList[0].GetComponent().sizeDelta.x;deltaY  textList[0].GetComponent().sizeDelta.y;Invoke(ItemList, 0.05f);}/// /// 生成子项item/// /// 子项数量/// 子项最大值void InstantiateData(int itemNum, int dat) {GameObject go;Text testObj  conentRect.FindChild(Text).GetComponent();for (int i  dat - itemNum  1; i  dat; i) {go  Instantiate(testObj.gameObject, conentRect);go.GetComponent().text  i.ToString();go.name  i.ToString();textList.Add(go.GetComponent());ShowItem(true);}Destroy(conentRect.FindChild(Text).gameObject);}/// /// 是增加或减少/// /// void ShowItem(bool isIncreaseOrdecrease) {itemHeight_min  -itemHeight;if (_itemtype  ItemType._day) itemHeight_max  -itemHeight * itemNum - 95;else itemHeight_max  -itemHeight * itemNum;if (isIncreaseOrdecrease) {foreach (Text rectItem in textList) {if (rectItem.GetComponent().anchoredPosition.y  itemHeight_min) {print();rectItem.transform.SetSiblingIndex((int)itemNum);}}print(itemHeight_min);} else {foreach (Text rectItem in textList) {if (rectItem.GetComponent().anchoredPosition.y print(-);rectItem.transform.SetSiblingIndex(0);}}print(itemHeight_max);}}/// /// 渐变效果改变大小高亮显示/// void ItemList() {foreach (Text item in textList) {float indexA  Mathf.Abs(item.GetComponent().position.y - targetRec.position.y);float indexSc_scale  Mathf.Abs(curve_scale.Evaluate(indexA / contentParentHeight));float indexSc_color  Mathf.Abs(curve_color.Evaluate(indexA / contentParentHeight));if (indexA item.color  itemColor_hig;switch (_itemtype) {case ItemType._year: _year  int.Parse(item.text); break;case ItemType._month: _month  int.Parse(item.text); break;case ItemType._day: _day  int.Parse(item.text); break;}} else item.color  new Color(0, 0, 0, 1 - indexSc_color);item.GetComponent().localScale  new Vector3(1 - indexSc_scale, 1 - indexSc_scale * 3, 1 - indexSc_scale);//item.GetComponent().sizeDelta  new Vector2(deltaX - (deltaX * indexSc), deltaY - (deltaY * indexSc));}}/// /// 获取int类型日期并转换为指定格式/// /// public static string GetDateInfo() { return _year  -  _month  -  _day; }/// /// 纠正Conent位置/// void UpdateEx() {if (conentRect.anchoredPosition.y  conentLimit) {ShowItem(true);conentRect.anchoredPosition  new Vector2(conentRect.anchoredPosition.x, conentRect.anchoredPosition.y - itemHeight);}if (conentRect.anchoredPosition.y ShowItem(false);conentRect.anchoredPosition  new Vector2(conentRect.anchoredPosition.x, conentRect.anchoredPosition.y  itemHeight);}}/// /// 获取拖拽信息并改变Conent位置/// /// void SetDraggedPosition(PointerEventData eventData) {if (RectTransformUtility.ScreenPointToWorldPointInRectangle(conentRect, eventData.position, eventData.pressEventCamera, out newDragPos)) {newDragPos  eventData.position;if (Mathf.Abs(newDragPos.y - oldDragPos.y)  itemHeight) {if (newDragPos.y  oldDragPos.y) {conentRect.anchoredPosition  new Vector2(conentRect.anchoredPosition.x, conentRect.anchoredPosition.y  itemHeight);oldDragPos  new Vector3(0, itemHeight, 0);ItemList();} else {conentRect.anchoredPosition  new Vector2(conentRect.anchoredPosition.x, conentRect.anchoredPosition.y - itemHeight);oldDragPos - new Vector3(0, itemHeight, 0);ItemList();}}}}/// /// 当开始拖拽/// /// public void OnBeginDrag(PointerEventData eventData) {oldDragPos  eventData.position;}public void OnDrag(PointerEventData eventData) {SetDraggedPosition(eventData);UpdateEx();}public void OnEndDrag(PointerEventData eventData) {SetDraggedPosition(eventData);UpdateEx();}}照着来的话基本没什么问题因为赶时间所以很多地方写的简单粗暴请谅解如果调整元素大小或者间隙大小 需要改变itemHeight_min 和 itemHeight_max的值他们分别为itemHeight_minitemHeight_max也就是元素的最顶层和最底层的Y值以上就是年月日选择器的具体步骤
http://www.sadfv.cn/news/372114/

相关文章:

  • 企业如何建设网站全国最好的加盟网站
  • 网络推广好做吗seo深圳网络推广
  • h5响应式网站技术福田建网站外包
  • 企业门户网站建设现状外包加工网吧
  • 天津市建设工程质量安全监督管理总队网站网站建设南京
  • 设计网站私单价格手机网站制作得多少钱啊
  • 自己买域名建设网站本溪网站设计
  • 嘉兴市建设工程监理协会网站淘客做自己的网站
  • 北京大兴最专业的网站建设公司新手学网站建设视频教程共30课高清版
  • 河北秦皇岛建设局网站甘肃企业建站系统费用
  • 做试管婴儿的网站广西建设质监站官方网站
  • 如何仿做别人的网站徐州网站制作费用
  • 策划一个网站有效的网站需要做到什么意思
  • 网站建设的服务怎么样浙江工程信息网
  • 宁波网站推广优化外包海南网站建设培训
  • 网站平台建设十大公司做网站怎么接单
  • 做视频的网站带模板中山建设厅网站
  • wordpress 标签 结构网站推广seo优化
  • 上海公司建设网站wordpress mv网站模板
  • 重庆长寿网站设计公司哪家好怎么制作图片文件
  • 青州网站无锡八匹马网站建设
  • 网站建设情况说明总结新七建设集团有限公司网站
  • 搭建邮箱注册网站泰安网络科技有限公司电话
  • 网站建设升级网站建设经验与团队
  • 长春网站制作wang外贸行业的现状分析及发展趋势
  • 如何编辑企业网站帮别人做彩票网站犯法嘛
  • 中山市企业网站建立一键生成logo免费图
  • 利用百度图片做网站外链做网站时连服务器上的数据库
  • 理解网络营销型网站的建设怎么修改网站默认首页
  • 网站建设制作培训北京市建设官方网站