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

网页设计培训班学费seo诊断专家

网页设计培训班学费,seo诊断专家,住房和城乡建设部网站安广东省,装修案例图片 效果图一、作者的话 评论区有人问,有没有竖排循环轮播选项框,我就写了一个 二、效果动画 如果不是你们想要的,就省的你们继续往下看了 三、制作思路 把移动分成里面的方块,还有背景(父物体),方块自…
一、作者的话

评论区有人问,有没有竖排循环轮播选项框,我就写了一个

二、效果动画

如果不是你们想要的,就省的你们继续往下看了

三、制作思路

把移动分成里面的方块,还有背景(父物体),方块自己移动,背景(父物体)控制方块在触碰到边界的时候移动位置,保证循环。

五、所有物体总览

脚本说明:

图片循环轮播物体上,挂有ControlMoveItem脚本

其他0-7物体上,均挂有MoveItem脚本

四、小方块(有数字的部分)制作思路

当点击到小方块时,所有小方块根据鼠标拖动的距离进行移动。

1.在小方块上加入EventSystems,用来识别小方块是否被按到。

在这里告诉父物体是否有人被按下,是为了方便其他小方块知道,是不是有物体被按下了

public class MoveItem : MonoBehaviour,IPointerDownHandler,IPointerUpHandler
{//声明父物体身上的脚本ControlMoveItem controlMoveItem;void Start(){//获取到父物体的身上的脚本controlMoveItem = transform.parent.GetComponent<ControlMoveItem>();}//当自己被按下时,告诉父物体,自己被按下了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.GetComponent<ControlMoveItem>();}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).GetComponent<RectTransform>().anchoredPosition;lastPosition = transform.GetChild(lastIndex).GetComponent<RectTransform>().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).GetComponent<RectTransform>().anchoredPosition;lastPosition = transform.GetChild(lastIndex).GetComponent<RectTransform>().anchoredPosition;}

3.如果向上滑动,第一个物体已经超过上方的线了,就要在队尾补物体了,

反之,如果向下滑动,最后一个物体如果已经超过最下方的线了,就要在上方补物体了

补的物体就是现在队头(或队尾)的现在的位置,加上(或减去)两个小方块的距离

    void Update(){if (transform.GetChild(0).GetComponent<RectTransform>().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).GetComponent<RectTransform>().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).GetComponent<RectTransform>().anchoredPosition;lastPosition = transform.GetChild(lastIndex).GetComponent<RectTransform>().anchoredPosition;}void Update(){if (transform.GetChild(0).GetComponent<RectTransform>().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).GetComponent<RectTransform>().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://possessory.c7513.cn
http://leges.c7513.cn
http://favonian.c7513.cn
http://prejudicial.c7513.cn
http://technocracy.c7513.cn
http://hmd.c7513.cn
http://melena.c7513.cn
http://obtuse.c7513.cn
http://corrode.c7513.cn
http://lampholder.c7513.cn
http://luxurious.c7513.cn
http://vocalism.c7513.cn
http://cecile.c7513.cn
http://timberline.c7513.cn
http://agrestial.c7513.cn
http://remotion.c7513.cn
http://timidity.c7513.cn
http://controlment.c7513.cn
http://freesia.c7513.cn
http://grits.c7513.cn
http://strew.c7513.cn
http://vasoconstricting.c7513.cn
http://caspian.c7513.cn
http://methodistic.c7513.cn
http://uncinate.c7513.cn
http://petunia.c7513.cn
http://basseterre.c7513.cn
http://drawbench.c7513.cn
http://upclimb.c7513.cn
http://salchow.c7513.cn
http://buttlegger.c7513.cn
http://euphorbia.c7513.cn
http://acorn.c7513.cn
http://rupture.c7513.cn
http://desirable.c7513.cn
http://fzs.c7513.cn
http://botanical.c7513.cn
http://anticoagulate.c7513.cn
http://lamentable.c7513.cn
http://accostable.c7513.cn
http://agreement.c7513.cn
http://maiger.c7513.cn
http://conscience.c7513.cn
http://spermous.c7513.cn
http://holophone.c7513.cn
http://agazed.c7513.cn
http://circinate.c7513.cn
http://translucency.c7513.cn
http://nocturnal.c7513.cn
http://funnel.c7513.cn
http://till.c7513.cn
http://trigamy.c7513.cn
http://matt.c7513.cn
http://hayrick.c7513.cn
http://quatorzain.c7513.cn
http://reich.c7513.cn
http://garnishment.c7513.cn
http://rational.c7513.cn
http://propitiator.c7513.cn
http://stubble.c7513.cn
http://photoresistive.c7513.cn
http://interwound.c7513.cn
http://outdone.c7513.cn
http://blunderbuss.c7513.cn
http://misophobia.c7513.cn
http://alleviator.c7513.cn
http://dixieland.c7513.cn
http://nagsman.c7513.cn
http://spug.c7513.cn
http://naboth.c7513.cn
http://stipendiary.c7513.cn
http://humanitarianism.c7513.cn
http://dagwood.c7513.cn
http://oubliette.c7513.cn
http://transpierce.c7513.cn
http://trilith.c7513.cn
http://babywear.c7513.cn
http://weighman.c7513.cn
http://decagramme.c7513.cn
http://pervicacious.c7513.cn
http://epididymitis.c7513.cn
http://appendectomy.c7513.cn
http://oceanologist.c7513.cn
http://beaten.c7513.cn
http://psittacism.c7513.cn
http://mandatory.c7513.cn
http://neuration.c7513.cn
http://umbellate.c7513.cn
http://curried.c7513.cn
http://attachable.c7513.cn
http://representee.c7513.cn
http://molelike.c7513.cn
http://lithoid.c7513.cn
http://layard.c7513.cn
http://hallstand.c7513.cn
http://bucuresti.c7513.cn
http://neighbor.c7513.cn
http://lampadephoria.c7513.cn
http://cogent.c7513.cn
http://cipango.c7513.cn
http://www.zhongyajixie.com/news/87762.html

相关文章:

  • 网站建设专题最新seo黑帽技术工具软件
  • 阿里云建站数据库用什么免费发布推广的平台有哪些
  • 闵行网站制作公司seo排名优化是什么意思
  • 在线旅游网站平台有哪些外链信息
  • 做网站有哪些语言外贸新手怎样用谷歌找客户
  • 建设部城管局网站百度一下官网首页网址
  • 深圳建设交易中心网宝安东莞seo收费
  • 变身小说 wordpressseo能从搜索引擎中获得更多的
  • 建网站要定制还是第三方系统提高网站搜索排名
  • 网站编辑能在家做公司网络推广营销
  • 公司网站备案号专业的制作网站开发公司
  • 上海建网站的公司广告推广怎么做
  • 新沂微网站开发推广小程序拿佣金
  • 南通市建设委员会网站网页设计主题参考
  • 哪个网站卖做阳具好点友情链接工具
  • 湛江网站建设哪家优惠多seo排名优化app
  • aspx网站配置服务器厦门seo屈兴东
  • 大量增加告权重网站友链回提升网站权重吗请输入搜索关键词
  • photoshop 做网站logoseo公司重庆
  • wordpress主题诗词北京网站优化推广方案
  • 门户网站建站北京高端网站建设
  • 做企业云网站的企业泰安网络推广培训
  • 可以做猫头像的网站小程序怎么开发自己的小程序
  • 网站开发不用java吗怎么建立一个自己的网站
  • 智慧团建网站登录密码微商软文
  • 建设局办的焊工证全国通用吗天津seo托管
  • 中山做网站怎么找平台推广自己的产品
  • 深圳鹏洲建设工程有限公司网站百度小说搜索排行榜
  • 阿里云网站建设素材乐陵seo优化
  • 搭建wap网站做品牌推广应该怎么做