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

今日柴油价格最新消息鹤壁seo

今日柴油价格最新消息,鹤壁seo,永嘉网站制作,水母智能设计平台一.SuperScrollView插件概述 UGUI SUPER SCROLLVIEW基于UGUI ScrollRect提供了易于定制的滚动浏览量。这是一组C#脚本,可帮助您创建所需的ScrollView。它非常强大且针对性能高度优化。 此插件是收费的,在AssetStore可以下载 SuperScrollVie…

一.SuperScrollView插件概述

UGUI SUPER SCROLLVIEW基于UGUI ScrollRect提供了易于定制的滚动浏览量。这是一组C#脚本,可帮助您创建所需的ScrollView。它非常强大且针对性能高度优化。

此插件是收费的,在AssetStore可以下载

SuperScrollView应该掌握到什么程度?

  • 1.使用时知道Editor中怎么设置,脚本中逻辑怎么写
  • 2.LoopListView2, LoopGridView and LoopStaggeredGridView 这3个核心组件分别在什么情况使用
  • 3.会使用脚本中的公有方法

二.SuperScrollView安装

将unitypackage包拖入Asset目录完成导入,生成SuperScrollView目录,包含了Demo,Editor和Scripts三个目录,还有一个很有帮助的文档DocumentV2_4,如下图所示:

三.官方文档总结提炼(快速入门)

3.1 概述

SuperScrollView中有3个核心组件: LoopListView2 , LoopGridView and LoopStaggeredGridView,他们都附加到ScrollRect组件所在的gameObject上,他们帮助ScrollRect实现高性能任意数量的item和节省内存。
实现原理上总的来说,使用内存池,监听滚动事件,实现了item的回收和复用,自动设置了每个item的位置。

3.2 LoopListView2组件

3.2.1 LoopListView2 Inspector Settings

Size:每个Item可以有不同的Prefab,Size指Item使用的Prefab总数

ElementX:每个Item有4个参数,当展开Element0后,可以看到有2个Element0,下面的Element0下面还有4个属性,以改变Padding为例,改变MPading和改变ItemPadding是一样的,这里推荐直接改ItemPadding,下面之所以多了4个属性可能是因为XPosOffset是自适应的属性

当Item有多个prefab时,需要添加多个Element

eg:一个排行榜有多个页签,切换页签时item不一样,这种情况需要添加多个Element

ItemPrefab:该Item使用gameObject的引用

ItemPadding:和下个Item的间距

XPosOffset:ScrollView最左侧到Item最左侧的间距

InitCreateCount:该Item对象池初始数量(可以填0,不知道为什么要手动设置,官方没有说)

SupportScrollbar:使用ScrollBar时勾上

ItemSnapEnable: 启用后,当滚动结束时,Item将被吸附(Snap)到预设的位置

ItemSnapPivot:给Item定义一个吸附轴心点,控制Item被吸附的位置

ViewPortSnapPivot:给ViewPort定义一个吸附轴心点,控制ViewPort吸附Item的位置

在上图中,ViewPortSnapPivot的Y设为1,代表ViewPort顶部将吸附item

ItemSnapPivot的Y设为0.5表示item中部将被吸附,滚动效果符合预期

ArrangeType:滚动方向,有4种选择

3.2.2 LoopListView2 Example

下文给出一个简化的LoopListView2 Example,可以取来作为快速开发的基础代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;namespace SuperScrollView
{public class ItemData1{public string itemName;public string itemDes;public ItemData1(string name, string des){itemName = name;itemDes = des;}}public class TopToBottomDemoScript : MonoBehaviour{private LoopListView2 mLoopListView;private int itemNum = 15;List<ItemData1> ssvData = new List<ItemData1>();void Start(){mLoopListView = GetComponent<LoopListView2>();for (int i = 0; i < itemNum; i++){ItemData1 data = new ItemData1("name"+i, "des"+i);ssvData.Add(data);}mLoopListView.InitListView(itemNum, OnGetItemByIndex);}LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index){if (index < 0 || index >= itemNum){return null;}ItemData1 itemData = ssvData[index];if(itemData == null){return null;}LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1");ListItemX itemScript = item.GetComponent<ListItemX>();if (item.IsInitHandlerCalled == false){item.IsInitHandlerCalled = true;itemScript.Init();}itemScript.UpdateItemUI(itemData,index);return item;}}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;namespace SuperScrollView
{public class ListItemX : MonoBehaviour{private Text mNameText;private Text mDescText;int mItemDataIndex = -1;public void Init(){mNameText = transform.Find("TextName").GetComponent<Text>();mDescText = transform.Find("TextDesc2").GetComponent<Text>();}public void UpdateItemUI(ItemData1 itemData, int itemIndex){mItemDataIndex = itemIndex;mNameText.text = itemData.itemName;mDescText.text = itemData.itemDes;}}
}

3.2.3 LoopListView2常用API

1.InitListView

LoopListView2组件的初始化方法

public void InitListView(int itemTotalCount,System.Func<LoopListView2, int, LoopListViewItem2> onGetItemByIndex,LoopListViewInitParam initParam = null)

2.NewListViewItem

用来获取一个从参数itemPrefabName克隆的新item,通常在onGetItemByIndex内部调用

public LoopListViewItem2 NewListViewItem(string itemPrefabName)

3.SetListItemCount

在运行时设置item数量

public void SetListItemCount(int itemCount, bool resetPos = true)

4.RefreshAllShownItem

刷新当前可视的item,经常在SetListItemCount之后调用,然而不是每次都需要调用RefreshAllShownItem。

必须调用的情形:当前显示的N-M个节点,在数据变化后N-M个节点的数据也变化了,则应调用RefreshAllShownItem

public void RefreshAllShownItem()

5.MovePanelToItemIndex

以从上至下的排列方式为例,该方法将移动Content直到itemIndex所在的item的上方和视口的上方对齐

public void MovePanelToItemIndex(int itemIndex, float offset)

6.OnItemSizeChanged

 For a vertical scrollrect, when a visible item’s height changed at runtime, then this method should be called to let the LoopListView2 component reposition all visible items’ position

public void OnItemSizeChanged(int itemIndex)

3.3 LoopGridView组件

3.3.1 LoopGridView Inspector Settings

ItemPrefabList:同LoopListView2

GridFixedType:有两个选项ColumnCountFixed or RowCountFixed,即列固定或者行固定RowCount/ColumnCount: if GridFixedType is ColumnCountFixed, then here you wouldset the column countof the GridView; if GridFixedType is RowCountFixed, then here you wouldset the row countof the GridView

Padding:the space between the items and the viewport

ItemSize: the size of items. If the x or y is set to 0, then the ItemSize would be auto set the size of
the first item of the ItemPrefabList when the LoopGridView component is inited.
ItemPadding: the amount of spacing between each item in the GridView.
RecycleDistance: how much distance an item leaves the viewport when the item would be
recycled.
ItemSnapEnable :同LoopListView2
ItemSnapPivot:同LoopListView2
ViewPortSnapPivot:同LoopListView2
ArrangeType :同LoopListView2

3.3.2 LoopGridView Example

下文给出一个简化的LoopGridView Example,可以取来作为快速开发的基础代码,item上脚本ListItemX同LoopListView2

using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEditorInternal.VersionControl;
using UnityEngine;
using UnityEngine.UI;namespace SuperScrollView
{public class ItemData1{public string itemName;public string itemDes;public ItemData1(string name, string des){itemName = name;itemDes = des;}}public class GridViewDemoScript2 : MonoBehaviour{public LoopGridView mLoopGridView;private int itemNum = 15;List<ItemData1> ssvData = new List<ItemData1>();// Use this for initializationvoid Start(){for (int i = 0; i < itemNum; i++){ItemData1 data = new ItemData1("name" + i, "des" + i);ssvData.Add(data);}mLoopGridView.InitGridView(ssvData.Count, OnGetItemByRowColumn);}LoopGridViewItem OnGetItemByRowColumn(LoopGridView gridView, int itemIndex,int row,int column){if (itemIndex < 0 || itemIndex >= ssvData.Count){return null;}ItemData1 itemData = ssvData[itemIndex];if (itemData == null){return null;}LoopGridViewItem item = gridView.NewListViewItem("ItemPrefab0");ListItemX itemScript = item.GetComponent<ListItemX>();if (item.IsInitHandlerCalled == false){item.IsInitHandlerCalled = true;itemScript.Init();}itemScript.UpdateItemUI(itemData, itemIndex, row, column);return item;}}
}

3.3.3 LoopGridView常用API

1. InitGridView

InitGridView组件的初始化方法;类似LoopListView2

 public void InitGridView(int itemTotalCount, System.Func<LoopGridView,int,int,int, LoopGridViewItem> onGetItemByRowColumn, LoopGridViewSettingParam settingParam = null,LoopGridViewInitParam initParam = null)

2.NewListViewItem

同LoopListView2

3.SetListItemCount

同LoopListView2

4.RefreshAllShownItem

同LoopListView2

5.MovePanelToItemByRowColumn

类似LoopListView2

public void MovePanelToItemByRowColumn(int row,int column, float offsetX = 0,float offsetY = 0)

http://www.dtcms.com/wzjs/491036.html

相关文章:

  • wordpress插 件长沙优化排名
  • 网站策划书的内容网络营销的推广方法有哪些
  • 微信公众号申请网站中国搜索网站排名
  • 渔具网站建设策划书前言今日热点新闻一览
  • 龙华专业网站建设市场营销实务
  • 网站雪花飘落代码软文推广经典案例
  • 江苏常州网站建设公司百度学术论文查重免费检测
  • 网站建设合同封皮深圳百度关键
  • 色情网站建设网页制作教程视频
  • 石家庄市网站建设培训班网络营销专业技能
  • 做网站应该用什么配置的手提电脑优化教程网
  • 门户网站做pos机广州短视频代运营
  • 东莞整站优化火速公司台州关键词优化平台
  • 网站需要什么自贡网站seo
  • 自己做网站要不要租服务器百度seo建议
  • 大学生网站规划建设seo教程seo优化
  • 前端页面设计网站爱客crm
  • 网站建设价格都信真甲先生免费的云服务器有哪些
  • 网站跳出率 报告百度免费收录提交入口
  • wordpress实现网站的登陆功能网上怎么发布广告
  • 濮阳新闻综合频道网站农夫山泉软文300字
  • 昆明网站开发公司哪家好游戏广告联盟平台
  • 图片做旧网站最好的网络推广方式
  • java手机网站开发工具软文外链购买平台
  • 邢台信息港聊天室广州网络推广seo
  • 河北辛集住房和城乡建设厅网站山东服务好的seo
  • 腾讯网站安全检测可以免费发布广告的平台有哪些
  • 帮别人做网站多少钱合适网站排名掉了怎么恢复
  • 网站怎么做免费推广方案可以推广网站
  • 专门做研究美股的财经网站电商网站建设公司哪家好