任务系统一半多,商城筛选功能,一些细节和免费包

This commit is contained in:
FloatGaming
2026-03-15 04:27:21 +08:00
parent 416190b23e
commit ec42f2e34b
344 changed files with 32225 additions and 6481 deletions
@@ -1,6 +1,7 @@
using UnityEngine;
using TMPro;
using UnityEngine.UI;
using UnityEngine.Events;
public class taskPrefabController : MonoBehaviour
{
@@ -13,4 +14,53 @@ public class taskPrefabController : MonoBehaviour
public Button rewardButton;
public Image rewardImg;
public Text rewardAmmount;
public void Setup(DailyTaskViewData taskView, int displayIndex, Sprite rewardSprite, UnityAction onRewardClicked)
{
if (taskView == null || taskView.definition == null || taskView.runtimeEntry == null)
{
return;
}
if (taskNumber != null)
{
taskNumber.text = displayIndex.ToString("00");
}
if (taskText != null)
{
taskText.text = taskView.definition.description;
}
if (taskProgress_fillAmount_img != null)
{
float targetValue = Mathf.Max(0.0001f, taskView.definition.targetValue);
float clampedProgress = Mathf.Clamp(taskView.runtimeEntry.progress, 0f, targetValue);
taskProgress_fillAmount_img.fillAmount = clampedProgress / targetValue;
}
if (rewardImg != null)
{
rewardImg.sprite = rewardSprite;
rewardImg.enabled = rewardSprite != null;
}
if (rewardAmmount != null)
{
rewardAmmount.text = taskView.definition.rewardAmount.ToString();
}
if (rewardButton == null)
{
return;
}
rewardButton.onClick.RemoveAllListeners();
if (onRewardClicked != null)
{
rewardButton.onClick.AddListener(onRewardClicked);
}
rewardButton.interactable = taskView.runtimeEntry.isCompleted && !taskView.runtimeEntry.isClaimed;
}
}