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

深圳网站网页制作农村电商平台怎么加入

深圳网站网页制作,农村电商平台怎么加入,想用自己电脑做服务器做个网站吗,网站建设主要干什么一、作者的话 评论区有人问#xff0c;有没有竖排循环轮播选项框#xff0c;我就写了一个 二、效果动画 如果不是你们想要的#xff0c;就省的你们继续往下看了 三、制作思路 把移动分成里面的方块#xff0c;还有背景#xff08;父物体#xff09;#xff0c;方块自…一、作者的话 评论区有人问有没有竖排循环轮播选项框我就写了一个 二、效果动画 如果不是你们想要的就省的你们继续往下看了 三、制作思路 把移动分成里面的方块还有背景父物体方块自己移动背景父物体控制方块在触碰到边界的时候移动位置保证循环。 五、所有物体总览 脚本说明 图片循环轮播物体上挂有ControlMoveItem脚本 其他0-7物体上均挂有MoveItem脚本 四、小方块有数字的部分制作思路 当点击到小方块时所有小方块根据鼠标拖动的距离进行移动。 1.在小方块上加入EventSystems用来识别小方块是否被按到。 在这里告诉父物体是否有人被按下是为了方便其他小方块知道是不是有物体被按下了 public class MoveItem : MonoBehaviour,IPointerDownHandler,IPointerUpHandler {//声明父物体身上的脚本ControlMoveItem controlMoveItem;void Start(){//获取到父物体的身上的脚本controlMoveItem transform.parent.GetComponentControlMoveItem();}//当自己被按下时告诉父物体自己被按下了public void OnPointerDown(PointerEventData eventData){controlMoveItem.isButtonDown true;}//当鼠标抬起时告诉父物体没有被按了public void OnPointerUp(PointerEventData eventData){controlMoveItem.isButtonDown false;} } 2.当物体被按下时每个小方块都挪动和鼠标相同的位置 void Update(){bool isButtonDown controlMoveItem.isButtonDown;if (isButtonDown true){if (mouthPosition Vector3.zero){mouthPosition Input.mousePosition;}else{Vector3 del Input.mousePosition - mouthPosition;transform.position new Vector3(0, del.y, 0);mouthPosition Input.mousePosition;}}else {mouthPosition Vector3.zero;}} 3.总代码 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems;public class MoveItem : MonoBehaviour,IPointerDownHandler,IPointerUpHandler {ControlMoveItem controlMoveItem;Vector3 mouthPosition new Vector3();public void OnPointerDown(PointerEventData eventData){controlMoveItem.isButtonDown true;}public void OnPointerUp(PointerEventData eventData){controlMoveItem.isButtonDown false;}void Start(){controlMoveItem transform.parent.GetComponentControlMoveItem();}void Update(){bool isButtonDown controlMoveItem.isButtonDown;if (isButtonDown true){if (mouthPosition Vector3.zero){mouthPosition Input.mousePosition;}else{Vector3 del Input.mousePosition - mouthPosition;if (controlMoveItem.dir Dir.Vertical){transform.position new Vector3(0, del.y, 0);}mouthPosition Input.mousePosition;}}else {mouthPosition Vector3.zero;}} } 四、大方块父物体制作思路 1.读取显示的第一个物体和最后一个物体的位置 这样当超过这个位置的时候我就知道要移动别的方块了 public bool isButtonDown false;public int lastIndex 5;Vector3 firstPosition;Vector3 lastPosition;void Start(){firstPosition transform.GetChild(0).GetComponentRectTransform().anchoredPosition;lastPosition transform.GetChild(lastIndex).GetComponentRectTransform().anchoredPosition;} 2.读取第一个小方块和第二个小方块之间的距离 这样当设置新移动过来的位置的时候我知道把方块放到哪里 public bool isButtonDown false;public int lastIndex 5;float d;Vector3 firstPosition;Vector3 lastPosition;void Start(){d Mathf.Abs(transform.GetChild(0).localPosition.y - transform.GetChild(1).localPosition.y);firstPosition transform.GetChild(0).GetComponentRectTransform().anchoredPosition;lastPosition transform.GetChild(lastIndex).GetComponentRectTransform().anchoredPosition;} 3.如果向上滑动第一个物体已经超过上方的线了就要在队尾补物体了 反之如果向下滑动最后一个物体如果已经超过最下方的线了就要在上方补物体了 补的物体就是现在队头或队尾的现在的位置加上或减去两个小方块的距离 void Update(){if (transform.GetChild(0).GetComponentRectTransform().anchoredPosition.y firstPosition.y){Transform changeT transform.GetChild(transform.childCount - 1);changeT.localPosition transform.GetChild(0).localPosition new Vector3(0, d, 0);changeT.SetSiblingIndex(0);}else if (transform.GetChild(transform.childCount - 1).GetComponentRectTransform().anchoredPosition.y lastPosition.y){Transform changeT transform.GetChild(0);changeT.localPosition transform.GetChild(transform.childCount - 1).localPosition - new Vector3(0, d, 0);changeT.SetSiblingIndex(transform.childCount - 1);}} 4.全部代码 using UnityEngine;public class ControlMoveItem : MonoBehaviour {public bool isButtonDown false;public int lastIndex 5;float d;Vector3 firstPosition;Vector3 lastPosition;void Start(){d Mathf.Abs(transform.GetChild(0).localPosition.y - transform.GetChild(1).localPosition.y);firstPosition transform.GetChild(0).GetComponentRectTransform().anchoredPosition;lastPosition transform.GetChild(lastIndex).GetComponentRectTransform().anchoredPosition;}void Update(){if (transform.GetChild(0).GetComponentRectTransform().anchoredPosition.y firstPosition.y){Transform changeT transform.GetChild(transform.childCount - 1);changeT.localPosition transform.GetChild(0).localPosition new Vector3(0, d, 0);changeT.SetSiblingIndex(0);}else if (transform.GetChild(transform.childCount - 1).GetComponentRectTransform().anchoredPosition.y lastPosition.y){Transform changeT transform.GetChild(0);changeT.localPosition transform.GetChild(transform.childCount - 1).localPosition - new Vector3(0, d, 0);changeT.SetSiblingIndex(transform.childCount - 1);}} }
http://www.yutouwan.com/news/57974/

相关文章:

  • 影视网站建设平台郑州百度推广外包
  • 潍坊网站建设首荐创美网络怎么做品牌推广和宣传
  • 检察院门户网站建设网页布局设计说明
  • 自贡住房和城乡建设厅网站网站怎么做切换图片
  • 什么是展示型网站建设网站如何做超级链接
  • 接做施工图的网站seo推广优化平台
  • 网站建设要求卖货到海外的免费平台
  • asp网站配置典型的网站开发人员
  • 沈阳做公司网站的公司无锡企业网站设计公司
  • 工作做ppt课件的网站2000个免费货源网站
  • 网站建设淘宝模板宁波企业seo外包
  • 怎么筛选一家做网站做的好的公司重庆网站建设优斗士
  • 响应式网站开发哪家好设计精美的中文网站
  • 无锡公司建立网站做跨境的网站有哪些
  • 网站建设能解决哪些问题大连甘井子区地图
  • 西安网站排名优化做效果图网站有哪些
  • 微网站缺点网站重定向怎么做
  • 企业网站建设需要哪些步骤科技部网站
  • 视频网站开发教程我花钱买了一个函授本科
  • app网站建设需要什么软件最有性价比的网站建设
  • 网站建设技术架构和语言网站建设过程与思路
  • 推广app网站企业网站设计报名
  • 网站开发建设与维护邯郸网站建设安联网络公司
  • 著名网站设计师c 手机版网站开发
  • 电子商务与网站建设嘉兴网站建设哪家做得好
  • 网站监控 重启企业官网如何设计
  • 网站如何做搜狗搜索引擎上海闵行邮编
  • 网站建设 中企动力wordpress 优酷去广告插件
  • 公司内部网站管理系统天天广告联盟
  • 一个网站如何做cdn加速器西安大兴医院网站建设