先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
89 lines
2.7 KiB
C#
89 lines
2.7 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using GameCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class AquariumEggTips : MonoBehaviour, IAquariumTips
|
|
{
|
|
public Image icon;
|
|
public TMP_Text text_name;
|
|
public Image bar;
|
|
public TMP_Text text_time;
|
|
public Button btn_speedup;
|
|
public GameObject[] card_info;
|
|
AquariumSlotData slotData;
|
|
AquariumSlot aquariumSlot;
|
|
public void SetActive(bool value)
|
|
{
|
|
gameObject.SetActive(value);
|
|
}
|
|
public void SetData(AquariumSlot aquariumSlot)
|
|
{
|
|
this.aquariumSlot = aquariumSlot;
|
|
this.slotData = aquariumSlot.slotData;
|
|
|
|
for (int i = 0; i < card_info.Length; i++)
|
|
{
|
|
card_info[i].SetActive(false);
|
|
}
|
|
|
|
UpdateBar(ZZTimeHelper.UtcNow());
|
|
|
|
AquariumEgg aquariumEgg = GContext.container.Resolve<Tables>().TbAquariumEgg.GetOrDefault(slotData.eggId);
|
|
|
|
if (aquariumEgg != null)
|
|
{
|
|
text_name.text = LocalizationMgr.GetText(aquariumEgg.Name_l10n_key);
|
|
var quantity = aquariumEgg.HatchFishQuantity;
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(icon, aquariumEgg.Icon);
|
|
|
|
List<int> hatchFishQuality = aquariumEgg.HatchFishQuality;
|
|
bool showNum = false;
|
|
int max = 1;
|
|
int min = hatchFishQuality[0];
|
|
if (hatchFishQuality.Count > 1)
|
|
{
|
|
showNum = true;
|
|
max = hatchFishQuality[^1];
|
|
}
|
|
int index = 0;
|
|
TMP_Text text_fish_num;
|
|
for (int i = 0; i < hatchFishQuality.Count; i++)
|
|
{
|
|
index = hatchFishQuality[i] - 1;
|
|
if (index < card_info.Length)
|
|
{
|
|
card_info[index].SetActive(true);
|
|
text_fish_num = card_info[index].transform.Find("text_fish_num").GetComponent<TMP_Text>();
|
|
if (showNum)
|
|
{
|
|
text_fish_num.text = $"{min}~{max}";
|
|
}
|
|
else
|
|
{
|
|
text_fish_num.text = min.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool UpdateBar(DateTime dateTime)
|
|
{
|
|
float time = (float)(dateTime - slotData.startTime).TotalHours + slotData.accelerationHatch;
|
|
bar.fillAmount = time / slotData.hatchTime;
|
|
int timeRemaining = (int)((slotData.hatchTime - time) * 3600);
|
|
if (timeRemaining <= 0)
|
|
{
|
|
return false;
|
|
}
|
|
TimeSpan timeSpan = new TimeSpan(0, 0, timeRemaining);
|
|
text_time.text = ConvertTools.ConvertTime2(timeSpan);
|
|
return true;
|
|
}
|
|
}
|