// 日付情報から残り時間を所定のフォーマットで返却する
 public string TimeLeftText(DateTime date)
 {
     return(DivRNUtil.DiffTimePresentLabel(date, TimeManager.Instance.m_TimeNow));
 }
Beispiel #2
0
    void Start()
    {
        gameObject.name += "::" + Achievement.fix_id.ToString() + "::" + Achievement.server_state;

        if (!Achievement.IsState_Appear)
        {
            Debug.LogError("Why i am here?");
            return;
        }

        stateProgressGO.SetActive(false);
        stateAchieveGO.SetActive(false);
        stateRewardedGO.SetActive(false);

#if BUILD_TYPE_DEBUG
        //Debug.Log("MissionListItem:" + gameObject.name + ":" + Achievement.AchievementState);
#endif

        //解説
        desc.text = Achievement.Desc;
        // アイテム名
        itemName.text = Achievement.PresentName;
        //プレゼントアイコン
        Achievement.GetPresentIcon(sprite => { icon.sprite = sprite; });
        //プレゼント数
        count.text = Achievement.PresentCount.ToString();

        limitParentGO.SetActive(false);

        // リストを押せるかどうか
        if (Achievement.achievement_category_id == (uint)ACHIEVEMENT_CATEGORY_TYPE.QUEST)
        {
            ItemButton.interactable = true;
        }
        else
        {
            ItemButton.interactable = false;
        }

        //状態:報酬獲得済み
        if (Achievement.IsState_Rewarded)
        {
            stateRewardedGO.SetActive(true);
            return;
        }

        //状態:条件達成済み
        if (Achievement.IsState_Achieve ||
            Achievement.IsState_AchieveEffect)
        {
            stateAchieveGO.SetActive(true);
            //期限
            if (Achievement.HasExpira)
            {
                limitParentGO.SetActive(true);
                limit.text = DivRNUtil.DiffTimePresentLabel(Achievement.ExpiraDate, TimeManager.Instance.m_TimeNow) + "\n";
            }

            return;
        }

        //以降、状態:出現
        stateProgressGO.SetActive(true);

        //期限
        if (Achievement.HasExpira)
        {
            limitParentGO.SetActive(true);
            limit.text = DivRNUtil.DiffTimeMissonLabel(Achievement.ExpiraDate, TimeManager.Instance.m_TimeNow) + "\n";
        }


        //現在の進行度
        hasProgressCountGO.SetActive(false);
        hasNotProgressCountGO.SetActive(false);

        if (Achievement.TotalCount > 0)
        {
            hasProgressCountGO.SetActive(true);
            progressFill.fillAmount = Achievement.ProgressRate;
            //progressText.text = string.Format("{0}/{1}", Achievement.ProgressCount, Achievement.TotalCount);
            progressText.text    = string.Format("{0}", Achievement.ProgressCount);
            progressMaxText.text = string.Format("{0}", Achievement.TotalCount);
        }
        else
        {
            hasNotProgressCountGO.SetActive(true);
        }
    }