Пример #1
0
 public void DestroyAllEffect()
 {
     Dictionary <int, EffectBase> .Enumerator em = mEffectMap.GetEnumerator();
     while (em.MoveNext())
     {
         EffectBase effect = em.Current.Value;
         effect.Clear();
         effect = null;
     }
     em.Dispose();
     mEffectMap.Clear();
 }
Пример #2
0
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="device"></param>
        public MosaicFilter(PPDDevice device)
        {
            effect                        = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("Mosaic"));
            widthHeightHandle             = effect.GetParameter("WidthHeight");
            filterTextureHandle           = effect.GetParameter("FilterTexture");
            lastRenderTargetTextureHandle = effect.GetParameter("LastRenderTargetTexture");
            xTextureHandle                = effect.GetParameter("XTexture");
            projectionHandle              = effect.GetParameter("Projection");
            sizeHandle                    = effect.GetParameter("Size");

            effect.SetValue(projectionHandle, device.Projection);
            effect.SetValue(widthHeightHandle, new Vector2(device.Width, device.Height));
        }
        public override void OnEffectTest()
        {
            EffectInfoData    effect_info = new EffectInfoData(GameTargetType.OPPO_ONE, EFFECT_TYPE.ChangeSpeedCntEffect, "10", "");
            EffectBase        effect      = EffectFactory.CreateEffect(effect_info);
            List <GamePlayer> targets     = null;

            targets = test_players;
            if (targets != null)
            {
                effect.TakeEffect(test_players[0], targets, effect_info.EffectParam1, effect_info.EffectParam2);
            }
            Assert.IsTrue(test_players[0].Role.CurrentSpeed - (initSpeed + 10) + 0.00001 < 0.0001);
        }
Пример #4
0
        /// <summary>
        /// Effects the active.
        /// </summary>
        /// <param name="effectTarget">成熟效果的目标</param>
        /// <param name="effect">效果类型</param>
        /// <param name="releaser">魔法释放者</param>
        public static void EffectActive(BattleCharacter effectTarget, EffectBase effect, MagicReleaser releaser)
        {
            MethodInfo handle;

            if (_handlers.TryGetValue(effect.GetType(), out handle))
            {
                handle.Invoke(null, new object[] { effectTarget, effect, releaser });
            }
            else
            {
                throw new Exception(string.Format("Effect [{0}] no handler!!!", effect.GetType()));
            }
        }
        public override void OnEffectTest()
        {
            EffectInfoData    effect_info = new EffectInfoData(GameTargetType.OPPO_ONE, EFFECT_TYPE.StaySpElmtPropEffect, "FIRE", "");
            EffectBase        effect      = EffectFactory.CreateEffect(effect_info);
            List <GamePlayer> targets     = null;

            targets = test_players;
            if (targets != null)
            {
                effect.TakeEffect(test_players[0], targets, effect_info.EffectParam1, effect_info.EffectParam2);
            }
            Assert.IsTrue(test_players[0].Role.IsStaySpElmtProp && test_players[0].Role.StaySpElmtProp == ELEMENT_PROPERTY.FIRE);
        }
Пример #6
0
        public override void OnEffectTest()
        {
            EffectInfoData    effect_info = new EffectInfoData(GameTargetType.OPPO_ONE, EFFECT_TYPE.StayAliveEffect, "2", "");
            EffectBase        effect      = EffectFactory.CreateEffect(effect_info);
            List <GamePlayer> targets     = null;

            targets = test_players;
            if (targets != null)
            {
                effect.TakeEffect(test_players[0], targets, effect_info.EffectParam1, effect_info.EffectParam2);
            }
            Assert.IsTrue(test_players[0].Role.CurrentHP == 1);
        }
Пример #7
0
    public override void OnStart()
    {
        mirrorList = Random.Range(0, 2) == 0 ? penrose.JsonRawData.shapes.mirror2 : penrose.JsonRawData.shapes.mirror10;

        sourceEffect = GetRandomEffect();
        var debugText = string.Empty;

        sourceEffect.Init();
        sourceEffect.OnStart();
        debugText += $"{sourceEffect.Name}";

        controller.debugText.text = debugText;
    }
Пример #8
0
 protected Buff(int id, FightActor target, FightActor caster, EffectBase effect, Spell spell, bool critical, bool dispelable, short customActionId)
 {
     this.Id             = id;
     this.Target         = target;
     this.Caster         = caster;
     this.Effect         = effect;
     this.Spell          = spell;
     this.Critical       = critical;
     this.Dispellable    = dispelable;
     this.CustomActionId = new short?(customActionId);
     this.Duration       = (short)this.Effect.Duration;
     this.Efficiency     = 1.0;
 }
Пример #9
0
        /// <summary>
        /// Begins the clipped rendering with custom effect
        /// </summary>
        /// <param name="clipRect">The clip rect.</param>
        /// <param name="effect">The effect.</param>
        public override void BeginClipped(Rect clipRect, EffectBase effect)
        {
            Rectangle clipRectangle;

            clipRectangle.X      = (int)clipRect.X;
            clipRectangle.Y      = (int)clipRect.Y;
            clipRectangle.Width  = (int)clipRect.Width;
            clipRectangle.Height = (int)clipRect.Height;

            UpdateCurrentEffect(effect);

            BeginClipped(clipRectangle);
        }
Пример #10
0
 public MapEffect(
     IAudioEngine s,
     SceneMap p,
     Point po,
     int floor,
     MapField fi,
     int effectNo,
     int rendType)
     : base(s, p, po, floor, MapCharacterBase.ANGLE.none, fi)
 {
     this.position.Z = floor * (this.field.Height / 2);
     this.effect     = this.EffectSet(effectNo);
     this.rendType   = rendType;
 }
Пример #11
0
        protected override EBTStatus Execute()
        {
            if (mEffectEntiny == null)
            {
                return(EBTStatus.BT_FAILURE);
            }

            EEffectState pState = mEffectEntiny.State;

            switch (pState)
            {
            case EEffectState.Error:
            {
                return(EBTStatus.BT_FAILURE);
            }

            case EEffectState.Update:
            {
                if (mCacheTransform == null && mEffectEntiny.CacheTransform != null)
                {
                    mCacheTransform = mEffectEntiny.CacheTransform;
                    BTTreeManager.Instance.SaveData(this, JudgeName, mCacheTransform);
                }

                object var = BTTreeManager.Instance.GetData(this, Define.BT_JUDGE_SUCCESS);
                if (var != null && Data.Dead == EFlyObjDeadType.UntilColliderTar)
                {
                    mEffectEntiny.SwitchState(EEffectState.Dead);
                }
                return(EBTStatus.BT_RUNNING);
            }

            case EEffectState.Wait:
            {
                return(EBTStatus.BT_RUNNING);
            }

            case EEffectState.Dead:
            {
                mEffectEntiny = null;
                return(EBTStatus.BT_SUCCESS);
            }

            default:
            {
                return(EBTStatus.BT_FAILURE);
            }
            }
            return(EBTStatus.BT_FAILURE);
        }
Пример #12
0
    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~创建特效~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
    /// <summary>
    /// 定点位置创建特效
    /// </summary>
    /// <param name="file">资源文件</param>
    /// <param name="pos">位置</param>
    /// <param name="time">播放时长(秒):
    /// 1.对于非循环特效,且未设置time,特效播放结束后,会自动销毁;
    /// 2.对于循环特效,到点之后自动销毁
    /// 3.只要这个参数大于0,不管是循环特效还是非循环特效,指定时间一到,自动销毁</param>
    /// 4.循环特效,且未指定time,则需要外部调用RemoveEffect接口销毁
    /// <returns></returns>
    public EffectBase CreateEffect_Position(string file, Vector3 pos, float time = 0)
    {
        EffectBase effect = NewObject <EffectBase>(file) as EffectBase;

        if (effect != null)
        {
            effect.ObjectUID          = ShareGUID();
            effect.transform.position = pos;
            effect.TotalTime          = time;
            GameObjectUtils.SetLayer(effect.gameObject, LayerMask.NameToLayer(SceneLayerID.Effect));
        }

        return(effect);
    }
Пример #13
0
 protected override bool Enter()
 {
     base.Enter();
     if (Owner == null)
     {
         return(false);
     }
     Data.Owner         = Owner;
     Data.Target        = Owner.GetTarget();
     Data.Parent        = Owner.CacheTransform;
     this.mEffectEntiny = ZTEffect.Instance.CreateEffect(Data);
     ZTAudio.Instance.PlayEffectAudio(GTTools.Format("Sound/Sound/{0}", Data.Sound));
     return(true);
 }
Пример #14
0
        public void FullDump()
        {
            ObjectDumper dumper = new ObjectDumper(4, true, true, (System.Reflection.BindingFlags.FlattenHierarchy));

            logger.Error("Dump of the spellbook of {0} : ", Character.Name);
            foreach (var spell in m_spells)
            {
                logger.Error("   Spell {0}", spell.ToString(true));
                foreach (var effectdice in spell.LevelTemplate.effects)
                {
                    EffectBase effect = new EffectBase(effectdice);
                    logger.Error("       Effect {0} : {1} - {2} {3:P}", effect.Description, effectdice.diceNum <= effectdice.diceSide ? effectdice.diceNum : effectdice.diceSide, effectdice.diceNum > effectdice.diceSide ? effectdice.diceNum : effectdice.diceSide, effectdice.random == 0 ? 1.0 : effectdice.random / 100.0);
                }
            }
        }
Пример #15
0
    public void Create(InfoSkill info, Creature crt)
    {
        m_info      = info;
        m_owner_crt = crt;

        m_effects = new EffectBase[Proto.ProtoEffects.Length];
        for (int i = 0; i < m_effects.Length; ++i)
        {
            ProtoEffect proto = Proto.ProtoEffects[i];
            EffectBase  eb    = proto.NewInstance();
            eb.Create(proto, this, i);
            eb.OnActiveOver += OnEffectActiveOver;
            m_effects[i]     = eb;
        }
    }
Пример #16
0
        public ItemEffectHandler GetItemEffectHandler(EffectBase effect, Character target, BasePlayerItem item)
        {
            EffectManager.ItemEffectConstructor itemEffectConstructor;
            ItemEffectHandler result;

            if (this.m_itemsEffectHandler.TryGetValue(effect.EffectId, out itemEffectConstructor))
            {
                result = itemEffectConstructor(effect, target, item);
            }
            else
            {
                result = new DefaultItemEffect(effect, target, item);
            }
            return(result);
        }
Пример #17
0
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="device"></param>
        public BorderFilter(PPDDevice device)
        {
            effect                        = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("Border"));
            widthHeightHandle             = effect.GetParameter("WidthHeight");
            filterTextureHandle           = effect.GetParameter("FilterTexture");
            lastRenderTargetTextureHandle = effect.GetParameter("LastRenderTargetTexture");
            projectionHandle              = effect.GetParameter("Projection");
            colorHandle                   = effect.GetParameter("Color");
            thicknessHandle               = effect.GetParameter("Thickness");
            thickness2Handle              = effect.GetParameter("Thickness2");
            actualThicknessHandle         = effect.GetParameter("ActualThickness");

            effect.SetValue(projectionHandle, device.Projection);
            effect.SetValue(widthHeightHandle, new Vector2(device.Width, device.Height));
        }
Пример #18
0
        public UsableEffectHandler GetUsableEffectHandler(EffectBase effect, Character target, BasePlayerItem item)
        {
            EffectManager.UsableEffectConstructor usableEffectConstructor;
            UsableEffectHandler result;

            if (this.m_usablesEffectHandler.TryGetValue(effect.EffectId, out usableEffectConstructor))
            {
                result = usableEffectConstructor(effect, target, item);
            }
            else
            {
                result = new DefaultUsableEffectHandler(effect, target, item);
            }
            return(result);
        }
Пример #19
0
        public ItemEffectHandler GetItemEffectHandler(EffectBase effect, Character target, ItemSetTemplate itemSet, bool apply)
        {
            EffectManager.ItemSetEffectConstructor itemSetEffectConstructor;
            ItemEffectHandler result;

            if (this.m_itemsSetEffectHandler.TryGetValue(effect.EffectId, out itemSetEffectConstructor))
            {
                result = itemSetEffectConstructor(effect, target, itemSet, apply);
            }
            else
            {
                result = new DefaultItemEffect(effect, target, itemSet, apply);
            }
            return(result);
        }
Пример #20
0
        public override void OnEffectTest()
        {
            EffectInfoData    effect_info = new EffectInfoData(GameTargetType.OPPO_ONE, EFFECT_TYPE.TransferJustAcquiredAssetEffect, "MAGIC_POINT", "FIRE");
            EffectBase        effect      = EffectFactory.CreateEffect(effect_info);
            List <GamePlayer> targets     = null;

            targets = test_players;
            if (targets != null)
            {
                effect.TakeEffect(test_players[0], targets, effect_info.EffectParam1, effect_info.EffectParam2);
            }
            // !!!
            // 暂未实现
            Assert.IsTrue(true);
        }
Пример #21
0
        public EffectBase[] GetEffects(int itemsCount)
        {
            int num = itemsCount - 1;

            EffectBase[] result;
            if (this.Effects == null || this.Effects.Count <= num || num < 0)
            {
                result = new EffectBase[0];
            }
            else
            {
                result = this.Effects[num].ToArray();
            }
            return(result);
        }
        public override void OnEffectTest()
        {
            EffectInfoData    effect_info = new EffectInfoData(GameTargetType.OPPO_ONE, EFFECT_TYPE.GainSpCardEffect, "2", "");
            EffectBase        effect      = EffectFactory.CreateEffect(effect_info);
            List <GamePlayer> targets     = null;

            targets = test_players;
            if (targets != null)
            {
                effect.TakeEffect(test_players[0], targets, effect_info.EffectParam1, effect_info.EffectParam2);
            }
            // !!!
            // 暂未实现
            Assert.IsTrue(true);
        }
Пример #23
0
    /// <summary>
    /// 删除粒子
    /// </summary>
    /// <param name="effect"></param>
    public void DestoryEffect(EffectBase effect)
    {
        EffectBean effectData = effect.effectData;

        if (dicIdleEffect.TryGetValue(effectData.effectName, out Queue <EffectBase> listIdleEffect))
        {
            listIdleEffect.Enqueue(effect);
        }
        else
        {
            Queue <EffectBase> listEffect = new Queue <EffectBase>();
            listEffect.Enqueue(effect);
            dicIdleEffect.Add(effectData.effectName, listEffect);
        }
        effect.ShowObj(false);
    }
Пример #24
0
        /// <summary>
        /// Begins the rendering with custom effect
        /// </summary>
        /// <param name="effect"></param>
        public override void Begin(EffectBase effect)
        {
            isClipped = false;
            isSpriteRenderInProgress = true;
            UpdateCurrentEffect(effect);

            if (clipRectanges.Count == 0)
            {
                spriteBatch.Begin(graphicsContext, SpriteSortMode.Deferred, depthStencilState: DepthStencilStates.None, effect: currentActiveEffect);
            }
            else
            {
                Rectangle previousClip = clipRectanges.Pop();
                BeginClipped(previousClip);
            }
        }
Пример #25
0
    void OnEffectActiveOver(EffectBase effect)
    {
        bool all_over = true;

        foreach (EffectBase eb in m_effects)
        {
            if (eb.State != EffectBase.StateType.Over)
            {
                all_over = false;
                break;
            }
        }
        if (all_over)
        {
            CastOver();
        }
    }
Пример #26
0
    private IEnumerator PlayerCanvasIconCo(EffectBase effect)
    {
        playerCanvasIconsCounter++;

        yield return(new WaitForSeconds(effect.tween.targetTime));

        if (effect == null)
        {
            yield break;
        }

        if (effect.gameObject != null)
        {
            Destroy(effect.gameObject);
        }

        playerCanvasIconsCounter--;
    }
Пример #27
0
 public AlphaBlendShading(PPDDevice device)
 {
     this.device   = device;
     effect        = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("AlphaBlend"));
     textureHandle = effect.GetParameter("Texture");
     lastRenderTargetTextureHandle = effect.GetParameter("LastRenderTargetTexture");
     maskTextureHandle             = effect.GetParameter("MaskTexture");
     drawInfoHandle    = effect.GetParameter("DrawInfo");
     widthHeightHandle = effect.GetParameter("WidthHeight");
     projectionHandle  = effect.GetParameter("Projection");
     filterInfoHandle  = effect.GetParameter("FilterInfo");
     effect.SetValue(widthHeightHandle, new Vector2(device.Width, device.Height));
     effect.SetValue(projectionHandle, device.Projection);
     techniqueNames = new Dictionary <Tuple <BlendMode, bool, bool, ColorFilterType>, string>();
     foreach (var blendMode in (BlendMode[])Enum.GetValues(typeof(BlendMode)))
     {
         foreach (var isPA in new bool[] { true, false })
         {
             foreach (var isMasking in new bool[] { true, false })
             {
                 foreach (var filterType in (ColorFilterType[])Enum.GetValues(typeof(ColorFilterType)))
                 {
                     techniqueNames[new Tuple <BlendMode, bool, bool, ColorFilterType>(blendMode, isPA, isMasking, filterType)] =
                         String.Format("{0}Blend{1}{2}{3}Filter",
                                       blendMode,
                                       isPA ? "PAEnabled" : "PADisabled",
                                       isMasking ? "MaskEnabled" : "MaskDisabled",
                                       filterType);
                 }
             }
         }
     }
     maskTechniqueNames = new Dictionary <Tuple <MaskType, bool>, string>();
     foreach (var maskType in (MaskType[])Enum.GetValues(typeof(MaskType)))
     {
         foreach (var isMasking in new bool[] { true, false })
         {
             maskTechniqueNames[new Tuple <MaskType, bool>(maskType, isMasking)] =
                 String.Format("{0}Mask{1}",
                               maskType,
                               isMasking ? "MaskEnabled" : "MaskDisabled");
         }
     }
 }
Пример #28
0
        public int BeginTurn()
        {
            int result = this.Buffs.BeginTurn();

            if (firstTurn && Grade.Monster.StaticFighterBeginEffects != null)
            {
                try
                {
                    var ActualChance = 0;
                    foreach (var Effect in Grade.Monster.StaticFighterBeginEffects)
                    {
                        if (Effect.Chance > 0)
                        {
                            if (Fight.RANDOM.Next(1, 100) > (Effect.Chance + ActualChance))
                            {
                                ActualChance += Effect.Chance;
                                continue;
                            }
                            ActualChance -= 100;
                        }
                        List <Fighter> target = new List <Fighter>()
                        {
                            this
                        };
                        var CastInfos = new EffectCast(Effect.EffectType, -1, CellId, Effect.Value1, Effect.Value2, Effect.Value3, Effect.Chance, Effect.Duration, this, target, false, EffectEnum.None, 0, Effect.Spell);

                        if (EffectBase.TryApplyEffect(CastInfos) == -3)
                        {
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                }
                finally
                {
                    firstTurn = false;
                }
            }

            return(result);
        }
Пример #29
0
 protected override void DisposeResource()
 {
     if (effect != null)
     {
         effect.Dispose();
         effect = null;
     }
     if (lastRenderTargetTextureHandle != null)
     {
         lastRenderTargetTextureHandle.Dispose();
         lastRenderTargetTextureHandle = null;
     }
     if (textureHandle != null)
     {
         textureHandle.Dispose();
         textureHandle = null;
     }
     if (maskTextureHandle != null)
     {
         maskTextureHandle.Dispose();
         maskTextureHandle = null;
     }
     if (drawInfoHandle != null)
     {
         drawInfoHandle.Dispose();
         drawInfoHandle = null;
     }
     if (widthHeightHandle != null)
     {
         widthHeightHandle.Dispose();
         widthHeightHandle = null;
     }
     if (projectionHandle != null)
     {
         projectionHandle.Dispose();
         projectionHandle = null;
     }
     if (filterInfoHandle != null)
     {
         filterInfoHandle.Dispose();
         filterInfoHandle = null;
     }
 }
Пример #30
0
        private void UpdateCurrentEffect(EffectBase effect)
        {
            EffectInstance effectInstance = effect != null?effect.GetNativeEffect() as EffectInstance : null;

            if (effectInstance != null)
            {
                if (currentActiveEffect != null)
                {
                    activeEffects.Push(currentActiveEffect);
                }

                currentActiveEffect = effectInstance;
            }

            if (currentActiveEffect == null && activeEffects.Count > 0)
            {
                currentActiveEffect = activeEffects.Pop();
            }
        }