88 lines
2.0 KiB
C#
88 lines
2.0 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using Thousandto.Core.Base;
|
|
/// <summary>
|
|
/// UI升星星星组件
|
|
/// </summary>
|
|
namespace Thousandto.Plugins.Common
|
|
{
|
|
public class StarAttr
|
|
{
|
|
#region//私有变量
|
|
private bool _isActive = false;
|
|
#endregion
|
|
|
|
#region//公共变量
|
|
public bool IsActive
|
|
{
|
|
get { return _isActive; }
|
|
set { _isActive = value; }
|
|
}
|
|
#endregion
|
|
}
|
|
public class StarInst : IUIComponent<StarInst, StarAttr>
|
|
{
|
|
#region//私有变量
|
|
private Transform _trans = null;
|
|
private UISprite _bSprite = null; //暗淡的星星
|
|
#endregion
|
|
|
|
#region//变量
|
|
#endregion
|
|
|
|
public StarInst( Transform trans )
|
|
{
|
|
if (trans)
|
|
{
|
|
_bSprite = trans.Find("StarBg").RequireComponent<UISprite>();
|
|
}
|
|
}
|
|
#region//实现接口
|
|
public StarInst Clone()
|
|
{
|
|
StarInst clone = null;
|
|
var go = GameObject.Instantiate(_trans.gameObject) as GameObject;
|
|
if (go)
|
|
{
|
|
clone = new StarInst(go.transform);
|
|
clone._trans.parent = _trans.parent;
|
|
UnityUtils.Reset(clone._trans);
|
|
}
|
|
return clone;
|
|
}
|
|
|
|
public void SetActive(bool b)
|
|
{
|
|
if (b)
|
|
{
|
|
_bSprite.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
_bSprite.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void SetData(StarAttr attr)
|
|
{
|
|
if (attr.IsActive)
|
|
{
|
|
_bSprite.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
_bSprite.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public void SetName(string name)
|
|
{
|
|
}
|
|
|
|
public void RefreshData()
|
|
{
|
|
}
|
|
#endregion
|
|
}
|
|
}
|