示例#1
0
    void RenderTaskProgress(GameEntity product)
    {
        ProgressImage.sprite = Icon.sprite;

        if (Task.IsPending)
        {
            ProgressIcon.fillAmount = 1;
            Show(ProgressImage);

            Show(PendingTaskIcon);
        }
        else
        {
            // active task
            Hide(PendingTaskIcon);

            if (Task.IsFeatureUpgrade)
            {
                var featureName = (Task as TeamTaskFeatureUpgrade).NewProductFeature.Name;

                // feature upgrade progress
                var cooldownName = $"company-{product.company.Id}-upgradeFeature-{featureName}";
                Cooldowns.HasCooldown(Q, cooldownName, out SimpleCooldown cooldown);

                var progress = CurrentIntDate - cooldown.StartDate;
                var percent  = (float)progress / (cooldown.EndDate - cooldown.StartDate);

                ProgressIcon.fillAmount = percent;
            }
            else
            {
                Hide(ProgressImage);
            }
        }
    }