Exemple #1
0
        //-------------------------------------------------------------------------
        public static bool belongEffect <T>(EffectData effect_data) where T : Effect
        {
            TbDataEffect data_effect = EbDataMgr.Instance.getData <TbDataEffect>(effect_data.EffectId);

            if (data_effect == null)
            {
                return(false);
            }

            if (typeof(T).Name == data_effect.ScriptName)
            {
                return(true);
            }

            return(false);
        }
Exemple #2
0
        //-------------------------------------------------------------------------
        public object operate(string operate_id)
        {
            if (operate_id == TbDataItem.MainOperateInfo.OperateId)
            {
                var def_actor      = EtSrc.getComponentDef <DefActor>();
                var effect_context = def_actor.EffectMgr.genEffectContext();
                effect_context.caller  = EffectCaller.UseItem;
                effect_context.item    = this;
                effect_context.EtActor = EtSrc;

                TbDataEffect data_effect = EbDataMgr.Instance.getData <TbDataEffect>(
                    TbDataItem.MainOperateInfo.EffectData.EffectId);
                return(def_actor.EffectMgr.doEffect(effect_context, data_effect.ScriptName,
                                                    data_effect.PredefineParamList, TbDataItem.MainOperateInfo.EffectData.ListParam));
            }

            return(null);
        }
Exemple #3
0
        //-------------------------------------------------------------------------
        public override object excute(EffectMgr effect_mgr, EffectContext effect_context, string[] predefine_param, string[] effect_param)
        {
            Item   item = effect_context.item;
            Entity et   = effect_context.EtActor;

            UnitConsumables unit_consumable = (UnitConsumables)item.UnitLink;

            foreach (var i in unit_consumable.TbDataUnitConsumables.ListEffect)
            {
                TbDataEffect data_effect = EbDataMgr.Instance.getData <TbDataEffect>(i.EffectId);

                effect_mgr.doEffect(effect_context, data_effect.ScriptName,
                                    data_effect.PredefineParamList, i.ListParam);
            }

            item.ItemData.n -= (byte)item.TbDataItem.MainOperateInfo.SubOverlapNum;

            return(null);
        }