예제 #1
0
    private void ResizeProgressBarGlobal()
    {
        barSize   = ProgressBarGlobal.GetComponent <RectTransform>().sizeDelta;
        barSize.x = ((100 * achievement.GetGlobalProgress() / achievement.GetNumberOf()) * totalBarSizeGlobal) / 100;

        ProgressBarGlobal.GetComponent <RectTransform>().sizeDelta = barSize;
    }
예제 #2
0
    public void InitializeButton(Achievement a)
    {
        achievement = a;

        #region Main Info
        LabelTitle.text       = achievement.GetName();                                                                 //NOMBRE
        LabelDescription.text = achievement.GetDescription();                                                          //DESCRIPTION
        LabelID.text          = "ID: " + achievement.GetID();                                                          //ID
        SpriteIcon.GetComponent <Image>().sprite = IconManager._instance.GetIconByID(achievement.GetIconID());         //ICON
        LabelReward.text       = achievement.GetReward();
        LabelCreationTime.text = achievement.GetCreationTime().Date.ToString();

        colorBackground.sprite = _colorDBInstance.colors[achievement.GetColorID()].bigBG;
        #endregion
        #region ProgressBar
        LabelGoal.text     = achievement.GetRepetitions().ToString();
        LabelProgress.text = achievement.GetProgress().ToString();
        totalBarSize       = ProgressBar.GetComponent <RectTransform>().sizeDelta.x;
        ResizeProgressBar();
        CheckProgress();
        #endregion
        #region ProgressBarTotal
        LabelGoalTotal.text     = achievement.GetNumberOf().ToString();
        LabelProgressTotal.text = achievement.GetGlobalProgress().ToString();
        totalBarSizeGlobal      = ProgressBarGlobal.GetComponent <RectTransform>().sizeDelta.x;
        ResizeProgressBarGlobal();
        #endregion
        #region Adittional Info
        LabelProgreso.text = "Progreso " + _typeDBInstance.types[achievement.GetTypeOf()].adjetivo;
        LabelObjetivo.text = "Debes realizar el objetivo " + achievement.GetRepetitions() + " veces por " +
                             _typeDBInstance.types[achievement.GetTypeOf()].singular + " durante " + achievement.GetNumberOf() + " " +
                             _typeDBInstance.types[achievement.GetTypeOf()].plural + ".";

        LabelRestantes.text = (achievement.GetNumberOf() - achievement.GetGlobalProgress()) + " " + _typeDBInstance.types[achievement.GetTypeOf()].plural + " restantes";

        #endregion
        #region Pause / Resume
        if (achievement.IsPaused())
        {
            buttonPause.SetActive(false);
            buttonResume.SetActive(true);
            pausedBackground.SetActive(true);
        }
        #endregion
    }