Ejemplo n.º 1
0
        private void assertStateAfterResult(JudgementResult judgementResult, TaikoMascotAnimationState expectedState)
        {
            AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}",
                    () => applyNewResult(judgementResult));

            AddAssert($"state is {expectedState.ToString().ToLower()}", () => allMascotsIn(expectedState));
        }
Ejemplo n.º 2
0
        public DrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle)
        {
            Origin = Anchor = Anchor.BottomLeft;

            State      = new Bindable <TaikoMascotAnimationState>(startingState);
            LastResult = new Bindable <JudgementResult>();

            animations = new Dictionary <TaikoMascotAnimationState, TaikoMascotAnimation>();
        }
Ejemplo n.º 3
0
        private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex)
        {
            var texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}");

            if (frameIndex == 0 && texture == null)
            {
                texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}");
            }

            return(texture);
        }
Ejemplo n.º 4
0
        public void TestClearStateOnClearedSwell(bool kiai, TaikoMascotAnimationState expectedStateAfterClear)
        {
            AddStep("set beatmap", () => setBeatmap(kiai));

            createDrawableRuleset();

            assertStateAfterResult(new JudgementResult(new Swell(), new TaikoSwellJudgement())
            {
                Type = HitResult.Great
            }, TaikoMascotAnimationState.Clear);
            AddUntilStep($"state reverts to {expectedStateAfterClear.ToString().ToLower()}", () => allMascotsIn(expectedStateAfterClear));
        }
Ejemplo n.º 5
0
        public TaikoMascotAnimation(TaikoMascotAnimationState state)
        {
            InternalChild = textureAnimation = createTextureAnimation(state).With(animation =>
            {
                animation.Origin = animation.Anchor = Anchor.BottomLeft;
                animation.Scale  = new Vector2(0.51f); // close enough to stable
            });

            RelativeSizeAxes = Axes.Both;
            Origin           = Anchor = Anchor.BottomLeft;

            // needs to be always present to prevent the animation clock consuming time spent when not present.
            AlwaysPresent = true;
        }
        private void assertStateAfterResult(JudgementResult judgementResult, TaikoMascotAnimationState expectedState)
        {
            TaikoMascotAnimationState[] mascotStates = null;

            AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}",
                    () =>
            {
                applyNewResult(judgementResult);
                // store the states as soon as possible, so that the delay between steps doesn't incorrectly fail the test
                // due to not checking if the state changed quickly enough.
                Schedule(() => mascotStates = animatedMascots.Select(mascot => mascot.State.Value).ToArray());
            });

            AddAssert($"state is {expectedState.ToString().ToLower()}", () => mascotStates.All(state => state == expectedState));
        }
Ejemplo n.º 7
0
        private static TextureAnimation createTextureAnimation(TaikoMascotAnimationState state)
        {
            switch (state)
            {
            case TaikoMascotAnimationState.Clear:
                return(new ClearMascotTextureAnimation());

            case TaikoMascotAnimationState.Idle:
            case TaikoMascotAnimationState.Kiai:
            case TaikoMascotAnimationState.Fail:
                return(new ManualMascotTextureAnimation(state));

            default:
                throw new ArgumentOutOfRangeException(nameof(state), $"Mascot animations for state {state} are not supported");
            }
        }
Ejemplo n.º 8
0
 private bool someMascotsIn(TaikoMascotAnimationState state) => mascots.Any(d => d.State.Value == state);
Ejemplo n.º 9
0
 private bool allMascotsIn(TaikoMascotAnimationState state) => mascots.All(d => d.State.Value == state);
 private bool animatedMascotsIn(TaikoMascotAnimationState state) => animatedMascots.Any(d => d.State.Value == state);
Ejemplo n.º 11
0
            public ManualMascotTextureAnimation(TaikoMascotAnimationState state)
            {
                this.state = state;

                IsPlaying = false;
            }
Ejemplo n.º 12
0
 private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex)
 => skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}");