public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection collection = new PropertyDescriptorCollection(null);

            Animation  = (VO_StageAnimation)value;
            collection = Animation.GetProperties();
            return(collection);
        }
        /// <summary>
        /// Execute les scripts d'animation
        /// </summary>
        /// <param name="animStage"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public bool ExecuteAnimationScript(VO_StageAnimation animStage, Enums.TriggerExecutionType type)
        {
            bool anim = false;

            RunServiceTask(delegate
            {
                anim = _Business.ExecuteAnimationScript(animStage, type);
            }, ViewerErrors.STAGE_LOAD_MENU, false, animStage.ToString(), type.ToString());

            return(anim);
        }
        /// <summary>
        /// Prépare une animation à être dessinée
        /// </summary>
        /// <param name="animation"></param>
        /// <returns></returns>
        public VO_AnimatedSprite DrawAnimated(VO_StageAnimation animation)
        {
            VO_AnimatedSprite animSprite = null;

            RunServiceTask(delegate
            {
                animSprite = _Business.DrawAnimated(animation);
            }, ViewerErrors.STAGE_LOAD_MENU, false, animation.ToString());

            return(animSprite);
        }
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            VO_StageAnimation decor = Animation;

            if (propertyValues["Title"] != null)
            {
                decor.Title = propertyValues["Title"].ToString();
            }
            if (propertyValues["Location"] != null)
            {
                decor.Location = (Point)propertyValues["Location"];
            }
            return(decor);
        }
Example #5
0
        /// <summary>
        /// Execute les scripts d'animation
        /// </summary>
        /// <param name="animStage"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public bool ExecuteAnimationScript(VO_StageAnimation animStage, Enums.TriggerExecutionType type)
        {
            foreach (VO_Page page in animStage.Event.PageList)
            {
                if (page.TriggerExecution == type)
                {
                    page.TriggerCondition = Enums.TriggerEventConditionType.ParallelProcess;
                    TestScript(animStage, Enums.TriggerEventConditionType.ParallelProcess);
                    return(true);
                }
            }

            return(false);
        }
Example #6
0
 public VO_StageAnimation GetStageAnimation(Guid animation)
 {
     foreach (VO_Stage item in Game.Stages)
     {
         foreach (VO_Layer layer in item.ListLayers)
         {
             VO_StageAnimation stageAnimation = layer.ListAnimations.Find(i => i.Id == animation);
             if (stageAnimation != null)
             {
                 return(stageAnimation);
             }
         }
     }
     return((VO_StageAnimation)ValidationTools.CreateEmptyRessource(new VO_StageAnimation()));
 }
Example #7
0
 public static void CreateAnimation(VO_Layer layer, Point position, Guid animId)
 {
     if (layer.ListAnimations.Count < GlobalConstants.PERF_MAX_ANIMATION_PER_LAYERS)
     {
         VO_Animation      animation = GameCore.Instance.GetAnimationById(animId);
         VO_StageAnimation newAnim   = new VO_StageAnimation();
         newAnim.Id          = Guid.NewGuid();
         newAnim.Title       = animation.Title;
         newAnim.Location    = position;
         newAnim.Size        = new Size(animation.SpriteWidth, animation.SpriteHeight);
         newAnim.AnimationId = animId;
         newAnim.ObjectType  = Enums.StageObjectType.Animations;
         newAnim.Stage       = layer.Stage;
         newAnim.Layer       = layer.Id;
         newAnim.Event       = CreateEvent(Enums.EventType.Animation, animation.Id);
         layer.ListAnimations.Add(newAnim);
     }
     else
     {
         MessageBox.Show(string.Format(Errors.STAGE_MAX_ANIMATIONS, GlobalConstants.PERF_MAX_ANIMATION_PER_LAYERS), Errors.ERROR_BOX_TITLE);
     }
 }
Example #8
0
        /// <summary>
        /// Prépare une animation à être dessinée
        /// </summary>
        /// <param name="animation"></param>
        /// <returns></returns>
        public VO_AnimatedSprite DrawAnimated(VO_StageAnimation animation)
        {
            int i = 0;

            foreach (VO_Page page in animation.Event.PageList)
            {
                if (IsActivePage(page))
                {
                    VO_AnimatedSprite animSprite = GetAnimatedSprite(animation.Id, Enums.StageObjectType.Animations);
                    if (animSprite.CurrentExecutingPage != i)
                    {
                        animSprite.SetFrequency(page.AnimationFrequency);
                        animSprite.Frozen = page.AnimationFrozenAtStart;
                        animSprite.CurrentExecutingPage = i;
                    }
                    return(animSprite);
                }
                i++;
            }

            return(null);
        }