先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
87 lines
2.2 KiB
C#
87 lines
2.2 KiB
C#
using asap.core;
|
|
using GameCore;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class HomeMapBtn : MonoBehaviour, IUIRedPoint
|
|
{
|
|
string key = "Home.Map";
|
|
public GameObject redPoint;
|
|
public GameObject redpoint_big;
|
|
public TMP_Text text_redpoint_big;
|
|
Button _btn;
|
|
void Awake()
|
|
{
|
|
_btn = GetComponent<Button>();
|
|
RedPointManager.Instance.AddRedPoint(key, this);
|
|
}
|
|
void Start()
|
|
{
|
|
_btn.onClick.AddListener(OnClick);
|
|
}
|
|
async void OnClick()
|
|
{
|
|
var _playerFishData = GContext.container.Resolve<PlayerFishData>();
|
|
if (_playerFishData.IsOpenMap)
|
|
{
|
|
GameObject go = await UIManager.Instance.ShowUI(UITypes.FishingMapPanel);
|
|
if (go != null)
|
|
{
|
|
GContext.Publish(new HideHomePanelEvent());
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
var _fishingEventData = GContext.container.Resolve<FishingEventData>();
|
|
ToastPanel.Show(_fishingEventData.GetTipforUnlocked(_playerFishData.MapTipforUnlocked));
|
|
}
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
SetRedPointState(RedPointManager.Instance.GetRedPointState(key));
|
|
}
|
|
public void SetRedPointState(bool state)
|
|
{
|
|
if (redpoint_big != null && text_redpoint_big != null)
|
|
{
|
|
if (!state)
|
|
{
|
|
redpoint_big.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
int count = RedPointManager.Instance.GetRedPointCount(key);
|
|
if (count > 1)
|
|
{
|
|
redpoint_big.SetActive(true);
|
|
if (count > 99)
|
|
{
|
|
text_redpoint_big.text = "99+";
|
|
}
|
|
else
|
|
{
|
|
text_redpoint_big.text = count.ToString();
|
|
}
|
|
state = false;
|
|
}
|
|
else
|
|
{
|
|
redpoint_big.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
if (redPoint != null)
|
|
{
|
|
redPoint.SetActive(state);
|
|
}
|
|
}
|
|
private void OnDestroy()
|
|
{
|
|
RedPointManager.Instance.RemoveRedPoint(key);
|
|
}
|
|
|
|
}
|