先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
88 lines
3.0 KiB
C#
88 lines
3.0 KiB
C#
using asap.core;
|
|
using GameCore;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class BarItemTips : MonoBehaviour
|
|
{
|
|
public RectTransform content;
|
|
public GameObject arrow;
|
|
|
|
public GameObject rewardEmptyGo1, rewardEmptyGo2;
|
|
public GameObject[] rewardGos;
|
|
public RewardItemNew[] rewards;
|
|
public TMP_Text textTarget, textOwned;
|
|
public Button btnClose;
|
|
public Image require_icon;
|
|
private void Start()
|
|
{
|
|
btnClose.onClick.AddListener(() => gameObject.SetActive(false));
|
|
}
|
|
public void Init(ItemData itemData, string icon, int targetScore, int score)
|
|
{
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(require_icon, icon);
|
|
rewardEmptyGo1.SetActive(true);
|
|
rewardEmptyGo2.SetActive(true);
|
|
rewardGos[0].SetActive(true);
|
|
for (int i = 1; i < rewardGos.Length; i++)
|
|
{
|
|
rewardGos[i].SetActive(false);
|
|
}
|
|
rewards[0].SetData(itemData);
|
|
if (textOwned != null)
|
|
{
|
|
textOwned.text = LocalizationMgr.GetFormatTextValue("UI_item_tips_1", score);
|
|
}
|
|
textTarget.text = LocalizationMgr.GetFormatTextValue("UI_EventRankPopupPanel_18", targetScore);
|
|
}
|
|
public void Init(List<ItemData> items, string icon, int targetScore, int score)
|
|
{
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(require_icon, icon);
|
|
if (items.Count == 1)
|
|
{
|
|
rewardEmptyGo1.SetActive(true);
|
|
rewardEmptyGo2.SetActive(true);
|
|
rewardGos[0].SetActive(true);
|
|
for (int i = 1; i < rewardGos.Length; i++)
|
|
{
|
|
rewardGos[i].SetActive(false);
|
|
}
|
|
rewards[0].SetData(items[0]);
|
|
}
|
|
else if (items.Count > 1)
|
|
{
|
|
rewardEmptyGo1.SetActive(false);
|
|
rewardEmptyGo2.SetActive(false);
|
|
for (int i = 0; i < rewardGos.Length; i++)
|
|
{
|
|
rewardGos[i].SetActive(i < items.Count);
|
|
if (i < items.Count)
|
|
rewards[i].SetData(items[i]);
|
|
}
|
|
}
|
|
textOwned.text = LocalizationMgr.GetFormatTextValue("UI_item_tips_1", score);
|
|
textTarget.text = LocalizationMgr.GetFormatTextValue("UI_EventRankPopupPanel_16", targetScore);
|
|
}
|
|
public void SetContent(Vector3 pos)
|
|
{
|
|
content.position = pos;
|
|
RectTransform rectTransform = transform.GetComponent<RectTransform>();
|
|
float limit = (rectTransform.rect.width - content.rect.width - 80) / 2;
|
|
//边界检测
|
|
var localPosition = content.transform.localPosition;
|
|
localPosition.x = 0;
|
|
if (localPosition.x > limit)
|
|
{
|
|
localPosition.x = limit;
|
|
}
|
|
else if (localPosition.x < -limit)
|
|
{
|
|
localPosition.x = -limit;
|
|
}
|
|
arrow.transform.position = new Vector3(pos.x, arrow.transform.position.y);
|
|
content.transform.localPosition = localPosition;
|
|
}
|
|
}
|