//--------------------------------------------------------------------- void updateComponet(CEffect component, float elapsed_tm) { if (!component.HasStart) { component.start(); } component.update(elapsed_tm); }
//--------------------------------------------------------------------- public List <object> createEffect(int effect_id, string effect_name, int effect_type, float delay_time, Dictionary <string, object> param, EffectTypeEnum effect_generate_type) { CEffect effect = mFactory.buildByEffectElementData(effect_id, effect_name, effect_type, delay_time, param, effect_generate_type); if (effect == null) { return(null); } mSingleEffect.Add(effect); return(effect.ReturnValue); }
//--------------------------------------------------------------------- public CEffect buildByEffectElementData(int effect_id, string effect_name, int effect_type, float delay_time, Dictionary <string, object> param, EffectTypeEnum effect_generate_type) { if (mDicEffectFactory.ContainsKey(effect_name)) { if (mDicEffectFactory[effect_name].getEffectType() != effect_generate_type) { return(null); } CEffect effect_component = mDicEffectFactory[effect_name].createEffect(param); effect_component.setEffectElementData(effect_id, effect_name, (TbDataEffectCompose.EffectElementStruct.EffectTypeEnum)effect_type, delay_time); effect_component.create(param); effect_component.setName(effect_name); return(effect_component); } return(null); }
//--------------------------------------------------------------------- public CEffect buildByEffectElementData(TbDataEffectCompose.EffectElementStruct data, Dictionary <string, object> param, EffectTypeEnum effect_type) { string effect_name = data.EffectName.EffectName; if (mDicEffectFactory.ContainsKey(effect_name)) { if (mDicEffectFactory[effect_name].getEffectType() != effect_type) { return(null); } CEffect effect_component = mDicEffectFactory[effect_name].createEffect(param); effect_component.setEffectElementData(data.EffectId, effect_name, (TbDataEffectCompose.EffectElementStruct.EffectTypeEnum)data.EffectType, data.EffectDelayTime * 0.01f); effect_component.create(param); effect_component.setName(effect_name); return(effect_component); } return(null); }
//--------------------------------------------------------------------- public void create(int vib_component_id, Dictionary <string, object> param, EffectTypeEnum effect_type) { if (vib_component_id < 0) { return; } List <TbDataEffectCompose.EffectElementStruct> data_list = EbDataMgr.Instance.getData <TbDataEffectCompose>(vib_component_id).EffectElements; if (data_list == null || data_list.Count <= 0) { return; } int index = 0; CEffect pre_component = null; foreach (var it in data_list) { if (0 != it.EffectId && null != it.EffectName) { CEffect effect = mFactory.buildByEffectElementData(it, param, effect_type); if (effect == null) { continue; } mComponents.Add(index, effect); ComponentUpdate component_update = new ComponentUpdate(effect, pre_component); mComponentFuncs.Add(component_update); pre_component = effect; index++; } } excute(); }
//--------------------------------------------------------------------- public ComponentUpdate(CEffect componet, CEffect pre_component) { mComponet = componet; mPreComponent = pre_component; }