Example #1
0
    public static void RePlayMatchingSpeed(GameObject _target, float _duraiton, float _delayTime = 0)
    {
        if (_duraiton == 0)
        {
            return;
        }
        NsEffectManager.RunReplayEffect(_target, true);
        FXRoot fr = _target.GetComponent <FXRoot>();

        if (fr != null)
        {
            if (_delayTime > 0 || _duraiton != fr.length)
            {
                fr.Play(_delayTime, fr.length / _duraiton);
            }
            else
            {
                fr.Play();
            }
        }
        else
        {
            Debug.Log(_target.name + "找不到FXRoot组件!");
        }
    }
Example #2
0
 public void DoBuffEffect(string _assetName, Transform _parent)
 {
     if (!CanShow)
     {
         return;
     }
     if (_assetName.Length == 0 || _assetName == "0")
     {
         return;
     }
     if (buffDic.ContainsKey(_assetName) && buffDic[_assetName] != null)
     {
         buffDic[_assetName].SetActive(true);
         RePlay(buffDic[_assetName]);
     }
     else
     {
         if (!waitList.ContainsKey(_assetName))
         {
             waitList[_assetName] = true;
             AssetMng.GetEffectInstance(_assetName, (x) =>
             {
                 if (x == null)
                 {
                     return;
                 }
                 if (this.gameObject == null)
                 {
                     Destroy(x);
                     return;
                 }
                 buffDic[_assetName] = x;
                 x.SetMaskLayer(this.gameObject.layer);
                 if (_parent == null)
                 {
                     x.transform.parent = this.transform;
                 }
                 else
                 {
                     x.transform.parent = _parent;
                 }
                 x.transform.localScale       = Vector3.one;
                 x.transform.localEulerAngles = Vector3.zero;
                 x.transform.localPosition    = Vector3.zero;
                 x.SetActive(waitList[_assetName]);
                 FXRoot fr = x.GetComponent <FXRoot>();
                 if (fr != null)
                 {
                     fr.isWorldMatrix = true;
                 }
                 waitList.Remove(_assetName);
             }, true);
         }
         else if (!waitList[_assetName])
         {
             waitList[_assetName] = true;
         }
     }
 }
Example #3
0
    public static void AdjustSpeedRuntime(GameObject _target, float _fSpeedRate)
    {
        NsEffectManager.AdjustSpeedRuntime(_target, _fSpeedRate);
        FXRoot fr = _target.GetComponent <FXRoot>();

        if (fr != null)
        {
            fr.Speed = _fSpeedRate;
        }
    }
Example #4
0
    protected void TryBindSceneRelation(SceneConfigData _data)
    {
        if (!finalObjDic.ContainsKey(_data.Name) || finalObjDic[_data.Name] == null)
        {
            if (prefabAssetBundleRefDic.ContainsKey(_data.Name) && prefabAssetBundleRefDic[_data.Name] != null && prefabAssetBundleRefDic[_data.Name].assetBundle != null)
            {
                UnityEngine.Object obj = null;

                UnityEngine.Object[] list = prefabAssetBundleRefDic[_data.Name].assetBundle.LoadAllAssets();
                if (list.Length > 0)
                {
                    obj = list[0];
                }
                finalObjDic[_data.Name] = GameObject.Instantiate(obj, new Vector3(10000, 10000, 10000), Quaternion.identity) as GameObject;
                FXRoot fr = finalObjDic[_data.Name].GetComponent <FXRoot>();
                if (fr == null)
                {
                    fr = finalObjDic[_data.Name].AddComponent <FXRoot>();
                    fr.InitLength();
                }
                if (finalObjDic[_data.Name] != null)
                {
                    finalObjDic[_data.Name].name = _data.Name;
                    finalObjDic[_data.Name].SetActive(false);
                }
                else
                {
                    finalObjDic.Remove(_data.Name);
                    Debug.LogError("asset ref " + _data.Name + " is null ,please check it !");
                }
                prefabAssetBundleRefDic[_data.Name].assetBundle.Unload(false);
            }
            else
            {
                Debug.LogError("找不到名为 " + _data.Name + " 的预制资源,请检查!如果前面没有其他加载报错,有可能是配置表和资源名称的大小写不匹配的问题!");
            }
        }
        if (_data == null || _data.sceneAsset == null || _data.sceneAsset.gameObjectRelationship == null)
        {
            Debug.LogError("配置文件有问题,请检查!");
            return;
        }
        if (!finalObjDic.ContainsKey(_data.Name) || finalObjDic[_data.Name] == null)
        {
            Debug.LogError("找不到名为 " + _data.Name + "的预制,请检查");
            return;
        }
        ProcessGameObjectRelation(finalObjDic[_data.Name], _data.sceneAsset.gameObjectRelationship);
        finalObjDic[_data.Name].transform.parent = finalObjCacheTrans;
    }
Example #5
0
    public static void Stop(GameObject _target)
    {
        NsEffectManager.SetReplayEffect(_target);
        FXRoot fr = _target.GetComponent <FXRoot>();

        if (fr != null)
        {
            fr.Stop();
        }
        else
        {
            Debug.Log(_target.name + "找不到FXRoot组件!");
        }
    }
Example #6
0
 void OnEnable()
 {
     if (Effect == null)
     {
         return;
     }
     if (fxRoot == null)
     {
         fxRoot = Effect.GetComponent <FXRoot>();
     }
     if (fxRoot != null)
     {
         fxRoot.Play(0.1f, 1.0f);
     }
     //    GameCenter.mainPlayerMng.MainPlayerInfo.OnBaseUpdate += OnMainPlayerUpdateLevel;
 }
Example #7
0
    public static void RePlay(GameObject _target, float _delayTime = 0)
    {
        NsEffectManager.RunReplayEffect(_target, true);
        FXRoot fr = _target.GetComponent <FXRoot>();

        if (fr != null)
        {
            if (_delayTime > 0)
            {
                fr.Play(_delayTime, 1.0f);
            }
            else
            {
                fr.Play();
            }
        }
        else
        {
            Debug.Log(_target.name + "找不到FXRoot组件!");
        }
    }