44 lines
1.0 KiB
C#
44 lines
1.0 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 = 18;
|
|
nameText.font = choseFont;
|
|
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;
|
|
customItem.PointOut(null);
|
|
}
|
|
}
|
|
}
|