示例#1
0
    public void Apply()
    {
        binder           = GetComponentInParent <UIDataBinder>();
        experiencePoints = binder.GetExperiencePoints();

        levelIndicator = levelIndicatorObject.GetComponent <LevelIndicator>();
        levelIndicator.ApplyChanges(experiencePoints.level);

        controller.SetFill(experiencePoints.currentProgress);

        switch (controller.FillType)
        {
        case BarFillType.Static:
            binder.SaveExperience();
            controller.SetFill(experiencePoints.currentProgress);
            controller.UpdateIndicator(experiencePoints.level);
            break;

        case BarFillType.Animated:
            if (experiencePoints.nextProgress != experiencePoints.currentProgress)
            {
                StartCoroutine(AnimateBar());
            }
            break;

        default:
            throw new System.Exception("LevelBarController::Apply() called BarFillController::FillType and it returned null.");
        }
    }
示例#2
0
    private IEnumerator AnimateBar()
    {
        //Wait half seconds
        yield return(new WaitForSeconds(0.5f));

        //Start XP Text Animation
        controller.SetXPText(experiencePoints.claimedExperiencePoints);

        //Set Next Data
        binder.SaveExperience();

        //Update XP Cache
        experiencePoints = binder.GetExperiencePoints();

        //Wait half seconds
        yield return(new WaitForSeconds(0.5f));

        //Call Animation
        StartCoroutine(controller.AnimateFill(experiencePoints.currentProgress));
    }
示例#3
0
    private void ControlState()
    {
        if (isConnected)
        {
            Item[] items = manager.GetItems();
            int    level = binder.GetExperiencePoints().level;
            foreach (var item in items)
            {
                int itemLevel = item.Data.mapData.basicData.requirement;

                if (itemLevel <= level)
                {
                    item.SetItemState(ItemState.Unlocked);
                    item.ApplyIconVisual();
                }
                else
                {
                    item.SetItemState(ItemState.Locked);
                    item.ApplyIconVisual();
                }
            }
        }
    }