示例#1
0
        public void TriggerEffect(IEffectHandle handle)
        {
            var effect = handle.Effect;

            if (!handle.IsAccepted && !handle.IsRejected)
            {
                Prepare(handle);
            }

            effect.Validate(this, handle);

            //if (handle.IsAccepted)
            //{
            //    controller.PaymentAccepted(effect, handle);
            //}
            //if (handle.IsRejected)
            //{
            //    controller.PaymentRejected(effect, handle);
            //    return;
            //}

            effect.Trigger(this, handle);

            if (handle.IsResolved)
            {
                controller.EffectResolved(effect, handle);
            }
            else if (handle.IsCancelled)
            {
                controller.EffectCancelled(effect, handle);
            }


            if (currentEffects.Contains(effect))
            {
                currentEffects.Remove(effect);
            }
        }