コード例 #1
0
    private void AniInfoAssetLoaded(params object[] args)
    {
        AnimationProxyInfo animationProxyInfo = args[0] as AnimationProxyInfo;

        if (animationProxyInfo != null)
        {
            this.mAnimations = animationProxyInfo.mAnimations;
            this.mMainClip   = animationProxyInfo.mMainClip;
            for (int i = 0; i < this.mAnimations.Length; i++)
            {
                AnimationProxy.AnimationInfo animationInfo = this.mAnimations[i];
                if (animationInfo != null)
                {
                    if (!this.mAnimationMaps.ContainsKey(animationInfo.strName))
                    {
                        this.mAnimationMaps.Add(animationInfo.strName, animationInfo.strPath);
                    }
                }
            }
            if (!this.mAnimationMaps.ContainsKey(this.mMainClip.strName))
            {
                this.mAnimationMaps.Add(this.mMainClip.strName, this.mMainClip.strPath);
            }
            this.configLoaded = true;
            this.OnStart();
            if (this.onAnimationConfigLoaded != null)
            {
                this.onAnimationConfigLoaded(this);
            }
        }
    }
コード例 #2
0
    void Awake()
    {
        mAnimation = gameObject.GetComponent <Animation>();
        if (mAnimation == null)
        {
            mAnimation = gameObject.AddComponent <Animation>();
        }

        if (mAnimation == null)
        {
            return;
        }

        ///禁用再启用恢复动作开始可能未播放的bug
        mAnimation.playAutomatically = true;
        mAnimation.enabled           = false;
        mAnimation.enabled           = true;

        if (mAnimations == null)
        {
//            LogSystem.LogWarning("mAnimations is NULL " + gameObject.name);
            return;
        }

        for (int i = 0; i < mAnimations.Length; i++)
        {
            AnimationProxy.AnimationInfo aInfo = mAnimations[i];
            if (aInfo == null)
            {
                continue;
            }

            if (!mAnimationMaps.ContainsKey(aInfo.strName))
            {
                mAnimationMaps.Add(aInfo.strName, aInfo.strPath);
            }
        }

        if (!mAnimationMaps.ContainsKey(mMainClip.strName))
        {
            mAnimationMaps.Add(mMainClip.strName, mMainClip.strPath);
        }
    }
コード例 #3
0
 private void Awake()
 {
     this.mGo        = base.gameObject;
     this.mAnimation = this.mGo.GetComponent <Animation>();
     if (this.mAnimation == null)
     {
         this.mAnimation = this.mGo.AddComponent <Animation>();
     }
     if (this.mAnimation == null)
     {
         return;
     }
     this.mAnimation.playAutomatically = true;
     this.mAnimation.enabled           = false;
     this.mAnimation.enabled           = true;
     if (this.mAnimations == null)
     {
         LogSystem.LogWarning(new object[]
         {
             "mAnimations is NULL " + this.mGo.name
         });
         return;
     }
     for (int i = 0; i < this.mAnimations.Length; i++)
     {
         AnimationProxy.AnimationInfo animationInfo = this.mAnimations[i];
         if (animationInfo != null)
         {
             if (!this.mAnimationMaps.ContainsKey(animationInfo.strName))
             {
                 this.mAnimationMaps.Add(animationInfo.strName, animationInfo.strPath);
             }
         }
     }
     if (this.mAnimations.Length > 0)
     {
         this.configLoaded = true;
     }
     if (!this.mAnimationMaps.ContainsKey(this.mMainClip.strName))
     {
         this.mAnimationMaps.Add(this.mMainClip.strName, this.mMainClip.strPath);
     }
     if (!string.IsNullOrEmpty(this.modelAcionID))
     {
         string strFileName = DelegateProxy.StringBuilder(new object[]
         {
             "Config/AnimationInfos/",
             this.modelAcionID
         });
         DelegateProxy.LoadAsset(strFileName, new AssetCallBack(this.AniInfoAssetLoaded));
     }
     else
     {
         this.OnStart();
         if (this.onAnimationConfigLoaded != null)
         {
             this.onAnimationConfigLoaded(this);
         }
         LogSystem.LogWarning(new object[]
         {
             "Model does not has model action info,",
             this.mGo.name
         });
     }
 }