Beispiel #1
0
    public override string MakeAnimationKey(eCharAnimationType anitype)
    {
        StringBuilder stringBuilder = new StringBuilder(string.Empty);
        string        value         = anitype.ToString();

        if (!this.m_bFaceSoldier)
        {
            bool flag = base.GetParentCharKindInfo().GetCharTribe() == 4;
            if (NrCharAnimation.IsBattleAnimation(anitype) || flag)
            {
                if (!base.IsBattleChar())
                {
                    if (!NrCharAnimation.IsOnlyNormalAnimation(anitype, flag))
                    {
                        stringBuilder.Append(base.GetParentChar().GetWeaponCode());
                    }
                }
                else
                {
                    stringBuilder.Append(base.GetParentBattleChar().GetWeaponCode());
                }
            }
        }
        if (this.IsRideState())
        {
            string value2 = "Camel";
            stringBuilder.Append("_");
            stringBuilder.Append(value2);
        }
        stringBuilder.Append(value);
        return(stringBuilder.ToString().ToLower());
    }
    public string GetAttachTargetName(NrCharDefine.eAT2ItemAssetBundle eItemIndex)
    {
        string result = string.Empty;

        switch (eItemIndex)
        {
        case NrCharDefine.eAT2ItemAssetBundle.hair:
        case NrCharDefine.eAT2ItemAssetBundle.face:
        case NrCharDefine.eAT2ItemAssetBundle.helmet:
            result = "dmhead";
            break;

        case NrCharDefine.eAT2ItemAssetBundle.weapon1:
        case NrCharDefine.eAT2ItemAssetBundle.weapon2:
        {
            bool battleani = true;
            if (!this.m_pkTarget3DChar.IsBattleChar())
            {
                battleani = false;
                if (this.m_pkTargetKind.IsATB(2L))
                {
                    battleani = true;
                }
                else if (this.m_pkTargetKind.GetCharTribe() == 4)
                {
                    battleani = true;
                }
                else if (this.m_pkTarget3DChar.GetParentCharAnimation() == null)
                {
                    Debug.LogWarning("===> Attack Weapon Target Error (" + eItemIndex.ToString() + ") : " + this.m_pkTarget3DChar.GetName());
                }
                else
                {
                    eCharAnimationType currentAniType = this.m_pkTarget3DChar.GetParentCharAnimation().GetCurrentAniType();
                    battleani = NrCharAnimation.IsBattleAnimation(currentAniType);
                }
            }
            result = this.GetWeaponTargetName(eItemIndex, battleani);
            break;
        }

        case NrCharDefine.eAT2ItemAssetBundle.decoration:
            result = "dmback";
            break;

        case NrCharDefine.eAT2ItemAssetBundle.bodyitem:
            result = "dmbody";
            break;

        case NrCharDefine.eAT2ItemAssetBundle.centeritem:
            result = "dmcenter";
            break;
        }
        return(result);
    }
    public void SetCurrentAniType(eCharAnimationType sourceanitype, float fBlendTime)
    {
        if (!NrCharAnimation.IsForcePlayAnimation(sourceanitype) && this.m_eCurrentAniType == sourceanitype && this.IsSameAniPlaying())
        {
            return;
        }
        AnimationClip animationClip = this.m_pkParent3DChar.SetAnimation(sourceanitype, fBlendTime, this.IsLoopAnimation(sourceanitype));

        if (animationClip == null)
        {
            if (this.m_pkParent3DChar is Nr3DCharActor)
            {
                string text = "[" + sourceanitype.ToString() + "] Character Animation Setting failed. Contact me(SSH).";
                NrTSingleton <NrWebAlert> .Instance.PushMsg(text);

                Debug.Log(text);
            }
            return;
        }
        this.m_bLoop = (animationClip.wrapMode == WrapMode.Loop);
        string value = this.m_pkParent3DChar.MakeAnimationKey(sourceanitype);

        if (!animationClip.name.Equals(value))
        {
            sourceanitype = this.FindAniTypeByCode(this.m_pkParent3DChar.GetCurrentAniType());
        }
        this.m_ePrevAniType    = this.m_eCurrentAniType;
        this.m_eCurrentAniType = sourceanitype;
        this._SetCurrentAniState(sourceanitype);
        this.m_bProcessStatus = false;
        this.SetFinishAnimation(false);
        this.m_fAniPlayingTime  = 0f;
        this.m_fAnimationLength = animationClip.length;
        if (!this.m_pkParent3DChar.IsBattleChar())
        {
            NkCharPartControl parentCharPartControl = this.m_pkParent3DChar.GetParentCharPartControl();
            if (parentCharPartControl != null)
            {
                eCharAnimationType prevAniType = this.GetPrevAniType();
                bool flag  = NrCharAnimation.IsBattleAnimation(prevAniType);
                bool flag2 = NrCharAnimation.IsBattleAnimation(sourceanitype);
                if (flag != flag2)
                {
                    parentCharPartControl.ChangeWeaponTarget();
                }
            }
        }
    }
    public float PushNextAniType(eCharAnimationType anitype, bool bForceAction, bool bForceReserved, bool bBlend)
    {
        if (!bForceAction && this.m_eCurrentAniType == anitype && this.m_bLoop)
        {
            return(this.m_fAnimationLength);
        }
        this.m_nSetAniCount = 0;
        bool  flag      = bForceReserved || (!bForceAction && this.GetNextAniCount() > 0);
        float crossFade = this.GetCrossFade(anitype, bBlend);

        if (flag)
        {
            this.m_eNextAniTypeList.Add(new NrCharNextAniInfo(anitype, bBlend));
            this.SetNextAnimation(anitype);
            this.m_bProcessStatus = true;
            return(0f);
        }
        if (NrCharAnimation.IsBattleAnimation(anitype))
        {
            eCharAnimationType randomAniType = this.GetRandomAniType(anitype);
            if (this.m_pkParent3DChar != null && this.m_pkParent3DChar.IsHaveAnimation(randomAniType))
            {
                anitype = randomAniType;
            }
        }
        if (!bForceReserved && this.m_pkParent3DChar is Nr3DCharNonePart && !this.m_pkParent3DChar.IsHaveAnimation(anitype))
        {
            anitype = this.GetSafeAniType(anitype);
        }
        this.m_eNextAniTypeList.Clear();
        this.SetCurrentAniType(anitype, crossFade);
        if (this.m_pkParent3DChar.IsBattleChar())
        {
            if (NrCharAnimation.IsIdleAnimation(this.GetNextAniType(anitype)) && !this.m_pkParent3DChar.GetParentBattleChar().IsLastAttacker)
            {
                eCharAnimationType stayAni = this.m_pkParent3DChar.GetParentBattleChar().GetStayAni();
                this.m_eNextAniTypeList.Add(new NrCharNextAniInfo(stayAni, true));
                this.SetNextAnimation(stayAni);
            }
        }
        else
        {
            this.SetNextAnimation(anitype);
        }
        return(this.m_fAnimationLength);
    }
    public void ProcessAnimation(float deltatime)
    {
        this.m_fAniPlayingTime += deltatime;
        if (!this.m_bProcessStatus && !this.CheckProcessStatus())
        {
            return;
        }
        NrCharNextAniInfo nrCharNextAniInfo = this.PopNextAniType();

        if (nrCharNextAniInfo != null)
        {
            float crossFade = this.GetCrossFade(nrCharNextAniInfo.eAnimationType, nrCharNextAniInfo.bBlend);
            this.SetCurrentAniType(nrCharNextAniInfo.eAnimationType, crossFade);
        }
        else if (this.GetNextAniCount() == 0 && !this.m_bBattleState && !NrCharAnimation.IsIdleAnimation(this.m_eCurrentAniType))
        {
            NrCharBase parentChar = this.m_pkParent3DChar.GetParentChar();
            if (parentChar != null && parentChar.m_kCharMove.IsMoving())
            {
                return;
            }
            this.SetCurrentAniType(this.m_pkParent3DChar.GetIdleAnimation(), 0.3f);
        }
    }