Ejemplo n.º 1
0
        public void SetData(CombinationSlotState state, long blockIndex, int slotIndex)
        {
            lockText.text = string.Format(
                L10nManager.Localize("UI_UNLOCK_CONDITION_STAGE"),
                state.UnlockStage);
            _data      = state;
            _slotIndex = slotIndex;
            var unlock = States.Instance.CurrentAvatarState?.worldInformation
                         .IsStageCleared(state.UnlockStage) ?? false;

            lockText.gameObject.SetActive(!unlock);
            lockImage.gameObject.SetActive(!unlock);
            unlockText.gameObject.SetActive(false);
            progressText.gameObject.SetActive(false);
            progressBar.gameObject.SetActive(false);
            if (unlock)
            {
                var canUse = state.Validate(States.Instance.CurrentAvatarState, blockIndex);
                if (state.Result is null)
                {
                    resultView.Clear();
                }
                else
                {
                    canUse = canUse && state.Result.itemUsable.RequiredBlockIndex <= blockIndex;
                    if (canUse)
                    {
                        resultView.Clear();
                    }
                    else
                    {
                        resultView.SetData(new Item(state.Result.itemUsable));
                    }

                    progressText.text = state.Result.itemUsable.GetLocalizedName();
                }

                unlockText.gameObject.SetActive(canUse);
                progressText.gameObject.SetActive(!canUse);
                progressBar.gameObject.SetActive(!canUse);
                SubscribeOnBlockIndex(blockIndex);
                Widget.Find <BottomMenu>()?.UpdateCombinationNotification();
            }

            progressBar.maxValue = state.RequiredBlockIndex;
            progressBar.value    = blockIndex - state.StartBlockIndex;
            sliderText.text      = $"({progressBar.value} / {progressBar.maxValue})";
        }
Ejemplo n.º 2
0
        private void SelectSlot()
        {
            if (_data.Validate(States.Instance.CurrentAvatarState,
                               Game.Game.instance.Agent.BlockIndex))
            {
                if (Game.Game.instance.Stage.IsInStage)
                {
                    return;
                }

                Widget.Find <Menu>().CombinationClick(_slotIndex);
            }
            else
            {
                ShowPopup();
            }
        }