66 lines
1.2 KiB
C#
66 lines
1.2 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class BtnList : MonoBehaviour
|
|
{
|
|
|
|
public static BtnList Instance;
|
|
|
|
public BtnFunc[] _Btns;
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
InitBtnFuncopenId();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
|
|
public void RefreshBtnState(int _functionId)
|
|
{
|
|
for(int index = 0; index < _Btns.Length; index++)
|
|
{
|
|
if(_Btns[index]._functionOpenId == _functionId)
|
|
{
|
|
_Btns[index].UpdateFuncState(_functionId);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void InitBtnFuncopenId()
|
|
{
|
|
for (int index = 0; index < _Btns.Length; index++)
|
|
{
|
|
_Btns[index].UpdateFuncState(index + 1);
|
|
}
|
|
}
|
|
|
|
#region btnShowAnim
|
|
|
|
public Animator _AnimLeft;
|
|
public Animator _AnimDown;
|
|
public bool _DirtyUpdate = true;
|
|
|
|
public void SetDirtyBtns()
|
|
{
|
|
_DirtyUpdate = true;
|
|
}
|
|
|
|
public void ShowBtns()
|
|
{
|
|
_AnimLeft.Play("ShowLeft");
|
|
_AnimDown.Play("ShowDown");
|
|
}
|
|
|
|
public void HideBtns()
|
|
{
|
|
_AnimLeft.Play("HideLeft");
|
|
_AnimDown.Play("HideDown");
|
|
}
|
|
|
|
#endregion
|
|
}
|