Unity滚动条ScrollView自动居中、缩放、变暗扩展
标签:
•
文件类型: .zip
•
文件大小: 23.6MB
•
下载次数: 1
•
类似于网络游戏的商品切换滚动条,皮肤切换滚动条,自动居中离中心最近的Item,居中Item进行缩放,明暗变化。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 19649 2018-02-11 17:17 CenterOnChild_UGUI.cs
文件 268285 2018-02-11 17:27 动态滚动条使用说明.docx
目录 0 2018-02-11 17:34 工程文件
目录 0 2018-02-11 17:34 工程文件SrollViewUGUI
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssets
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssetsPrefab
文件 81702 2018-02-11 17:18 工程文件SrollViewUGUIAssetsPrefabUGUI_Store.prefab
文件 209 2018-02-11 17:18 工程文件SrollViewUGUIAssetsPrefabUGUI_Store.prefab.meta
文件 191 2018-02-11 17:18 工程文件SrollViewUGUIAssetsPrefab.meta
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssetsscripts
文件 19649 2018-02-11 17:17 工程文件SrollViewUGUIAssetsscriptsCenterOnChild_UGUI.cs
文件 262 2018-02-11 13:59 工程文件SrollViewUGUIAssetsscriptsCenterOnChild_UGUI.cs.meta
文件 302 2018-02-11 17:00 工程文件SrollViewUGUIAssetsscriptsGoodClass.cs
文件 262 2018-02-11 16:58 工程文件SrollViewUGUIAssetsscriptsGoodClass.cs.meta
文件 640 2018-02-11 14:55 工程文件SrollViewUGUIAssetsscriptsUGUI_Item.cs
文件 262 2018-02-11 14:45 工程文件SrollViewUGUIAssetsscriptsUGUI_Item.cs.meta
文件 1886 2018-02-11 17:04 工程文件SrollViewUGUIAssetsscriptsUGUI_Store.cs
文件 262 2018-02-11 14:51 工程文件SrollViewUGUIAssetsscriptsUGUI_Store.cs.meta
文件 191 2018-02-11 13:58 工程文件SrollViewUGUIAssetsscripts.meta
文件 17367 2018-02-11 17:29 工程文件SrollViewUGUIAssetsScrollViewScene.unity
文件 174 2018-02-11 17:29 工程文件SrollViewUGUIAssetsScrollViewScene.unity.meta
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssetsSprites
文件 382106 2018-02-11 14:06 工程文件SrollViewUGUIAssetsSpritesStoreBg.png
文件 2007 2018-02-11 14:06 工程文件SrollViewUGUIAssetsSpritesStoreBg.png.meta
文件 144734 2018-02-11 14:17 工程文件SrollViewUGUIAssetsSpritesapple.png
文件 2007 2018-02-11 14:18 工程文件SrollViewUGUIAssetsSpritesapple.png.meta
文件 160741 2018-02-11 14:42 工程文件SrollViewUGUIAssetsSpritesclose.png
文件 2007 2018-02-11 14:42 工程文件SrollViewUGUIAssetsSpritesclose.png.meta
文件 127833 2018-02-11 14:31 工程文件SrollViewUGUIAssetsSpritescyj.png
文件 2007 2018-02-11 14:31 工程文件SrollViewUGUIAssetsSpritescyj.png.meta
文件 216957 2018-02-11 14:26 工程文件SrollViewUGUIAssetsSprites彼岸花.png
............此处省略1171个文件信息
/******************************************************
* 滚动条扩展脚本
* Author: liaoweiyu
* function:自动居中最靠近中心的Item
支持居中Item缩放
支持非居中Item变暗
支持点击Item居中
带有居中Item改变时回调委托:_centerChanged
******************************************************/
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
using System;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
#endif
public enum ScrollDir_UGUI
{
Horizontal
Vertical
}
public enum ImageType_UGUI
{
Image
}
///
/// 用于显示在Inspector的类
///
[Serializable]
public class ScrollViewImage
{
public ImageType_UGUI type;
public Image image;
}
#if UNITY_EDITOR
///
/// 重绘Inspector类
///
[CustomEditor(typeof(CenterOnChild_UGUI))]
public class OverDrawInspector : Editor
{
private Serializedobject serial;//序列化
private ReorderableList list;//数组
private SerializedProperty TransformSpeed ScaleSpeed OpacitySpeed CenterChildScale AddMask MaskOpacity;
///
/// 初始化
///
void OnEnable()
{
serial = new Serializedobject(target);
list = new ReorderableList(serial serial.FindProperty(“ChildMasks“) true true true true);
TransformSpeed = serial.FindProperty(“TransformSpeed“);
ScaleSpeed = serial.FindProperty(“ScaleSpeed“);
OpacitySpeed = serial.FindProperty(“OpacitySpeed“);
CenterChildScale = serial.FindProperty(“CenterChildScale“);
AddMask = serial.FindProperty(“AddMask“);
MaskOpacity = serial.FindProperty(“MaskOpacity“);
//绘制List标题
list.drawHeaderCallback = (Rect rect) =>
{
EditorGUI.LabelField(rect “MaskList“);
};
//绘制List
list.drawElementCallback =
(Rect rect int index bool isActive bool isFocused) =>
{
var element = list.serializedProperty.GetArrayElementAtIndex(index);
rect.y += 2;
//绘制一个单元
EditorGUI.PropertyField(new Rect(rect.x rect.y 60 EditorGUIUtility.singleLineHeight)
element.FindPropertyRelative(“type“) GUIContent.none);
EditorGUI.PropertyField(new Rect(rect.x + 60 rect.y rect.width - 60 - 30 EditorGUIUtility.singleLineHeight)
element.FindPropertyRelative(“image“) GUIContent.none);
};
}
///
/// 重绘
///
public override void OnInspectorGUI()
{
serial.Update();
EditorGUILayout.PropertyField(TransformSpeed);
EditorGUILayout.PropertyField(ScaleSpeed);
EditorGUILayout.PropertyField(CenterChildScale);
EditorGUILayout.PropertyField(AddMask);
if (AddMask.boolValue == true)
{
EditorGUILayout.PropertyField(OpacitySpeed);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 19649 2018-02-11 17:17 CenterOnChild_UGUI.cs
文件 268285 2018-02-11 17:27 动态滚动条使用说明.docx
目录 0 2018-02-11 17:34 工程文件
目录 0 2018-02-11 17:34 工程文件SrollViewUGUI
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssets
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssetsPrefab
文件 81702 2018-02-11 17:18 工程文件SrollViewUGUIAssetsPrefabUGUI_Store.prefab
文件 209 2018-02-11 17:18 工程文件SrollViewUGUIAssetsPrefabUGUI_Store.prefab.me
文件 191 2018-02-11 17:18 工程文件SrollViewUGUIAssetsPrefab.me
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssetssc
文件 19649 2018-02-11 17:17 工程文件SrollViewUGUIAssetssc
文件 262 2018-02-11 13:59 工程文件SrollViewUGUIAssetssc
文件 302 2018-02-11 17:00 工程文件SrollViewUGUIAssetssc
文件 262 2018-02-11 16:58 工程文件SrollViewUGUIAssetssc
文件 640 2018-02-11 14:55 工程文件SrollViewUGUIAssetssc
文件 262 2018-02-11 14:45 工程文件SrollViewUGUIAssetssc
文件 1886 2018-02-11 17:04 工程文件SrollViewUGUIAssetssc
文件 262 2018-02-11 14:51 工程文件SrollViewUGUIAssetssc
文件 191 2018-02-11 13:58 工程文件SrollViewUGUIAssetssc
文件 17367 2018-02-11 17:29 工程文件SrollViewUGUIAssetsScrollViewScene.unity
文件 174 2018-02-11 17:29 工程文件SrollViewUGUIAssetsScrollViewScene.unity.me
目录 0 2018-02-11 17:34 工程文件SrollViewUGUIAssetsSprites
文件 382106 2018-02-11 14:06 工程文件SrollViewUGUIAssetsSpritesStoreBg.png
文件 2007 2018-02-11 14:06 工程文件SrollViewUGUIAssetsSpritesStoreBg.png.me
文件 144734 2018-02-11 14:17 工程文件SrollViewUGUIAssetsSpritesapple.png
文件 2007 2018-02-11 14:18 工程文件SrollViewUGUIAssetsSpritesapple.png.me
文件 160741 2018-02-11 14:42 工程文件SrollViewUGUIAssetsSpritesclose.png
文件 2007 2018-02-11 14:42 工程文件SrollViewUGUIAssetsSpritesclose.png.me
文件 127833 2018-02-11 14:31 工程文件SrollViewUGUIAssetsSpritescyj.png
文件 2007 2018-02-11 14:31 工程文件SrollViewUGUIAssetsSpritescyj.png.me
文件 216957 2018-02-11 14:26 工程文件SrollViewUGUIAssetsSprites彼岸花.png
............此处省略1171个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)