先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
88 lines
2.3 KiB
C#
88 lines
2.3 KiB
C#
using asap.core;
|
|
using EnhancedUI.EnhancedScroller;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TraveMapItem : EnhancedScrollerCellView
|
|
{
|
|
public bool isRight;
|
|
public Animation ani;
|
|
public Image icon;
|
|
public TMP_Text text_name;
|
|
public Button btn_visit;
|
|
public GameObject locked;
|
|
public GameObject empty;
|
|
public GameObject line;
|
|
public GameObject bg_bra;
|
|
public Image bar;
|
|
public GameObject done;
|
|
public GameObject ship;
|
|
public TraveMapItemData data;
|
|
public Action<TraveMapItemData> onClickAction;
|
|
IUIService service;
|
|
ShowImageData imageData = null;
|
|
|
|
private void Awake()
|
|
{
|
|
imageData = new ShowImageData(icon);
|
|
service = GContext.container.Resolve<IUIService>();
|
|
btn_visit.onClick.AddListener(OnClick);
|
|
}
|
|
private void OnClick()
|
|
{
|
|
onClickAction?.Invoke(data);
|
|
}
|
|
|
|
public void PlayAni()
|
|
{
|
|
if (isRight)
|
|
{
|
|
ani.Play("ship_move");
|
|
}
|
|
else
|
|
{
|
|
ani.Play("ship_move_left");
|
|
}
|
|
}
|
|
void SetIcon()
|
|
{
|
|
if (imageData == null)
|
|
{
|
|
imageData = new ShowImageData(icon);
|
|
}
|
|
imageData.SetName(data.icon);
|
|
service.SetImageSprite(imageData);
|
|
}
|
|
public void SetData(TraveMapItemData _data)
|
|
{
|
|
data = _data;
|
|
gameObject.SetActive(true);
|
|
text_name.text = data.name;
|
|
btn_visit.gameObject.SetActive(data.isVisit && data.type <= TraveMapType.current);
|
|
SetIcon();
|
|
if (data.index == 0)
|
|
{
|
|
locked.SetActive(false);
|
|
empty.SetActive(false);
|
|
line.SetActive(false);
|
|
done.SetActive(false);
|
|
ship.SetActive(false);
|
|
bg_bra.SetActive(false);
|
|
bar.fillAmount = 0;
|
|
}
|
|
else
|
|
{
|
|
locked.SetActive(data.type == TraveMapType.locked);
|
|
empty.SetActive(data.type == TraveMapType.comingSoon);
|
|
line.SetActive(data.type > TraveMapType.current);
|
|
done.SetActive(data.type <= TraveMapType.current);
|
|
ship.SetActive(data.type == TraveMapType.current);
|
|
bg_bra.SetActive(true);
|
|
bar.fillAmount = data.type <= TraveMapType.current ? 1 : 0;
|
|
}
|
|
}
|
|
}
|