unity滑动窗口_unity3D NGUI 基于UIDraggablePanel实现滑动窗体,带位置图标

最近由于工作需要学习UNITY3D,对于做PHP的程序猿挑战性灰常大,unity3D国内相关资料少得可怜唉!

根据需求做个防“天天爱消除”主界面左右滑动窗体的效果,百度搜到雨凇大神的一个帖子

不过效果不怎么理想,没有平滑的spring动画。研究NGUI自带的Example 7 - Scroll View (Panel) 例子

实现了如下效果:

UIDragSlider.cs: 该脚本扩展了UICenterOnChild.CS的功能!用于灰白点队列的初始化工作以及根据最近中心点的窗体下标控制白点显示的位置。

UIDragSlider.cs

using UnityEngine;

///

/// Ever wanted to be able to auto-center on an object within a draggable panel?

/// Attach this script to the container that has the objects to center on as its children.

///

//[AddComponentMenu("NGUI/Interaction/Center On Child")]

public class UIDragSlider : MonoBehaviour

{

///

/// The strength of the spring.

///

public float springStrength = 8f;

///

/// Callback to be triggered when the centering operation completes.

///

public SpringPanel.OnFinished onFinished;

//用来放置灰色、白色小点

public Transform ponit;

//白色的小点

public GameObject prefabMaskDot;

//灰色的小点

public GameObject prefabBaseDot;

//白色小点的临时对象

private GameObject maskDot;

//

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值