Пример #1
0
 private void InitBase(eEFFECT_TARGET eType, EFFECT_INFO effectInfo, GameObject goParent, Vector3 v3Target)
 {
     this.m_eEffectTarget = eType;
     this.m_kEffectInfo   = effectInfo;
     if (this.m_CasterChar != null)
     {
         Nr3DCharBase nr3DCharBase = this.m_CasterChar.Get3DChar();
         if (nr3DCharBase != null)
         {
             this.m_fScale = this.m_kEffectInfo.SCALE * nr3DCharBase.GetDiffCharScale();
         }
         else
         {
             this.m_fScale = this.m_kEffectInfo.SCALE;
         }
     }
     else
     {
         this.m_fScale = this.m_kEffectInfo.SCALE;
     }
     if (this.m_fScale < this.m_kEffectInfo.SCALE)
     {
         this.m_fScale = this.m_kEffectInfo.SCALE;
     }
     this.m_fStartTime = Time.time;
     this.m_goParent   = goParent;
     this.m_v3Target   = v3Target + this.m_kEffectInfo.DIFFPOS;
     this.m_fLifeTime  = this.m_kEffectInfo.LIFE_TIME;
     this.m_eMakeScene = Scene.CurScene;
 }
Пример #2
0
    public bool RequestEffectBundle(string effectKind, bool bForceReserve)
    {
        if (this.m_kEffectGameObject.ContainsKey(effectKind))
        {
            return(true);
        }
        if (this.m_kReserveEffect.ContainsKey(effectKind))
        {
            return(true);
        }
        if (this._IsImmediateMake(effectKind))
        {
            return(true);
        }
        EFFECT_INFO effectInfo = this.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(false);
        }
        string path = string.Format("Effect/{0}/{1}", effectInfo.EFFECT_TYPE.ToString(), effectInfo.BUNDLE_PATH);

        NrTSingleton <NkBundleCallBack> .Instance.RequestBundleCallBackRunTime(path, NkBundleCallBack.EffectBundleStackName, new NkBundleParam.funcParamBundleCallBack(this._EffectBundleDownloadCompleted), effectInfo, true);

        this.m_kReserveEffect.Add(effectKind, new List <NkEffectUnit>());
        if (bForceReserve && !this.m_liForceReserve.Contains(effectKind))
        {
            this.m_liForceReserve.Add(effectKind);
        }
        return(true);
    }
Пример #3
0
    public NkEffectUnit(EFFECT_INFO effectInfo, NkBattleChar OrderChar)
    {
        GameObject   gameObject   = null;
        Transform    transform    = null;
        Nr3DCharBase nr3DCharBase = OrderChar.Get3DChar();

        if (nr3DCharBase != null)
        {
            gameObject = nr3DCharBase.GetRootGameObject();
            transform  = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS);
        }
        Vector3 v3Target = Vector3.zero;

        if (null != transform)
        {
            v3Target = transform.position;
        }
        if (effectInfo.EFFECT_POS == eEFFECT_POS.BONE && nr3DCharBase != null)
        {
            gameObject = nr3DCharBase.GetBoneRootObject();
            if (gameObject == null)
            {
                gameObject = nr3DCharBase.GetRootGameObject();
            }
            v3Target   = Vector3.zero;
            v3Target.y = -1f;
        }
        this.m_CasterChar = OrderChar;
        this.InitBase(eEFFECT_TARGET.POSITION, effectInfo, gameObject, v3Target);
    }
Пример #4
0
    public NkEffectUnit(EFFECT_INFO effectInfo, NkBattleChar OrderChar, bool bAttachEffectPos, bool CheckScale)
    {
        GameObject   gameObject   = null;
        Nr3DCharBase nr3DCharBase = OrderChar.Get3DChar();

        if (nr3DCharBase != null)
        {
            gameObject = nr3DCharBase.GetRootGameObject();
        }
        Vector3   v3Target  = Vector3.zero;
        Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS);

        if (null != effectPos)
        {
            v3Target = effectPos.position;
        }
        if (effectInfo.EFFECT_POS == eEFFECT_POS.BONE && nr3DCharBase != null)
        {
            gameObject = nr3DCharBase.GetBoneRootObject();
            if (gameObject == null)
            {
                gameObject = nr3DCharBase.GetRootGameObject();
            }
            v3Target   = Vector3.zero;
            v3Target.y = -1f;
        }
        this.m_CasterChar = OrderChar;
        if (bAttachEffectPos && effectPos != null)
        {
            gameObject = effectPos.gameObject;
            v3Target   = Vector3.zero;
        }
        this.m_CheckScale = CheckScale;
        this.InitBase(eEFFECT_TARGET.GAMEOBJECT, effectInfo, gameObject, v3Target);
    }
Пример #5
0
    public uint AddCenterPosEffect(string effectKind, NkBattleChar kBattleChar, Vector3 v3CenterPos)
    {
        if (this.m_bDontMakeEffect && NrTSingleton <NkEffectManager> .Instance.isEffectLimit(effectKind))
        {
            return(0u);
        }
        if (kBattleChar == null)
        {
            return(0u);
        }
        Nr3DCharBase nr3DCharBase = kBattleChar.Get3DChar();

        if (nr3DCharBase == null)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS);

        if (null != effectPos)
        {
            v3CenterPos.y = effectPos.position.y;
        }
        NkEffectUnit kEffectUnit = new NkEffectUnit(effectInfo, nr3DCharBase.GetRootGameObject(), v3CenterPos);

        return(this._AddEffect(kEffectUnit));
    }
Пример #6
0
 public void AddEffectInfo(EFFECT_INFO kEffectInfo)
 {
     if (this.m_kEffectInfoList.ContainsKey(kEffectInfo.EFFECT_KIND))
     {
         return;
     }
     this.m_kEffectInfoList.Add(kEffectInfo.EFFECT_KIND, kEffectInfo);
 }
Пример #7
0
    public static string FileName(string effectKind)
    {
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(string.Empty);
        }
        return(string.Format("Effect/{0}/{1}", effectInfo.EFFECT_TYPE.ToString(), effectInfo.BUNDLE_PATH));
    }
Пример #8
0
    private void _EffectBundleDownloadCompleted(ref IDownloadedItem wItem, object obj)
    {
        if (wItem.isCanceled)
        {
            return;
        }
        if (!wItem.canAccessAssetBundle)
        {
            return;
        }
        EFFECT_INFO eFFECT_INFO = obj as EFFECT_INFO;

        if (eFFECT_INFO == null)
        {
            return;
        }
        GameObject gameObject = wItem.mainAsset as GameObject;

        if (gameObject == null)
        {
            return;
        }
        gameObject.SetActive(false);
        AudioSource[] components = gameObject.GetComponents <AudioSource>();
        AudioSource[] array      = components;
        for (int i = 0; i < array.Length; i++)
        {
            AudioSource audioSource = array[i];
            if (audioSource.clip == null)
            {
                audioSource.clip = TsAudioManager.Instance.GetTempClip();
            }
        }
        if (TsPlatform.IsMobile && TsPlatform.IsEditor)
        {
            NrTSingleton <NkClientLogic> .Instance.SetEditorShaderConvert(ref gameObject);
        }
        bool flag = this.m_liForceReserve.Contains(eFFECT_INFO.EFFECT_KIND);

        if (this.bUseEffectCache || flag)
        {
            this._RegisterEffectGameObject(gameObject, eFFECT_INFO.EFFECT_KIND);
            this._ProcessReverseEffect(eFFECT_INFO.EFFECT_KIND);
        }
        else
        {
            this._ProcessReverseEffect(eFFECT_INFO.EFFECT_KIND, gameObject);
        }
        if (flag)
        {
            this.m_liForceReserve.Remove(eFFECT_INFO.EFFECT_KIND);
        }
    }
Пример #9
0
    public uint AddEffect(string effectKind, NrCharBase kCharBase)
    {
        if (kCharBase == null)
        {
            return(0u);
        }
        Nr3DCharBase nr3DCharBase = kCharBase.Get3DChar();

        if (nr3DCharBase == null)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        GameObject gameObject = nr3DCharBase.GetRootGameObject();
        Vector3    v3Target   = Vector3.zero;
        Transform  effectPos  = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS);

        if (null != effectPos)
        {
            v3Target = effectPos.position;
            if (effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM)
            {
                gameObject = effectPos.gameObject;
            }
        }
        if (effectInfo.EFFECT_POS == eEFFECT_POS.BONE)
        {
            gameObject = nr3DCharBase.GetBoneRootObject();
            if (gameObject == null)
            {
                gameObject = nr3DCharBase.GetRootGameObject();
            }
            v3Target   = Vector3.zero;
            v3Target.y = -1f;
        }
        NkEffectUnit kEffectUnit;

        if (effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM)
        {
            kEffectUnit = new NkEffectUnit(effectInfo, gameObject);
        }
        else
        {
            kEffectUnit = new NkEffectUnit(effectInfo, gameObject, v3Target);
        }
        return(this._AddEffect(kEffectUnit));
    }
Пример #10
0
    public override bool ParseDataFromNDT(TsDataReader dr)
    {
        foreach (TsDataReader.Row data in dr)
        {
            EFFECT_INFO eFFECT_INFO = new EFFECT_INFO();
            eFFECT_INFO.SetData(data);
            eFFECT_INFO.EFFECT_TYPE = NrTSingleton <NkEffectManager> .Instance.ConvertEffectType(eFFECT_INFO.strEffectType);

            eFFECT_INFO.EFFECT_POS = NrTSingleton <NkEffectManager> .Instance.ConvertEffectPos(eFFECT_INFO.strEffectPos);

            NrTSingleton <NkEffectManager> .Instance.AddEffectInfo(eFFECT_INFO);
        }
        return(true);
    }
Пример #11
0
    public uint AddEffect(string effectKind, Vector3 v3Target)
    {
        if (Vector3.zero == v3Target)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        NkEffectUnit kEffectUnit = new NkEffectUnit(effectInfo, v3Target);

        return(this._AddEffect(kEffectUnit));
    }
Пример #12
0
    public uint AddCasterEffect(string effectKind, NkBattleChar kBattleChar)
    {
        if (this.m_bDontMakeEffect && NrTSingleton <NkEffectManager> .Instance.isEffectLimit(effectKind))
        {
            return(0u);
        }
        if (kBattleChar == null)
        {
            return(0u);
        }
        Nr3DCharBase nr3DCharBase = kBattleChar.Get3DChar();

        if (nr3DCharBase == null)
        {
            return(0u);
        }
        Transform effectTarget = nr3DCharBase.GetEffectTarget();

        if (effectTarget == null)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        GameObject goTarget  = nr3DCharBase.GetRootGameObject();
        Transform  effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS);

        if (null != effectPos && effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM)
        {
            goTarget = effectPos.gameObject;
        }
        NkEffectUnit kEffectUnit;

        if (effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM)
        {
            kEffectUnit = new NkEffectUnit(effectInfo, goTarget);
        }
        else
        {
            kEffectUnit = new NkEffectUnit(effectInfo, kBattleChar);
        }
        return(this._AddEffect(kEffectUnit));
    }
Пример #13
0
    public uint AddEffect(string effectKind, GameObject goTarget, NkEffectUnit.DeleteCallBack DelCallBack)
    {
        if (goTarget == null)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        return(this._AddEffect(new NkEffectUnit(effectInfo, goTarget)
        {
            DelCallBack = DelCallBack
        }));
    }
Пример #14
0
    public NkEffectUnit(EFFECT_INFO effectInfo, NkBattleChar OrderChar, Vector3 v3CenterTarget)
    {
        GameObject   goParent     = null;
        Nr3DCharBase nr3DCharBase = OrderChar.Get3DChar();

        if (nr3DCharBase != null)
        {
            goParent = nr3DCharBase.GetRootGameObject();
        }
        Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS);

        if (null != effectPos)
        {
            v3CenterTarget.y = effectPos.position.y;
        }
        this.m_CasterChar = OrderChar;
        this.InitBase(eEFFECT_TARGET.POSITION, effectInfo, goParent, v3CenterTarget);
    }
Пример #15
0
    public uint AddEffect(string effectKind, NkBattleChar kBattleChar)
    {
        if (this.m_bDontMakeEffect && NrTSingleton <NkEffectManager> .Instance.isEffectLimit(effectKind))
        {
            return(0u);
        }
        if (kBattleChar == null)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        NkEffectUnit kEffectUnit = new NkEffectUnit(effectInfo, kBattleChar);

        return(this._AddEffect(kEffectUnit));
    }
Пример #16
0
    public uint AddEffect(string effectKind, GameObject goTarget)
    {
        if (this.m_bDontMakeEffect && NrTSingleton <NkEffectManager> .Instance.isEffectLimit(effectKind))
        {
            return(0u);
        }
        if (goTarget == null)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        NkEffectUnit kEffectUnit = new NkEffectUnit(effectInfo, goTarget);

        return(this._AddEffect(kEffectUnit));
    }
Пример #17
0
    public uint AddEffectByTarget(string effectKind, NrCharBase kCharBase, Vector3 diffPos)
    {
        if (kCharBase == null)
        {
            return(0u);
        }
        Nr3DCharBase nr3DCharBase = kCharBase.Get3DChar();

        if (nr3DCharBase == null)
        {
            return(0u);
        }
        EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind);

        if (effectInfo == null)
        {
            return(0u);
        }
        NkEffectUnit kEffectUnit = new NkEffectUnit(effectInfo, nr3DCharBase.GetRootGameObject(), diffPos);

        return(this._AddEffect(kEffectUnit));
    }
Пример #18
0
 public NkEffectUnit(EFFECT_INFO effectInfo, GameObject goParent, Vector3 v3Target)
 {
     this.InitBase(eEFFECT_TARGET.POSITION, effectInfo, goParent, v3Target);
 }
Пример #19
0
 public NkEffectUnit(EFFECT_INFO effectInfo, Vector3 v3Target)
 {
     this.InitBase(eEFFECT_TARGET.POSITION, effectInfo, null, v3Target);
 }
Пример #20
0
 public NkEffectUnit(EFFECT_INFO effectInfo, GameObject goTarget)
 {
     this.InitBase(eEFFECT_TARGET.GAMEOBJECT, effectInfo, goTarget, Vector3.zero);
 }