Beispiel #1
0
        public static LoadedDance LoadDance([NotNull] string filePath, int songPosition)
        {
            IBodyAnimationSource danSource = null, apaSource = null, apgSource = null;
            var danceAnimationLoaded = false;
            var suggestedPosition    = InvalidDancePosition;

            // About number of main dance animations and special/another appeal animations:
            // Most songs have 1 dance animation (i.e. animation for 1 idol, multiplied by 3/4/5 etc.) and 1 appeal animation
            // (i.e. for 1 idol when player completes FC before the big note). Or, n dance animation and n appeal animations
            // (e.g. 虹色letters [nijile], n=2 for position 1 and 2). Some songs have 1 dance animation and n appeal animations
            // (e.g. クルリウタ [kururi], n=3 for position 1, 2 and 3). Rarely a song has n dance animations and 1 appeal animation
            // (i.e. RE@DY!! [ready0], n=5). For each dance animation, there is a dan_ object; for each appeal animation, there
            // is an apa_ or apg_ object. So there isn't really a guarantee when dan, apa or apg is non-null.

            if (!danceAnimationLoaded)
            {
                // First try with legacy bundles
                var(dan, apa, apg) = LoadDanceLegacy(filePath, songPosition, out suggestedPosition);

                if (dan != null)
                {
                    danSource            = new LegacyBodyAnimationSource(dan);
                    danceAnimationLoaded = true;
                }

                if (apa != null)
                {
                    apaSource = new LegacyBodyAnimationSource(apa);
                }

                if (apg != null)
                {
                    apgSource = new LegacyBodyAnimationSource(apg);
                }
            }

            if (!danceAnimationLoaded)
            {
                // If failed, try the new one (from ~mid 2018?)
                var(dan, apa, apg) = LoadDanceCompiled(filePath, songPosition, out suggestedPosition);

                if (dan != null)
                {
                    danSource            = new CompiledBodyAnimationSource(dan);
                    danceAnimationLoaded = true;
                }

                if (apa != null)
                {
                    apaSource = new CompiledBodyAnimationSource(apa);
                }

                if (apg != null)
                {
                    apgSource = new CompiledBodyAnimationSource(apg);
                }
            }

            var animationSet = AnimationSet.Create(danSource, apaSource, apgSource);

            return(new LoadedDance(animationSet, suggestedPosition));
        }
Beispiel #2
0
        public static DanceAnimationSet <IBodyAnimationSource> LoadDance([NotNull] string filePath, int motionNumber, int formationNumber)
        {
            IBodyAnimationSource defaultSource = null, anotherSource = null, specialSource = null, gorgeousSource = null;
            bool anyAnimationLoaded;
            int  suggestedPosition;

            // About number of main dance animations and special/another appeal animations:
            // Most songs have 1 dance animation (i.e. animation for 1 idol, multiplied by 3/4/5 etc.) and 1 appeal animation
            // (i.e. for 1 idol when player completes FC before the big note). Or, n dance animation and n appeal animations
            // (e.g. 虹色letters [nijile], n=2 for position 1 and 2). Some songs have 1 dance animation and n appeal animations
            // (e.g. クルリウタ [kururi], n=3 for position 1, 2 and 3). Rarely a song has n dance animations and 1 appeal animation
            // (i.e. RE@DY!! [ready0], n=5). For each dance animation, there is a dan_ object; for each appeal animation, there
            // is an apa_ or apg_ object. So there isn't really a guarantee when dan, apa or apg is non-null.

            {
                // First try with legacy bundles
                var loaded = LoadDanceLegacy(filePath, motionNumber, formationNumber);

                suggestedPosition  = loaded.SuggestedPosition;
                anyAnimationLoaded = loaded.Default != null || loaded.Special != null || loaded.Another != null || loaded.Gorgeous != null;

                if (loaded.Default != null)
                {
                    defaultSource = new LegacyBodyAnimationSource(loaded.Default);
                }

                if (loaded.Special != null)
                {
                    specialSource = new LegacyBodyAnimationSource(loaded.Special);
                }

                if (loaded.Another != null)
                {
                    anotherSource = new LegacyBodyAnimationSource(loaded.Another);
                }

                if (loaded.Gorgeous != null)
                {
                    gorgeousSource = new LegacyBodyAnimationSource(loaded.Gorgeous);
                }
            }

            if (!anyAnimationLoaded)
            {
                // If failed, try the new one (from ~mid 2018?)
                var loaded = LoadDanceCompiled(filePath, motionNumber, formationNumber);

                suggestedPosition = loaded.SuggestedPosition;

                if (loaded.Default != null)
                {
                    defaultSource = new CompiledBodyAnimationSource(loaded.Default);
                }

                if (loaded.Special != null)
                {
                    specialSource = new CompiledBodyAnimationSource(loaded.Special);
                }

                if (loaded.Another != null)
                {
                    anotherSource = new CompiledBodyAnimationSource(loaded.Another);
                }

                if (loaded.Gorgeous != null)
                {
                    gorgeousSource = new CompiledBodyAnimationSource(loaded.Gorgeous);
                }
            }

            var animationSet = AnimationSet.CreateDance(suggestedPosition, defaultSource, specialSource, anotherSource, gorgeousSource);

            return(animationSet);
        }