using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using System;
|
|
/**
|
* 无尽模式选择buff
|
* @Author: chenxin
|
* @Date: 2020-10-15 17:00:26
|
*/
|
namespace KTGMGemClient
|
{
|
public class SelectBuffIcon : MonoBehaviour
|
{
|
public Image Icon;
|
|
public Image BgMask;
|
|
public Image Check;
|
|
public Text Name;
|
|
public Text Effect;
|
|
public event Action<int> OnSelectBuffCompleted;
|
|
/// <summary>
|
/// 选择的索引
|
/// </summary>
|
public int Index;
|
|
private void Start()
|
{
|
SetState(EndlessBuffSelectState.Normal);
|
}
|
|
/// <summary>
|
/// 设置选中状态
|
/// </summary>
|
/// <param name="state"></param>
|
public void SetState(EndlessBuffSelectState state)
|
{
|
switch (state)
|
{
|
case EndlessBuffSelectState.Normal:
|
Check.gameObject.SetActive(false);
|
BgMask.gameObject.SetActive(false);
|
|
break;
|
case EndlessBuffSelectState.Unselected:
|
Check.gameObject.SetActive(false);
|
BgMask.gameObject.SetActive(true);
|
break;
|
case EndlessBuffSelectState.Selected:
|
Check.gameObject.SetActive(true);
|
BgMask.gameObject.SetActive(false);
|
break;
|
}
|
}
|
|
public void OnClick()
|
{
|
if (OnSelectBuffCompleted != null)
|
OnSelectBuffCompleted(Index);
|
}
|
|
public void SetIcon(Sprite param)
|
{
|
Icon.sprite = param;
|
}
|
|
public void SetName(string buffName)
|
{
|
Name.text = buffName;
|
}
|
|
/// <summary>
|
/// 设置buff效果描述
|
/// </summary>
|
/// <param name="effect"></param>
|
public void SetEffect(string effect)
|
{
|
Effect.text = effect;
|
}
|
|
/// <summary>
|
/// 设置品级
|
/// </summary>
|
/// <param name="rare"></param>
|
public void SetRare(int rare)
|
{
|
Name.color = EndlessBuffData.GetColorByRare(rare);
|
}
|
}
|
}
|