Files
MinFt/Client/Assets/Scripts/UI/Grade/GradeAquariumFishUI.cs
2026-04-27 12:07:32 +08:00

67 lines
2.4 KiB
C#

using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class GradeAquariumFishUI : MonoBehaviour
{
public enum FishDirection
{
Left,
Right
}
public FishDirection fishDirection;
public Button button;
public GameObject fish;
public Transform model;
public TMP_Text text_name;
public TMP_Text text_weight;
public TMP_Text text_pts;
//public GameObject empty;
public Image empty_icon;
public GameObject loading;
public FishData fishData { set; get; }
public Transform AvatarPos { set; get; }
public Fish FishGo { set; get; }
public bool isAvatar { set; get; }
public int index { set; get; }
private void Reset()
{
button = GetComponent<Button>();
fish = transform.Find("fish").gameObject;
model = transform.Find("model").GetComponent<Transform>();
text_name = transform.Find("fish/text_name").GetComponent<TMP_Text>();
text_weight = transform.Find("fish/info/text_weight").GetComponent<TMP_Text>();
text_pts = transform.Find("fish/info/text_pts").GetComponent<TMP_Text>();
//empty = transform.Find("empty").gameObject;
empty_icon = transform.Find("empty/icon").GetComponent<Image>();
loading = transform.Find("loading").gameObject;
}
public void SetData(FishData fishData, int index)
{
var _tables = GContext.container.Resolve<Tables>();
this.index = index;
this.fishData = fishData;
var playerFishData = GContext.container.Resolve<PlayerFishData>();
float maxWeight = playerFishData.GetDataMaxWeight(fishData.ID);
DropPackageList dropPackageList = _tables.TbDrop[fishData.DropID].DropList;
int maxMastery = Mathf.RoundToInt(dropPackageList.DropCountList[0] * maxWeight / fishData.BaseWeight);
fish.gameObject.SetActive(true);
loading.SetActive(true);
//empty.SetActive(false);
button.enabled = false;
text_name.text = LocalizationMgr.GetText(fishData.Name_l10n_key);
text_pts.text = LocalizationMgr.GetFormatTextValue("UI_FishingRewardPanel_101014", ConvertTools.GetNumberString2(maxMastery));
text_weight.text = LocalizationMgr.GetWeight(maxWeight);
isAvatar = maxWeight > 0;
}
public Vector3 FishModelPos()
{
return transform.localPosition + model.localPosition;
}
}