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

app界面设计尺寸规范怎样优化网站排名靠前

app界面设计尺寸规范,怎样优化网站排名靠前,后台做网站的题,网站域名跳转怎么做一、作者的话 评论区有人问,有没有竖排循环轮播选项框,我就写了一个 二、效果动画 如果不是你们想要的,就省的你们继续往下看了 三、制作思路 把移动分成里面的方块,还有背景(父物体),方块自…
一、作者的话

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

二、效果动画

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

三、制作思路

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

五、所有物体总览

脚本说明:

图片循环轮播物体上,挂有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://www.ds6.com.cn/news/78329.html

相关文章:

  • 网站一个一个关键词做网络优化的意义
  • 做视频素材哪个网站好老鬼seo
  • 有没有专门教做扯面的网站做网络优化哪家公司比较好
  • 做的网站出现404行业网站有哪些平台
  • 电子商务网站推广计划书网站备案查询官网
  • 阿米纳网站建设求网址
  • 推荐晚上用的网站360摄像头海澳門地区限制解除
  • 网站建设与网络营销写手接单平台
  • 网页制作与设计源代码镇江seo公司
  • wordpress 批量入库seo培训教程视频
  • 安徽软件开发公司广东seo快速排名
  • 东莞的网站建设公司营业推广是什么
  • 南安seoseo长尾关键词排名
  • 房产中介网站建设泰州百度seo公司
  • 企业网站个人备案吗广告平台推广渠道
  • 制作网站复杂吗丹东seo推广优化报价
  • 对网站做数据分析如何进行app推广
  • 自适应网站开发语言不花钱网站推广
  • 网站(网店)建设方案范文广州网站建设方案优化
  • 武汉市建设工程造价管理站google广告投放
  • 福建省住房和城乡建设厅网站电话北京网站优化服务
  • 河北手机网站制作多少钱360搜索引擎下载
  • 网站建设委托合同范本网络推广的具体方式
  • 沈阳工伤保险做实在哪个网站app推广公司怎么对接业务
  • 龙岩今天刚刚最新新闻事件灰色词网站seo
  • 网站建设工作不足及整改丁的老头seo博客
  • 响应式网站研究现状友情链接收录
  • 现在有专业做海鲜的网站没有seo研究中心倒闭
  • 沈阳企业网站模板建站微商怎么做推广加好友
  • 四川省建设厅网站打不开百度推广公司电话