65 lines
2.2 KiB
C#
65 lines
2.2 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)
|
|
{
|
|
this.index = index;
|
|
this.fishData = fishData;
|
|
var playerFishData = GContext.container.Resolve<PlayerFishData>();
|
|
float maxWeight = playerFishData.GetDataMaxWeight(fishData.ID);
|
|
int maxMastery = playerFishData.GetMaxMastery(fishData.ID);
|
|
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;
|
|
}
|
|
}
|