public static bool HasAnimationEnded([NotNull] IAnimator2D animator2D, string animationName)
 {
     if (!animator2D.get_reachedEndOfAnimation())
     {
         return(!animationName.Equals(animator2D.get_animationName()));
     }
     return(true);
 }
 public static bool HasAnimationReachedLabel([NotNull] IAnimator2D animator2D, string animationName, [NotNull] string label)
 {
     if (!animator2D.get_reachedEndOfAnimation() && !label.Equals(animator2D.get_currentLabel(), StringComparison.OrdinalIgnoreCase))
     {
         return(!animationName.Equals(animator2D.get_animationName()));
     }
     return(true);
 }
Пример #3
0
        public IEnumerator ChangeAnimatedCharacterData(int skinId, Gender gender)
        {
            if (!RuntimeData.characterSkinDefinitions.TryGetValue(skinId, out CharacterSkinDefinition characterSkinDefinition))
            {
                Log.Error($"Could not find character skin definition with id {skinId}.", 211, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\CharacterObject.cs");
                yield break;
            }
            BundleCategory         bundleCategory    = characterSkinDefinition.bundleCategory;
            string                 bundleName        = AssetBundlesUtility.GetAnimatedCharacterDataBundle(bundleCategory);
            AssetBundleLoadRequest bundleLoadRequest = AssetManager.LoadAssetBundle(bundleName);

            m_activeCharacterDataBundleCategory = bundleCategory;
            while (!bundleLoadRequest.get_isDone())
            {
                yield return(null);
            }
            if (AssetManagerError.op_Implicit(bundleLoadRequest.get_error()) != 0)
            {
                Log.Error($"Failed to load asset bundle named '{bundleName}' for character skin {characterSkinDefinition.get_displayName()} ({characterSkinDefinition.get_id()}): {bundleLoadRequest.get_error()}", 230, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\CharacterObject.cs");
                yield break;
            }
            AssetReference animatedCharacterDataReference = characterSkinDefinition.GetAnimatedCharacterDataReference(gender);
            AssetLoadRequest <AnimatedCharacterData> animatedCharacterDataLoadRequest = animatedCharacterDataReference.LoadFromAssetBundleAsync <AnimatedCharacterData>(bundleName);

            while (!animatedCharacterDataLoadRequest.get_isDone())
            {
                yield return(null);
            }
            if (AssetManagerError.op_Implicit(animatedCharacterDataLoadRequest.get_error()) != 0)
            {
                AssetManager.UnloadAssetBundle(bundleName);
                m_activeCharacterDataBundleCategory = BundleCategory.None;
                Log.Error(string.Format("Failed to load requested {0} asset from bundle '{1}' for character skin {2} ({3}): {4}", "AnimatedCharacterData", bundleName, characterSkinDefinition.get_displayName(), characterSkinDefinition.get_id(), animatedCharacterDataLoadRequest.get_error()), 247, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\CharacterObject.cs");
                yield break;
            }
            AnimatedCharacterData newAnimatedCharacterData = animatedCharacterDataLoadRequest.get_asset();

            yield return(newAnimatedCharacterData.LoadTimelineResources());

            AnimatedCharacterData animatedCharacterData = GetAnimatedCharacterData();

            if (null != animatedCharacterData)
            {
                string animatedCharacterDataBundle = AssetBundlesUtility.GetAnimatedCharacterDataBundle(m_animatedCharacterDataBundleCategory);
                animatedCharacterData.UnloadTimelineResources();
                AssetManager.UnloadAssetBundle(animatedCharacterDataBundle);
                m_animatedCharacterDataBundleCategory = BundleCategory.None;
            }
            SetAnimatedCharacterData(newAnimatedCharacterData);
            m_animatedCharacterDataBundleCategory = m_activeCharacterDataBundleCategory;
            m_activeCharacterDataBundleCategory   = BundleCategory.None;
            IAnimator2D animator       = GetAnimator();
            int         animationFrame = animator.get_currentFrame();

            yield return(SetAnimatorDefinition());

            animator.set_currentFrame(animationFrame);
        }
Пример #4
0
 public unsafe CharacterAnimationCallback([NotNull] IAnimator2D animator2D)
 {
     //IL_001a: Unknown result type (might be due to invalid IL or missing references)
     //IL_0024: Expected O, but got Unknown
     //IL_0031: Unknown result type (might be due to invalid IL or missing references)
     //IL_003b: Expected O, but got Unknown
     m_animator2D = animator2D;
     m_animator2D.add_AnimationStarted(new AnimationStartedEventHandler((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_animator2D.add_AnimationEnded(new AnimationEndedEventHandler((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
 }
Пример #5
0
        protected unsafe void InitializeAnimator()
        {
            //IL_0012: Unknown result type (might be due to invalid IL or missing references)
            //IL_001c: Expected O, but got Unknown
            IAnimator2D animator = GetAnimator();

            if (animator != null)
            {
                animator.add_AnimationLooped(new AnimationLoopedEventHandler((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
                m_animationCallback = new CharacterAnimationCallback(animator);
            }
        }
Пример #6
0
        protected unsafe void ReleaseAnimator()
        {
            //IL_0012: Unknown result type (might be due to invalid IL or missing references)
            //IL_001c: Expected O, but got Unknown
            IAnimator2D animator = GetAnimator();

            if (animator != null)
            {
                animator.remove_AnimationLooped(new AnimationLoopedEventHandler((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
                ClearAnimatorDefinition();
            }
        }