Esempio n. 1
0
    public virtual bool Init(EntityParamEffect param, BattleEntity entity, uint target, EffectEntity parent)
    {
        this.param   = param;
        this.entity  = entity;
        this.parent  = parent;
        this.mTarget = target;
        this.scale   = entity.scale;

        IGameObject go = GetAgent();

        if (go == null)
        {
            return(false);
        }
        OnInit(go);

        if (asset == null)
        {
            asset = new AssetEntity();
        }
        asset.LoadAsset(param.asset, OnAssetLoad);

        OnBegin();
        return(true);
    }
Esempio n. 2
0
 private void OnDestroy()
 {
     if (!isDead)
     {
         EffectEntity.PlayEffect(explodeEffectPrefab, TempTransform);
     }
 }
Esempio n. 3
0
    private void OnTriggerEnter(Collider other)
    {
        if (isDead)
        {
            return;
        }

        var character = other.GetComponent <CharacterEntity>();

        if (character != null && character.Hp > 0)
        {
            isDead = true;
            EffectEntity.PlayEffect(powerUpEffect, character.effectTransform);
            if (isServer)
            {
                character.Hp    += Mathf.CeilToInt(hp * character.TotalHpRecoveryRate);
                character.Armor += Mathf.CeilToInt(armor * character.TotalArmorRecoveryRate);
                character.Exp   += Mathf.CeilToInt(exp * character.TotalExpRate);
            }
            if (character.isLocalPlayer && !(character is BotEntity))
            {
                foreach (var currency in currencies)
                {
                    MonetizationManager.Save.AddCurrency(currency.id, currency.amount);
                }
            }
            StartCoroutine(DestroyRoutine());
        }
    }
Esempio n. 4
0
    private int ShowEffect(EffectArise arise)
    {
        int childCount = 0;

        if (param == null || entity == null)
        {
            return(childCount);
        }
        if (entity.TryGetComponent(out EntityComponentModel model) == false)
        {
            return(childCount);
        }
        for (int i = 0; i < param.children.Count; ++i)
        {
            var child = param.children[i] as EntityParamEffect;
            if (child == null || string.IsNullOrEmpty(child.asset) || child.arise != arise)
            {
                continue;
            }
            childCount++;

            if (child.delay > 0)
            {
                DelayManager.Instance.AddDelayTask(child.delay, delegate()
                {
                    EffectEntity effect = BattleManager.Instance.CreateEffect(child.effectType);
                    if (effect != null && effect.Init(child, entity, mTarget, null))
                    {
                        if (action != null)
                        {
                            effect.action = action;
                            action.AddSubState(effect);
                        }
                    }
                    else
                    {
                        BattleManager.Instance.RemoveEffect(effect);
                    }
                });
            }
            else
            {
                EffectEntity effect = BattleManager.Instance.CreateEffect(child.effectType);

                if (effect != null && effect.Init(child, entity, mTarget, null))
                {
                    if (action != null)
                    {
                        effect.action = action;
                        action.AddSubState(effect);
                    }
                }
                else
                {
                    BattleManager.Instance.RemoveEffect(effect);
                }
            }
        }
        return(childCount);
    }
Esempio n. 5
0
    public static void BulletHit(Entity caster, Entity target, CSVSkill skillInfo)
    {
        if (target.IsDead || target.invincible)
        {
            return;
        }

        //受击动作
        if (!string.IsNullOrEmpty(skillInfo.beattackAction))
        {
            target.Anim.SyncAction(skillInfo.beattackAction);
        }
        //受击特效

        if (!string.IsNullOrEmpty(skillInfo.beattackEffect))
        {
            EffectEntity effect = EffectManager.Instance.GetEffect(skillInfo.beattackEffect);
            effect.Init(eDestroyType.Time, skillInfo.beattackActionDuration);

            effect.Pos     = target.Pos;
            effect.Forward = target.Forward;
        }

        CalcBlood(caster, target, skillInfo);
    }
        /// <summary>Creates a new, empty EffectEntity object.</summary>
        /// <returns>A new, empty EffectEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new EffectEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewEffect
            // __LLBLGENPRO_USER_CODE_REGION_END
            return(toReturn);
        }
Esempio n. 7
0
 public static void PlayEffect(EffectEntity prefab, Transform transform)
 {
     if (prefab != null)
     {
         var effectEntity = Instantiate(prefab, transform.position, transform.rotation, prefab.spawnRelateToTransform ? transform : null);
         // Just in case the game object might be not activated by default
         effectEntity.gameObject.SetActive(true);
     }
 }
Esempio n. 8
0
 public void OnMissileReach(Unit sourceUnit, EffectEntity missileEffect, SpellBase spell, params object[] args)
 {
     foreach (var listenerInfo in this.listenerDict["on_missile_reach"])
     {
         if (listenerInfo.unit == sourceUnit && listenerInfo.obj == spell)
         {
             this.ListenerCallback(listenerInfo, sourceUnit, missileEffect, spell, args);
         }
     }
 }
Esempio n. 9
0
 public virtual void OnDestruct()
 {
     asset            = null;
     mAnimators       = null;
     mParticleSystems = null;
     mEffectSpeed     = 1;
     parent           = null;
     entity           = null;
     mTarget          = 0;
 }
Esempio n. 10
0
    public EffectEntity CreateEffect(Type type, Transform parent = null)
    {
        EffectEntity entity = ObjectPool.GetInstance <EffectEntity>(type);

        mEffects.Add(entity);
        if (parent)
        {
            entity.gameObject.transform.SetParent(parent);
        }

        return(entity);
    }
Esempio n. 11
0
 public void RemoveEffect(EffectEntity entity)
 {
     for (int i = mEffects.Count - 1; i >= 0; --i)
     {
         var effect = mEffects[i];
         if (effect == null || effect == entity)
         {
             entity.Recycle();
             mEffects.RemoveAt(i);
         }
     }
 }
Esempio n. 12
0
    private EffectEntity Get(string path)
    {
        if (_pools.ContainsKey(path) == false)
        {
            _pools.Add(path, new SimplePool <EffectEntity>(() => Instantiate(Resources.Load <GameObject>(path)).GetComponent <EffectEntity>()));
        }

        EffectEntity entity = _pools[path].Get();

        entity.Path = path;
        return(entity);
    }
Esempio n. 13
0
    public EffectEntity CreateEffect(int id, bool attach, int unitUid, int posX, int posY)
    {
        MapField   mapField = GameRoot.GetInstance().MapField;
        EffectData data     = assetMng.GetEffectData(id);
        Vector3    pos;
        Entity     entity;

        if (unitUid != -1)
        {
            entity = mapField.FindEntity(unitUid);
            if (entity == null)
            {
                Debug.Log("CreateEffect fail:entity is null");
            }
            pos = entity.GetSocketPos(data.effectSocket);
        }
        else
        {
            float v_x, v_y;
            mapField.GetViewPos(posX, posY, out v_x, out v_y);
            pos = new Vector3(v_x, v_y, 0.05f);
        }
        GameObject obj = Instantiate(data.effectPrefab, pos, Quaternion.identity);

        if (attach == true)
        {
            entity = mapField.FindEntity(unitUid);
            obj.transform.SetParent(entity.gameObject.transform.Find(data.effectSocket).gameObject.transform);
            obj.transform.localPosition = Vector3.zero;
            obj.transform.localRotation = Quaternion.Euler(0, 0, 0);
            obj.transform.localScale    = Vector3.one * entity.radius / 4;
        }
        EffectEntity effectEntity = obj.AddComponent <EffectEntity>();

        //clean effect
        if (data.isAutoClean)
        {
            ParticleSystem[] array = obj.GetComponentsInChildren <ParticleSystem>();
            float            time  = 0;
            foreach (var par in array)
            {
                float temp = par.main.duration;
                if (temp > time)
                {
                    time = temp;
                }
            }
            Destroy(obj, time);
        }
        effects.Add(effectEntity.gameObject);
        return(effectEntity);
    }
Esempio n. 14
0
    private void ShowEffect(float deltaTime)
    {
        if (mParamAnimationClip == null || agent.param == null)
        {
            return;
        }

        var param = agent.param.GetAnimation(mParamAnimationClip.animationClip);

        if (param == null)
        {
            return;
        }
        deltaTime = action.speed * deltaTime;

        for (int i = 0; i < param.children.Count; ++i)
        {
            var child = param.children[i] as EntityParamEffect;
            if (child == null || string.IsNullOrEmpty(child.asset))
            {
                continue;
            }
            float time = action.time - mBeginTime;

            float previousTime = time - deltaTime;

            float delay = (child.delay - mParamAnimationClip.beginAt) / (mParamAnimationClip.speed > 0 ? mParamAnimationClip.speed : 1);


            if (delay < deltaTime)
            {
                delay = deltaTime;
            }

            if (previousTime < delay && time >= delay)
            {
                EffectEntity effect = BattleManager.Instance.CreateEffect(child.effectType);

                if (effect != null && effect.Init(child, agent, agent.target, null))
                {
                    effect.action = action;
                    action.AddSubState(effect);
                }
                else
                {
                    BattleManager.Instance.RemoveEffect(effect);
                }
            }
        }
    }
Esempio n. 15
0
    public EffectEntity Attach(string path, Vector3 position)
    {
        EffectEntity entity = Get(path);

        if (entity == null)
        {
            return(null);
        }

        entity.transform.SetParent(null);
        entity.transform.position = position;
        entity.OnFinished        += OnEffectEnded;
        return(entity);
    }
Esempio n. 16
0
    public EffectEntity Attach(string path, Transform parent)
    {
        EffectEntity entity = Get(path);

        if (entity == null)
        {
            return(null);
        }

        entity.transform.SetParent(parent);
        entity.transform.localPosition = Vector3.zero;
        entity.OnFinished += OnEffectEnded;
        return(entity);
    }
Esempio n. 17
0
 public void RemoveEffect(EffectEntity entity)
 {
     if (entity == null)
     {
         return;
     }
     for (int i = mEffectList.Count - 1; i >= 0; --i)
     {
         var effect = mEffectList[i];
         if (effect == null || effect == entity)
         {
             mEffectList.RemoveAt(i);
         }
     }
 }
Esempio n. 18
0
 /// <summary>
 /// 显示子特效
 /// </summary>
 /// <param name="effectType"></param>
 private void ShowEffect(EffectArise effectType)
 {
     if (param != null && param.effects != null)
     {
         for (int i = 0; i < param.effects.Count; ++i)
         {
             var effect = param.effects[i];
             if (effect.effectArise == effectType)
             {
                 EffectEntity entity = BattleManager.instance.CreateEffect(effect.type);
                 entity.Init(action, param.effects[i], parentTarget);
             }
         }
     }
 }
Esempio n. 19
0
    //由时间控制的击中事件,一般是近战类攻击击中目标
    public void SkillHit(uint skillID, List <Entity> targets = null)
    {
        if (targets == null)
        {
            Log.Info("技能id = " + skillID + " 没有目标");
            return;
        }

        CSVSkill skillInfo = CSVManager.GetSkillCfg(skillID);

        //技能类型(1.普攻 2.物理 3.法术 4.保护 5.治疗 6.辅助 7.召唤 8.被动)
        if (skillInfo.type <= 3)
        {
            for (int i = 0; i < targets.Count; i++)
            {
                Entity target = targets[i];
                if (target.IsDead || target.invincible)
                {
                    continue;
                }

                //受击动作
                if (!string.IsNullOrEmpty(skillInfo.beattackAction))
                {
                    target.Anim.SyncAction(skillInfo.beattackAction);
                }
                //受击特效

                if (!string.IsNullOrEmpty(skillInfo.beattackEffect))
                {
                    EffectEntity effect = EffectManager.Instance.GetEffect(skillInfo.beattackEffect);
                    effect.Init(eDestroyType.Time, skillInfo.beattackActionDuration);

                    effect.Pos     = target.Pos;
                    effect.Forward = target.Forward;
                }

                SkillProcesser.CalcBlood(m_entity, target, skillInfo);
            }
        }
        else if (skillInfo.type <= 6)
        {
            //添加增益buff
            for (int i = 0; i < targets.Count; i++)
            {
            }
        }
    }
Esempio n. 20
0
 //buff 开始执行
 public virtual void BuffStart()
 {
     if (!string.IsNullOrEmpty(buffInfo.EffectName))
     {
         effect          = EffectManager.Instance.GetEffect(buffInfo.EffectName);
         effect.duration = buffInfo.KeepTime;
         if (effect != null)
         {
             Transform bone = buffOwner.GetBone(buffInfo.BindBone);
             if (bone != null)
             {
                 effect.Bind(bone);
             }
         }
     }
 }
Esempio n. 21
0
    protected override void ShootEffects()
    {
        Host.AssertClient();

        var muzzle = EffectEntity.GetAttachment("muzzle");

        //bool InWater = Physics.TestPointContents( muzzle.Pos, CollisionLayer.Water );
        Sound.FromEntity(AttackSound.Name, this);

        Particles.Create("particles/balloon_grenade_launcher_muzzle.vpcf", EffectEntity, "muzzle");
        ViewModelEntity?.SetAnimParam("fire", true);
        CrosshairPanel?.OnEvent("onattack");

        if (Owner == Local.Client)
        {
            new Sandbox.ScreenShake.Perlin(0.5f, 2.0f, 0.5f);
        }
    }
Esempio n. 22
0
    public virtual void ShootEffects()
    {
        Host.AssertClient();

        var  muzzle  = EffectEntity.GetAttachment("muzzle");
        bool InWater = Physics.TestPointContents(muzzle.Pos, CollisionLayer.Water);

        Sound.FromEntity("rust_pistol.shoot", this);
        Particles.Create("particles/pistol_muzzleflash.vpcf", EffectEntity, "muzzle");

        ViewModelEntity?.SetAnimParam("fire", true);
        CrosshairPanel?.OnEvent("onattack");

        if (Owner == Player.Local)
        {
            new Sandbox.ScreenShake.Perlin(0.5f, 2.0f, 0.5f);
        }
    }
Esempio n. 23
0
    void PlayEffect(uint skillID, List <Entity> targets = null)
    {
        CSVSkill skillInfo = CSVManager.GetSkillCfg(skillID);

        if (string.IsNullOrEmpty(skillInfo.castEffect))
        {
            return;
        }

        EffectEntity effect = EffectManager.Instance.GetEffect(skillInfo.castEffect);

        effect.Init(eDestroyType.Time, skillInfo.castEffectDuration);
        //特效绑定的骨骼

        if (!string.IsNullOrEmpty(skillInfo.castEffectBindBone))
        {
            Transform bone = null;

            if (skillInfo.castEffectBindBone.CompareTo("self") == 0)
            {
                bone = m_object.transform;
            }
            else
            {
                bone = m_entity.GetBone(skillInfo.castEffectBindBone);
            }

            if (bone != null)
            {
                effect.Bind(bone);
            }
        }
        //如果特效没有绑定位置,则默认位置为释放者的位置
        else
        {
            effect.Pos     = m_entity.Pos;
            effect.Forward = m_entity.Forward;
        }
    }
Esempio n. 24
0
    public void Init(Entity caster, CSVSkill skillInfo, BulletHitCallback notify = null, Entity target = null)
    {
        m_effect = EffectManager.Instance.GetEffect(skillInfo.BulletEffect);
        if (m_effect == null)
        {
            Log.Error("不存在特效 " + skillInfo.BulletEffect);
            return;
        }
        m_caster = caster;
        m_target = target;
        if (target == null)
        {
            bulletType = eBulletType.Dir;
            m_dir      = m_caster.Forward;
        }
        else
        {
            bulletType = eBulletType.Target;
            m_dir      = (m_target.Pos - m_caster.Pos).normalized;
        }

        m_skillInfo = skillInfo;
        m_hitNotify = notify;
        //子弹存在的时间 = 子弹的攻击距离 / 子弹的飞行速度  小学物理知识  呵呵哒
        duration = m_skillInfo.attackDistance / m_skillInfo.flySpeed;
        m_effect.Init(eDestroyType.Time, duration);
        m_fSpeed = m_skillInfo.flySpeed;

        if (!string.IsNullOrEmpty(m_skillInfo.BulletBindBone))
        {
            m_effect.Pos = GetBonePos(m_caster, m_skillInfo.BulletBindBone);
        }
        else
        {
            m_effect.Pos = new Vector3(m_caster.Pos.x, m_caster.Pos.y + 0.5f, m_caster.Pos.z);
        }

        IsUsing = true;
    }
Esempio n. 25
0
    private void OnTriggerEnter(Collider other)
    {
        if (isDead)
        {
            return;
        }

        var character = other.GetComponent <CharacterEntity>();

        if (character != null && character.Hp > 0)
        {
            isDead = true;
            EffectEntity.PlayEffect(powerUpEffect, character.effectTransform);
            if (isServer)
            {
                character.Hp    += Mathf.CeilToInt(hp * character.TotalHpRecoveryRate);
                character.Armor += Mathf.CeilToInt(armor * character.TotalArmorRecoveryRate);
                character.Exp   += Mathf.CeilToInt(exp * character.TotalExpRate);
            }
            StartCoroutine(DestroyRoutine());
        }
    }
Esempio n. 26
0
    public EffectEntity GetEffect(string effectName)
    {
        EffectEntity        effect = null;
        List <EffectEntity> list   = null;

        bool find = false;

        if (m_EffectCaches.TryGetValue(effectName, out list))
        {
            //查找对象池中是否有没用到的特效对象
            for (var i = 0; i < list.Count; ++i)
            {
                EffectEntity ef = list[i];
                if (!ef.IsActive)
                {
                    ef.IsActive = true;
                    effect      = ef;
                    find        = true;
                }
            }

            //没有找到可用的
            if (!find)
            {
                effect = new EffectEntity(path + effectName);
                list.Add(effect);
            }
        }
        else
        {
            list   = new List <EffectEntity>();
            effect = new EffectEntity(path + effectName);

            list.Add(effect);
            m_EffectCaches.Add(effectName, list);
        }
        return(effect);
    }
Esempio n. 27
0
    private void ShowEffect(EffectArise effectType)
    {
        if (param != null && param.effects != null && entity.isPool == false)
        {
            for (int i = 0; i < param.effects.Count; ++i)
            {
                if (param.effects[i].effectArise == effectType)
                {
                    var target = BattleManager.instance.GetEntity(entity.data.target);

                    if (target != null && target.isPool)
                    {
                        return;
                    }

                    EffectEntity effect = BattleManager.instance.CreateEffect(param.effects[i].type);


                    effect.Init(this, param.effects[i], target);
                }
            }
        }
    }
Esempio n. 28
0
    public void RpcEffect(NetworkInstanceId triggerId, byte effectType)
    {
        GameObject triggerObject = isServer ? NetworkServer.FindLocalObject(triggerId) : ClientScene.FindLocalObject(triggerId);

        if (triggerObject != null)
        {
            if (effectType == RPC_EFFECT_DAMAGE_SPAWN || effectType == RPC_EFFECT_DAMAGE_HIT)
            {
                var attacker = triggerObject.GetComponent <CharacterEntity>();
                if (attacker != null &&
                    attacker.WeaponData != null &&
                    attacker.WeaponData.damagePrefab != null)
                {
                    var damagePrefab = attacker.WeaponData.damagePrefab;
                    switch (effectType)
                    {
                    case RPC_EFFECT_DAMAGE_SPAWN:
                        EffectEntity.PlayEffect(damagePrefab.spawnEffectPrefab, effectTransform);
                        break;

                    case RPC_EFFECT_DAMAGE_HIT:
                        EffectEntity.PlayEffect(damagePrefab.hitEffectPrefab, effectTransform);
                        break;
                    }
                }
            }
            else if (effectType == RPC_EFFECT_TRAP_HIT)
            {
                var trap = triggerObject.GetComponent <TrapEntity>();
                if (trap != null)
                {
                    EffectEntity.PlayEffect(trap.hitEffectPrefab, effectTransform);
                }
            }
        }
    }
Esempio n. 29
0
    public EffectEntity CreateEffect(EffectType type)
    {
        EffectEntity entity = null;

        switch (type)
        {
        case EffectType.Time:
            entity = ObjectPool.GetInstance <EffectEntityTime>(); break;

        case EffectType.Move:
            entity = ObjectPool.GetInstance <EffectEntityMove>(); break;

        case EffectType.Follow:
            entity = ObjectPool.GetInstance <EffectEntityFollow>(); break;

        case EffectType.Parabola:
            entity = ObjectPool.GetInstance <EffectParabolaEntity>(); break;
        }
        if (entity != null)
        {
            mEffectList.Add(entity);
        }
        return(entity);
    }
Esempio n. 30
0
        public DotaEntity Adapt(Dota obj)
        {
            var dotaEntity = new DotaEntity();

            if (obj.Game != null)
            {
                aspdota.Models.GameEntity game = new GameEntity
                {
                    Designer = obj.Game.Designer,
                    Name     = obj.Game.Name,
                    Genre    = obj.Game.Genre
                };

                dotaEntity.Game = game;
            }

            dotaEntity.Buildings = new List <BuildingEntity>();
            if (obj.Buildings != null && obj.Buildings.Capacity > 0)
            {
                foreach (Building building in obj.Buildings)
                {
                    BuildingEntity buildingEntity = new BuildingEntity();

                    buildingEntity.Damage  = building.Damage;
                    buildingEntity.Defence = building.Defence;
                    buildingEntity.Life    = building.Life;
                    buildingEntity.Main    = building.Main;
                    buildingEntity.Region  = building.Region;
                    buildingEntity.Side    = buildingEntity.Side;
                    buildingEntity.Type    = building.Type;

                    dotaEntity.AddBuilding(buildingEntity);
                }
            }

            dotaEntity.Heroes = new List <HeroEntity> ();

            if (obj.Heroes != null && obj.Heroes.Capacity > 0)
            {
                obj.Heroes.ForEach((Hero heroDTO) => {
                    HeroEntity heroEntity = ConvertHero(heroDTO);
                    dotaEntity.AddHero(heroEntity);
                });
            }

            dotaEntity.Items = new List <ItemEntity>();
            if (obj.Items != null && obj.Items.Capacity > 0)
            {
                obj.Items.ForEach((itemDTO) => {
                    ItemEntity itemEntity = new ItemEntity
                    {
                        Merchant    = itemDTO.Merchant,
                        Price       = itemDTO.Price,
                        Need        = itemDTO.Need,
                        Description = itemDTO.Description,
                    };

                    string heroId = itemDTO.HeroName;
                    Hero heroDTO  = obj.Heroes.Find((Hero searchd) => searchd.ID == heroId);

                    HeroEntity heroEntity = ConvertHero(heroDTO);
                    itemEntity.Hero       = heroEntity;
                    dotaEntity.AddItem(itemEntity);

                    itemEntity.Effects = new List <EffectEntity>();
                    itemDTO.Effects.ForEach((Effect eff) => {
                        EffectEntity effEntity = new EffectEntity
                        {
                            Main      = eff.Main,
                            Secondary = eff.Secondary
                        };

                        itemEntity.AddEffect(effEntity);
                    });
                });
            }
            return(dotaEntity);
        }
Esempio n. 31
0
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected RuleEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _condition = (DecisionNodeEntity)info.GetValue("_condition", typeof(DecisionNodeEntity));
            if(_condition!=null)
            {
                _condition.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _conditionReturnsNewIfNotFound = info.GetBoolean("_conditionReturnsNewIfNotFound");
            _alwaysFetchCondition = info.GetBoolean("_alwaysFetchCondition");
            _alreadyFetchedCondition = info.GetBoolean("_alreadyFetchedCondition");
            _effect = (EffectEntity)info.GetValue("_effect", typeof(EffectEntity));
            if(_effect!=null)
            {
                _effect.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _effectReturnsNewIfNotFound = info.GetBoolean("_effectReturnsNewIfNotFound");
            _alwaysFetchEffect = info.GetBoolean("_alwaysFetchEffect");
            _alreadyFetchedEffect = info.GetBoolean("_alreadyFetchedEffect");
            _policy = (PolicyEntity)info.GetValue("_policy", typeof(PolicyEntity));
            if(_policy!=null)
            {
                _policy.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _policyReturnsNewIfNotFound = info.GetBoolean("_policyReturnsNewIfNotFound");
            _alwaysFetchPolicy = info.GetBoolean("_alwaysFetchPolicy");
            _alreadyFetchedPolicy = info.GetBoolean("_alreadyFetchedPolicy");

            base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Esempio n. 32
0
 /// <summary> Removes the sync logic for member _effect</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncEffect(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity( _effect, new PropertyChangedEventHandler( OnEffectPropertyChanged ), "Effect", RuleEntity.Relations.EffectEntityUsingEffectId, true, signalRelatedEntity, "Rule", resetFKFields, new int[] { (int)RuleFieldIndex.EffectId } );
     _effect = null;
 }
Esempio n. 33
0
        /// <summary> Initializes the class members</summary>
        private void InitClassMembers()
        {
            _condition = null;
            _conditionReturnsNewIfNotFound = true;
            _alwaysFetchCondition = false;
            _alreadyFetchedCondition = false;
            _effect = null;
            _effectReturnsNewIfNotFound = true;
            _alwaysFetchEffect = false;
            _alreadyFetchedEffect = false;
            _policy = null;
            _policyReturnsNewIfNotFound = true;
            _alwaysFetchPolicy = false;
            _alreadyFetchedPolicy = false;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
Esempio n. 34
0
 /// <summary> setups the sync logic for member _effect</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncEffect(IEntity relatedEntity)
 {
     if(_effect!=relatedEntity)
     {
         DesetupSyncEffect(true, true);
         _effect = (EffectEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity( _effect, new PropertyChangedEventHandler( OnEffectPropertyChanged ), "Effect", RuleEntity.Relations.EffectEntityUsingEffectId, true, ref _alreadyFetchedEffect, new string[] {  } );
     }
 }
Esempio n. 35
0
        /// <summary> Retrieves the related entity of type 'EffectEntity', using a relation of type 'n:1'</summary>
        /// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
        /// <returns>A fetched entity of type 'EffectEntity' which is related to this entity.</returns>
        public virtual EffectEntity GetSingleEffect(bool forceFetch)
        {
            if( ( !_alreadyFetchedEffect || forceFetch || _alwaysFetchEffect) && !base.IsSerializing && !base.IsDeserializing  && !base.InDesignMode)
            {
                bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(RuleEntity.Relations.EffectEntityUsingEffectId);

                EffectEntity newEntity = new EffectEntity();
                if(base.ParticipatesInTransaction)
                {
                    base.Transaction.Add(newEntity);
                }
                bool fetchResult = false;
                if(performLazyLoading)
                {
                    fetchResult = newEntity.FetchUsingPK(this.EffectId);
                }
                if(fetchResult)
                {
                    if(base.ActiveContext!=null)
                    {
                        newEntity = (EffectEntity)base.ActiveContext.Get(newEntity);
                    }
                    this.Effect = newEntity;
                }
                else
                {
                    if(_effectReturnsNewIfNotFound)
                    {
                        if(performLazyLoading || (!performLazyLoading && (_effect == null)))
                        {
                            this.Effect = newEntity;
                        }
                    }
                    else
                    {
                        this.Effect = null;
                    }
                }
                _alreadyFetchedEffect = fetchResult;
                if(base.ParticipatesInTransaction && !fetchResult)
                {
                    base.Transaction.Remove(newEntity);
                }
            }
            return _effect;
        }
        /// <summary>Creates a new, empty EffectEntity object.</summary>
        /// <returns>A new, empty EffectEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new EffectEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewEffect
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }