예제 #1
0
    IEnumerator OnCancelButtonPicked()
    {
        if (state != State.Edit)
        {
            yield break;
        }

        pickedAnyPart      = false;
        isWaitingFirstPick = false;
        isRecording        = false;
        records            = null;

        cancelEditingButton.SwellAndDisable();
        editButton.enabled        = true;
        saveEditingButton.enabled = false;

        yield return(StartCoroutine(FadeOutVignette()));

        state = State.Show;

        Poser poser = currentShelf.CurrentPoser();

        poser.ApplyPose(Pose.DefaultPose(), 1);
        poser.Highlighted = Highlightable.HighlightDegree.Pale;
        poser.EditEnabled = false;

        UpdateGalleryInfoAndComment(skipComment: true);
    }
예제 #2
0
    public bool Flip(bool toLeft = true, float speedMultiplier = 1)
    {
        int desiredIndex = (toLeft? index + 1 : index - 1);

        if (0 > desiredIndex || desiredIndex >= presets.Count)
        {
            return(false);
        }

        Poser  currentPoser  = CurrentPoser();
        Preset currentPreset = CurrentPreset();

        if (currentPreset.Pose != null)
        {
            currentPoser.StopMotion();
            currentPoser.ApplyPose(currentPreset.Pose, FLIP_DURATION / speedMultiplier / 2);
        }

        index = desiredIndex;

        int tweenSlotBeginIndex = 0;
        int tweenSlotEndIndex   = 0;
        int lastSlotIndex       = SlotsNum - 1;

        if (toLeft)
        {
            tweenSlotBeginIndex = 1;
            tweenSlotEndIndex   = lastSlotIndex;
        }
        else
        {
            tweenSlotBeginIndex = 0;
            tweenSlotEndIndex   = lastSlotIndex - 1;
        }

        for (int i = tweenSlotBeginIndex; i <= tweenSlotEndIndex; i++)
        {
            int     newIndex    = i + (toLeft? -1 : +1);
            Vector3 newPosition = GetSlotPosition(newIndex);
            LTDescr tween       = LeanTween.moveLocal(slots[i].gameObject, newPosition, FLIP_DURATION / speedMultiplier).setEase(LeanTweenType.easeInOutCubic);
            if (i == CenterSlot)
            {
                tween.setOnComplete(OnCenterSlotFlipComplete);
            }
        }

        int   poppingSlotIndex = (toLeft? 0 : lastSlotIndex);
        Poser reusedSlot       = slots[poppingSlotIndex];

        slots.RemoveAt(poppingSlotIndex);

        int halfSlotsNum        = SlotsNum / 2;
        int endPointPresetIndex = index + (toLeft? halfSlotsNum : -halfSlotsNum);

        reusedSlot.ApplyPreset(presets.Get(endPointPresetIndex));

        int pushingSlotIndex = (toLeft? lastSlotIndex : 0);

        slots.Insert(pushingSlotIndex, reusedSlot);

        reusedSlot.transform.localPosition = GetSlotPosition(pushingSlotIndex);

        return(true);
    }