Exemple #1
0
        /// <summary>
        /// Déplace un objet sur la scène
        /// </summary>
        /// <param name="pX">Position en X</param>
        /// <param name="pY">Position en Y</param>
        public void MoveObject(int x, int y)
        {
            if (EditorHelper.Instance.SelectedObjects.Count > 0)
            {
                //Itération sur tous les objets sélectionnés
                foreach (VO_StageObject vo in EditorHelper.Instance.SelectedObjects)
                {
                    Rectangle oldPosition = new Rectangle(vo.Location, vo.Size);
                    vo.Location = new Point(vo.Location.X + x, vo.Location.Y + y);
                    vo.Size     = vo.Size;

                    //Cas typique des hotspots, on déplace également les points vectoriels.
                    if (vo.ObjectType == Enums.StageObjectType.HotSpots || vo.ObjectType == Enums.StageObjectType.Walkables || vo.ObjectType == Enums.StageObjectType.Regions)
                    {
                        int             movX    = vo.Location.X - oldPosition.X;
                        int             movY    = vo.Location.Y - oldPosition.Y;
                        VO_StageHotSpot hotspot = (VO_StageHotSpot)vo;
                        _Service.MovePoints(hotspot.Points, movX, movY);
                    }
                }
                _KeyUp = true;

                ReloadItemChosen();
                RefreshSelection();
            }
        }
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            VO_StageHotSpot hotspot = HotSpot;

            if (propertyValues["Title"] != null)
            {
                hotspot.Title = propertyValues["Title"].ToString();
            }
            if (propertyValues["Location"] != null)
            {
                hotspot.Location = (Point)propertyValues["Location"];
            }
            if (propertyValues["PlayerMustMove"] != null)
            {
                hotspot.PlayerMustMove = (bool)propertyValues["PlayerMustMove"];
            }
            if (propertyValues["PlayerPositionPoint"] != null)
            {
                hotspot.PlayerPositionPoint = (VO_Coords)propertyValues["PlayerPositionPoint"];
            }
            if (propertyValues["PlayerMoveEndDirection"] != null)
            {
                hotspot.PlayerMoveEndDirection = (Enums.Movement)propertyValues["PlayerMoveEndDirection"];
            }
            if (propertyValues["ClassId"] != null && propertyValues["ClassId"] is Class)
            {
                hotspot.ClassId = ((Class)propertyValues["ClassId"]).Id;
            }
            return(hotspot);
        }
Exemple #3
0
 /// <summary>
 /// Mets à jour la location de la zone
 /// </summary>
 /// <param name="hotSpot">HotSpot</param>
 public void UpdateAreaLocation(VO_StageHotSpot hotSpot)
 {
     RunServiceTask(delegate
     {
         _Business.UpdateAreaLocation(hotSpot);
     }, Errors.ERROR_STAGE_STR_LOAD, hotSpot.Title);
 }
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection collection = new PropertyDescriptorCollection(null);

            HotSpot    = (VO_StageHotSpot)value;
            collection = HotSpot.GetProperties();
            return(collection);
        }
Exemple #5
0
        /// <summary>
        /// Créer une region
        /// </summary>
        /// <param name="location">Localisation du scène</param>
        public VO_StageHotSpot CreateRegion(Point location)
        {
            VO_StageHotSpot hotSpot = null;

            RunServiceTask(delegate
            {
                hotSpot = _Business.CreateRegion(location);
            }, Errors.ERROR_STAGE_STR_LOAD, location.ToString());

            return(hotSpot);
        }
Exemple #6
0
 public static VO_StageHotSpot CreateHotSpot(VO_Stage stage, Point position)
 {
     if (stage.ListHotSpots.Count < GlobalConstants.PERF_MAX_HOTSPOT_PER_STAGE)
     {
         VO_StageHotSpot newHotSpot = new VO_StageHotSpot();
         newHotSpot.Id                  = Guid.NewGuid();
         newHotSpot.Title               = GlobalConstants.HOTSPOT_NEW_ITEM;
         newHotSpot.ObjectType          = Enums.StageObjectType.HotSpots;
         newHotSpot.Stage               = stage.Id;
         newHotSpot.Points              = new Point[1];
         newHotSpot.Points[0]           = position;
         newHotSpot.Event               = CreateEvent(Enums.EventType.Event, newHotSpot.Id);
         newHotSpot.PlayerPositionPoint = new VO_Coords();
         stage.ListHotSpots.Add(newHotSpot);
         return(newHotSpot);
     }
     MessageBox.Show(string.Format(Errors.STAGE_MAX_HOTSPOT, GlobalConstants.PERF_MAX_HOTSPOT_PER_STAGE), Errors.ERROR_BOX_TITLE);
     return(null);
 }
Exemple #7
0
        /// <summary>
        /// Déplace un objet sur la scène
        /// </summary>
        /// <param name="pX">Position en X</param>
        /// <param name="pY">Position en Y</param>
        public void MoveObject(int x, int y)
        {
            if (EditorHelper.Instance.SelectedObjects.Count == 1 && ValidateObjectAction())
            {
                VO_StageObject objectStage = EditorHelper.Instance.SelectedObjects[0];
                Rectangle      oldPosition = new Rectangle(objectStage.Location, objectStage.Size);
                objectStage.Location = new Point(EditorHelper.Instance.SelectedObjects[0].Location.X + x, EditorHelper.Instance.SelectedObjects[0].Location.Y + y);
                objectStage.Size     = EditorHelper.Instance.SelectedObjects[0].Size;

                //Mouvement spécial hotspots
                if (objectStage.ObjectType == Enums.StageObjectType.HotSpots || objectStage.ObjectType == Enums.StageObjectType.Walkables || objectStage.ObjectType == Enums.StageObjectType.Regions)
                {
                    int             movX    = objectStage.Location.X - oldPosition.X;
                    int             movY    = objectStage.Location.Y - oldPosition.Y;
                    VO_StageHotSpot hotspot = (VO_StageHotSpot)objectStage;
                    MovePoints(hotspot.Points, movX, movY);
                }

                _KeyUp = true;
                this.StageNeedsToRefreshSelection(this, new EventArgs());
            }
            ReloadItemChosen();
        }
Exemple #8
0
 /// <summary>
 /// Met à jour la location d'une zone hotspot
 /// </summary>
 /// <param name="objectStage"></param>
 public void UpdateAreaLocation(VO_StageHotSpot objectStage)
 {
     _Service.UpdateAreaLocation(objectStage);
 }