This commit is contained in:
2026-07-03 11:38:37 +08:00
parent 75d3f4cf34
commit 43e81ee930
2 changed files with 25 additions and 2 deletions
@@ -54,13 +54,13 @@ public class LevelGiftitem : MonoBehaviour
}
if ((giftType & LevelGiftType.JingYing) != 0)
{
img_JingYingLocal.gameObject.SetActive(true);
img_JingYingLocal.gameObject.SetActive(false);
if (showDuiGou)
img_JingYingDuiGou.gameObject.SetActive(true);
}
if ((giftType & LevelGiftType.ZhiZun) != 0)
{
img_ZhiZunLocal.gameObject.SetActive(true);
img_ZhiZunLocal.gameObject.SetActive(false);
if (showDuiGou)
img_ZhiZunDuiGou.gameObject.SetActive(true);
}
@@ -92,6 +92,9 @@ public class ZhanLing_Panel : SubUIBase
slider_LevelExp.maxValue = expNeeded;
slider_LevelExp.value = Mathf.Clamp(exp, 0, expNeeded);
// 战令剩余时间
RefreshActiveTime();
// 清空旧列表
for (int i = levelGiftitemParent.childCount - 1; i >= 0; i--)
Destroy(levelGiftitemParent.GetChild(i).gameObject);
@@ -335,4 +338,24 @@ public class ZhanLing_Panel : SubUIBase
_ => "", // 道具 - 本地图标
};
}
/// <summary>刷新战令剩余时间(格式:30天10:01:50)</summary>
private void RefreshActiveTime()
{
if (tmp_ActiveTime == null || _config == null) return;
long now = BeijingTimeManager.Instance.CurrentTimestampMs / 1000;
long remain = _config.endTime - now;
if (remain <= 0)
{
tmp_ActiveTime.text = "已结束";
return;
}
int days = (int)(remain / 86400);
int hours = (int)((remain % 86400) / 3600);
int mins = (int)((remain % 3600) / 60);
int secs = (int)(remain % 60);
tmp_ActiveTime.text = $"{days}天{hours:D2}:{mins:D2}:{secs:D2}";
}
}