54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class TabItem : MonoBehaviour
|
|
{
|
|
public CustomItem customItem;
|
|
|
|
public Image showIcon;
|
|
public Text nameText;
|
|
public Sprite nochoseSprite;
|
|
public Sprite choseSprite;
|
|
public Font nochoseFont;
|
|
public Font choseFont;
|
|
|
|
public void PointIn(BaseEventData data)
|
|
{
|
|
showIcon.gameObject.SetActive(true);
|
|
GetComponent<Image>().sprite = choseSprite;
|
|
//联动
|
|
if (customItem != null)
|
|
{
|
|
nameText.fontSize = 20;
|
|
nameText.font = choseFont;
|
|
nameText.color= Color.white;
|
|
customItem.PointIn(null);
|
|
}
|
|
}
|
|
|
|
public void PointOut(BaseEventData data)
|
|
{
|
|
showIcon.gameObject.SetActive(false);
|
|
GetComponent<Image>().sprite = nochoseSprite;
|
|
//联动
|
|
if(customItem != null)
|
|
{
|
|
nameText.fontSize = 15;
|
|
nameText.font = nochoseFont;
|
|
nameText.color = new Color(148f / 255f, 184f / 255f, 1, 1);
|
|
customItem.PointOut(null);
|
|
}
|
|
}
|
|
|
|
public void Click(BaseEventData data)
|
|
{
|
|
if (customItem != null)
|
|
{
|
|
customItem.EnterCity();
|
|
}
|
|
}
|
|
}
|