Example #1
0
    //初始化Hash表
    private void FInit()
    {
        string name;
        string path;
        Object obj = Resources.Load("Config\\EffectConfig");

        effectConfig = Instantiate(obj) as EffectConfig;
        for (int i = 0; i < effectConfig.keys.Count; i++)
        {
            name = effectConfig.keys[i];
            path = effectConfig.values[i];
            for (int count = 0; count < effectConfig.Num[i]; count++)
            {
                FCreateEffect(name, path);
            }
        }
    }
Example #2
0
 public static void Init()
 {
     ItemConfig.Init();
     TestConfig.Init();
     WindowConfig.Init();
     EffectConfig.Init();
     EquipConfig.Init();
     IconConfig.Init();
     LanguageConfig.Init();
     WorldBossConfig.Init();
     NpcConfig.Init();
     MapConfig.Init();
     DungeonConfig.Init();
     DamageNumConfig.Init();
     SkillConfig.Init();
     MobAssetConfig.Init();
     //初始化结束
 }
Example #3
0
 public static void Register()
 {
     DialogConfig.Init();
     EffectConfig.Init();
     GameBouquetsConfig.Init();
     GameDailyTaskConfig.Init();
     GameGuideConfig.Init();
     GameInitConfig.Init();
     GDailyTaskGiftConfig.Init();
     GuiConfig.Init();
     IPConfig.Init();
     LuckDrawConfig.Init();
     RepConfig.Init();
     RoleConfig.Init();
     SoundConfig.Init();
     StrConfig.Init();
     TalkConfig.Init();
 }
Example #4
0
    /** 结束显示 */
    public virtual void dispose()
    {
        _loadTool.clear();

        _config = null;
        _unit   = null;
        _bullet = null;
        _scene  = null;
        _isOver = false;

        if (_gameObject != null)
        {
            // GameObject.Destroy(_gameObject);
            _gameObject = null;
        }

        _transform = null;
    }
Example #5
0
    public static GameObject LoadEffect(int id)
    {
        GameObject prefab = null;
        var        config = EffectConfig.Get(id);

        if (AssetSource.effectFromEditor)
        {
#if UNITY_EDITOR
            var path = StringUtil.Contact(AssetPath.EFFECT_ROOT_PATH, config.package, "/", config.assetName, ".prefab");
            prefab = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>(path);
#endif
        }
        else
        {
            var bundleName = StringUtil.Contact("effect/", config.package);
            prefab = AssetBundleUtility.Instance.SyncLoadAsset(bundleName, config.assetName) as GameObject;
        }

        return(prefab);
    }
Example #6
0
    private void toAddEffect(EffectConfig config)
    {
        int num = _effectNumDic.addValue(config.id, 1);

        //超了
        if (config.plusMax > 0 && num > config.plusMax)
        {
            return;
        }

        UnitEffect effect = GameC.pool.unitEffectPool.getOne();

        effect.setConfig(config);
        effect.setScene(_scene);
        effect.bindUnit(_unit);

        _effectList.add(effect);

        //开始
        effect.init();
    }
Example #7
0
        public override void setConfig(EffectConfig config)
        {
            if (!_g1)
            {
                _m1 = instance.Type.GetMethod("setConfig", 1);
                _g1 = true;
            }

            if (_m1 != null && !_b1)
            {
                _b1    = true;
                _p1[0] = config;
                appdomain.Invoke(_m1, instance, _p1);
                _p1[0] = null;
                _b1    = false;
            }
            else
            {
                base.setConfig(config);
            }
        }
Example #8
0
        /// <summary>
        /// Called by the web controller to start an effect (after first stopping any active effect).
        /// Configuration and active state is persisted to file.
        /// </summary>
        /// <param name="config"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public async Task StartEffect(EffectConfig config, EffectHandler handler)
        {
            // Cancel previous handler if there is one
            _effectCancellationTokenSource?.Cancel();

            // Start the new handler
            _effectCancellationTokenSource = new CancellationTokenSource();
            handler.Start(_effectCancellationTokenSource.Token);
            ActiveHandler = handler;

            // Save config including state
            var otherConfig = config.GetType() == typeof(XmasEffectConfig)
                ? (EffectConfig)await _storageService.LoadConfig <WarmupEffectConfig>()
                : (EffectConfig)await _storageService.LoadConfig <XmasEffectConfig>();

            otherConfig.Active = false;
            config.Active      = true;
            await _storageService.SaveConfig(otherConfig);

            await _storageService.SaveConfig(config);
        }
Example #9
0
        public void ApplyConfiguration(EffectConfig config)
        {
            if (context != null)
            {
                throw new InvalidOperationException();
            }

            foreach (var configurableField in configurableFields)
            {
                var field = configurableField.Field;
                try
                {
                    var value = config.GetValue(field.Name);
                    field.SetValue(this, value);
                }
                catch (Exception e)
                {
                    Trace.WriteLine($"Failed to apply configuration for {field.Name}:\n{e}");
                }
            }
        }
Example #10
0
    public static void LoadEffectAsync(int id, Action <bool, UnityEngine.Object> callBack)
    {
        GameObject prefab = null;
        var        config = EffectConfig.Get(id);

        if (AssetSource.effectFromEditor)
        {
#if UNITY_EDITOR
            var path = StringUtil.Contact(AssetPath.EFFECT_ROOT_PATH, config.package, "/", config.assetName, ".prefab");
            prefab = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>(path);
            if (callBack != null)
            {
                callBack(prefab != null, prefab);
            }
#endif
        }
        else
        {
            var bundleName = StringUtil.Contact("effect/", config.package);
            AssetBundleUtility.Instance.AsyncLoadAsset(bundleName, config.assetName, callBack);
        }
    }
Example #11
0
    public static EffectConfig Get(int id)
    {
        if (!inited)
        {
            Debug.Log("EffectConfigConfig 还未完成初始化。");
            return(null);
        }

        if (configs.ContainsKey(id))
        {
            return(configs[id]);
        }

        EffectConfig config = null;

        if (rawDatas.ContainsKey(id))
        {
            config = configs[id] = new EffectConfig(rawDatas[id]);
            rawDatas.Remove(id);
        }

        return(config);
    }
Example #12
0
    private IEnumerator PlayRoutine(EffectConfig cfg)
    {
        var animObject = Instantiate(this.gameObject);
        var fx         = animObject.GetComponent <EffectManager>();
        var fxAnim     = fx.GetComponent <Animator>();

        var offsetv = cfg.offset;

        fxAnim.Play(cfg.animationName);

        if (cfg.attachToSprite)
        {
            animObject.transform.SetParent(cfg.targetTransform);
        }

        if (cfg.flip)
        {
            TransformUtils.Flip(animObject.transform);
        }

        if (cfg.align == EffectAlign.CENTER)
        {
            animObject.transform.position = cfg.targetTransform.position + offsetv;
        }
        else if (cfg.align == EffectAlign.BOTTOM)
        {
            var trans = cfg.targetTransform;
            var targetObjectSprite = trans.Find("Animation").GetComponent <SpriteRenderer>();
            var animationSprite    = animObject.GetComponent <SpriteRenderer>();
            var spriteBottom       = trans.position.y - targetObjectSprite.bounds.size.y / 2;
            animObject.transform.position = new Vector3(trans.position.x, spriteBottom) + offsetv;
        }

        yield return(new WaitForSeconds(GetClip(cfg.animationName).length));

        Destroy(animObject);
    }
Example #13
0
    public override void init()
    {
        base.init();

        if (_config.effectID > 0)
        {
            //绑自己的
            if (BaseC.constlist.bulletCast_isSelfHit(_levelConfig.castType))
            {
                _unit.show.addEffect(_config.effectID);
            }
            else
            {
                EffectConfig config = EffectConfig.get(_config.effectID);

                _effect = GameC.pool.unitEffectPool.getOne();
                _effect.setConfig(config);
                _effect.setScene(_scene);
                _effect.bindBullet(_bullet);

                _effect.init();
            }
        }
    }
Example #14
0
    /** 移除特效 */
    public void removeEffect(int id)
    {
        int num = _effectNumDic.get(id);

        if (num <= 0)
        {
            return;
        }

        _effectNumDic.put(id, --num);

        EffectConfig config = EffectConfig.get(id);

        //还超
        if (config.plusMax > 0 && num >= config.plusMax)
        {
            return;
        }

        SList <UnitEffect> unitEffects = _effectList;
        UnitEffect         effect;

        for (int i = 0, len = unitEffects.length(); i < len; ++i)
        {
            effect = unitEffects[i];

            //是
            if (effect.id == id)
            {
                unitEffects.remove(i);
                effect.dispose();
                GameC.pool.unitEffectPool.back(effect);
                break;
            }
        }
    }
    private void OnGUI()
    {
        if (GUILayout.Button("Begin"))
        {
            List <string> names     = new List <string>();
            List <string> path      = new List <string>();
            DirectoryInfo directory = new DirectoryInfo("Assets/Resources/Effect");
            FileInfo[]    files     = directory.GetFiles("*prefab");
            string        lastName  = ".prefab";
            //string firstName = "C:\\Users\\60294\\Documents\\Project_Fire\\Project_Fire\\Assets\\Resources\\";

            foreach (FileInfo file in files)
            {
                string trueName = file.Name.Substring(0, file.Name.Length - lastName.Length);
                names.Add(trueName);

                path.Add("Effect\\" + trueName);
            }

            EffectConfig effectConfig = (EffectConfig)ScriptableObject.CreateInstance(typeof(EffectConfig));
            effectConfig.CreateConfig(names, path);
            AssetDatabase.CreateAsset(effectConfig, "Assets/Resources/Config/EffectConfig.asset");
        }
    }
    private static void Add_Item(ReadStream rs)
    {
        int
            id =

            rs.ReadInt();



        string
            name =

            rs.ReadString();



        string
            resname =

            rs.ReadString();



        int
            placetype =

            rs.ReadInt();



        float
            scale =

            rs.ReadFloat();



        bool
            loop =

            rs.ReadBool();



        int
            level =

            rs.ReadInt();



        int
            type =

            rs.ReadInt();


        EffectConfig new_obj_EffectConfig = new EffectConfig(id, name, resname, placetype, scale, loop, level, type);

        if (dic.ContainsKey(id))
        {
            LogWarning("duplicate key: " + id);
            return;
        }

        dic.Add(id, new_obj_EffectConfig);
        array.Add(new_obj_EffectConfig);
    }
Example #17
0
 public override void SetConfig(EffectConfig configToSet)
 {
     base.SetConfig(configToSet);
     attackPowerBonus = (configToSet as AttackPowerSetEffectConfig).attackPowerBonus;
 }
Example #18
0
 public void AddEffect(EffectConfig effect)
 {
     effects.Add(effect);
 }
Example #19
0
 public override void setConfig(EffectConfig config)
 {
     base.setConfig(config);
 }
Example #20
0
 public override void SetConfig(EffectConfig configToSet)
 {
     base.SetConfig(configToSet);
     ifHasEffect    = (configToSet as ConditionalEffectConfig).ifHasEffect;
     effectsToApply = (configToSet as ConditionalEffectConfig).effectsToApply;
 }
 public override void SetConfig(EffectConfig configToSet)
 {
     base.SetConfig(configToSet);
     effectToAdd    = (configToSet as AddEffectToAbilityEffectConfig).effectToAdd;
     abilityToAddTo = (configToSet as AddEffectToAbilityEffectConfig).abilityToAddTo;
 }
Example #22
0
 public void PlayEffect(EffectConfig config)
 {
     StartCoroutine(PlayRoutine(config));
 }
Example #23
0
 private string GetPath(EffectConfig config) => Path.Combine(_environment.ContentRootPath, config.GetType().Name + ".json");
Example #24
0
 /** 添加或播放特效(场景特效用) */
 public void addOrPlayEffect(int id)
 {
     toAddEffect(EffectConfig.get(id));
 }
Example #25
0
 public override void SetConfig(EffectConfig configToSet)
 {
     base.SetConfig(configToSet);
     tickFreq        = (configToSet as HealOverTimeConfig).tickFrequency;
     baseHealPerTick = (configToSet as HealOverTimeConfig).baseHealPerTick;
 }
 public override void SetConfig(EffectConfig configToSet)
 {
     base.SetConfig(configToSet);
     tickFreq           = (configToSet as DamageOverTimeConfig).tickFrequency;
     attackPowerPercent = (configToSet as DamageOverTimeConfig).attackPowerPercent;
 }
Example #27
0
 public virtual void setConfig(EffectConfig config)
 {
     _config = config;
     id      = config.id;
 }
Example #28
0
 public static void Play(EffectConfig effectConfig)
 {
     Get().PlayEffect(effectConfig);
 }
Example #29
0
 public override void SetConfig(EffectConfig effectConfig)
 {
     base.SetConfig(effectConfig);
     slowPercent = (config as SlowConfig).slowPercent;
 }