62 lines
1.4 KiB
C#
62 lines
1.4 KiB
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class PersonalRecordItem : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler
|
|
{
|
|
public int id;
|
|
|
|
public Text fishName;
|
|
|
|
public Text dateText;
|
|
|
|
public Text mapNameText;
|
|
|
|
public Text fishLengthText;
|
|
|
|
public Text fishWeightText;
|
|
|
|
public Image fishIcon;
|
|
|
|
public Image NewImage;
|
|
|
|
[SerializeField]
|
|
private FishNetStars fishNetStars;
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
if (id != -1 && Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerPersonalRecords[id].isNew)
|
|
{
|
|
Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerPersonalRecords[id].isNew = !Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerPersonalRecords[id].isNew;
|
|
NewImage.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
if ((bool)FScriptsHandler.Instance)
|
|
{
|
|
SetStars();
|
|
}
|
|
else
|
|
{
|
|
Invoke("SetStars", 0.1f);
|
|
}
|
|
}
|
|
|
|
public void SetStars()
|
|
{
|
|
if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerPersonalRecords.Count > 0)
|
|
{
|
|
if (id == -1)
|
|
{
|
|
fishNetStars.gameObject.SetActive(value: false);
|
|
}
|
|
else
|
|
{
|
|
fishNetStars.SetStarsByFishWeight(Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerPersonalRecords[id].fishSpecies, Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerPersonalRecords[id].weight);
|
|
}
|
|
}
|
|
}
|
|
}
|