예제 #1
0
파일: Line.cs 프로젝트: nadar71/Krea
 public Line(Point position, Byte coul_A, Byte coul_R, Byte coul_G, Byte coul_B, int epaisseur, bool rempli, DisplayObject objParent)
     : base(position, coul_A, coul_R,coul_G, coul_B, rempli, epaisseur,objParent)
 {
     this.typeFigure = "LINE";
        this.Points = new List<Point>();
        this.Points.Add(position);
 }
예제 #2
0
파일: Texte.cs 프로젝트: nadar71/Krea
 public Texte(Point position, String txt, Font2 font2, Color couleur, int epaisseur, bool rempli, DisplayObject objParent)
     : base(position, couleur,Color.Empty, rempli, epaisseur,objParent)
 {
     this.typeFigure = "TEXT";
     this.txt = txt;
     this.font2 = font2;
 }
예제 #3
0
        public void initFromExistingSprite(DisplayObject obj)
        {
            this.obj = obj;
            initSpriteSetListAvailable();

            this.DisplayObjectProperties();
        }
예제 #4
0
파일: Line.cs 프로젝트: nadar71/Krea
 public Line(Point position, Color couleur, int epaisseur, bool rempli, DisplayObject objParent)
     : base(position, Color.Empty, couleur, rempli, epaisseur,objParent)
 {
     this.typeFigure = "LINE";
     this.Points = new List<Point>();
     this.Points.Add(position);
 }
예제 #5
0
        public void init(AssetManagerForm mainForm, DisplayObject obj)
        {
            this.mainForm = mainForm;
            initFromExistingSprite(obj);

            DisplayObjectProperties();
        }
예제 #6
0
파일: Texte.cs 프로젝트: nadar71/Krea
 public Texte(Point position, String txt, Font2 font2, Byte coul_A, Byte coul_R, Byte coul_G, Byte coul_B, int epaisseur, bool rempli, DisplayObject objParent)
     : base(position, coul_A, coul_R, coul_G, coul_B, rempli, epaisseur,objParent)
 {
     this.typeFigure = "TEXT";
     this.txt = txt;
     this.font2 = font2 ;
 }
예제 #7
0
파일: Rect.cs 프로젝트: nadar71/Krea
 public Rect(Point position, int largeur, int hauteur,bool isRounded, Color fillColor, Color strokeColor, int epaisseur, bool rempli, DisplayObject objParent)
     : base(position, fillColor,strokeColor, rempli, epaisseur,objParent)
 {
     this.typeFigure = "RECTANGLE";
     this.largeur = largeur;
     this.hauteur = hauteur;
     this.isRounded = isRounded;
 }
예제 #8
0
파일: Figure.cs 프로젝트: nadar71/Krea
 public Figure(Point pt, Byte coul_A, Byte coul_R, Byte coul_G, Byte coul_B, bool b, int Ep,DisplayObject objParent)
 {
     this.m_ptPosition = pt;
     this.DisplayObjectParent = objParent;
     m_A = coul_A;
     m_R = coul_R;
     m_G = coul_G;
     m_B = coul_B;
     this.m_bRempli = b;
     this.m_nEpaisseur = Ep;
 }
예제 #9
0
파일: Figure.cs 프로젝트: nadar71/Krea
        public Figure(Point pt, Color fillColor, Color strokeColor, bool b, int Ep,DisplayObject objParent)
        {
            this.m_ptPosition = pt;
            this.DisplayObjectParent = objParent;

            m_FillColor = fillColor;

            this.m_colTrait = strokeColor;

            this.m_bRempli = b;
            this.m_nEpaisseur = Ep;
        }
예제 #10
0
        //Display Object Image Corona Object
        public CoronaObject(Point location, Image image)
        {
            Events = new List<CoronaEvent>();
            Timers = new List<CoronaTimer>();
            this.PhysicsBody = new PhysicsBody(this);
            this.PathFollow = new PathFollow(this);

            DisplayObject = new DisplayObject(image, location, this);
            this.isSelected = false;
            isVisible = true;

            onStartFunction = "function() \n\n end";
            onPauseFunction = " function() \n\n end";
            onDeleteFunction = "function() \n\n end";

            this.IsHandledByTilesMap = false;
        }
예제 #11
0
        public void initFromExistingSprite(DisplayObject obj)
        {
            this.DisplayObject = obj;
            this.DisplayObjectProperties();

            if (this.DisplayObject.Image != null)
            {
                this.imagePictBx.BackgroundImage = this.DisplayObject.Image;
                if (this.DisplayObject.Image.Size.Width > this.imagePictBx.Size.Width ||
                    this.DisplayObject.Image.Size.Height > this.imagePictBx.Size.Height)
                {
                    this.imagePictBx.BackgroundImageLayout = ImageLayout.Zoom;
                }
                else
                {
                    this.imagePictBx.BackgroundImageLayout = ImageLayout.Center;
                }

            }
        }
예제 #12
0
        private void assetsListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.assetsListView.FocusedItem != null)
            {
                if (this.objectCategoryCmbBx.SelectedIndex == 0 || this.objectCategoryCmbBx.SelectedIndex == 1)
                {

                    this.displayObjectSelected = (DisplayObject)this.assetsListView.FocusedItem.Tag;

                }

                else if (this.objectCategoryCmbBx.SelectedIndex == 2)
                {
                    this.audioObjectSelected = (AudioObject)this.assetsListView.FocusedItem.Tag;
                }
                else if (this.objectCategoryCmbBx.SelectedIndex == 3)
                {
                    this.snippetSelected = (Snippet)this.assetsListView.FocusedItem.Tag;
                }
                else if (this.objectCategoryCmbBx.SelectedIndex == 4)
                {
                    this.fontItemSelected = (FontItem)this.assetsListView.FocusedItem.Tag;
                }
            }
            else
            {

                this.audioObjectSelected = null;
                this.displayObjectSelected = null;
                this.snippetSelected = null;
                this.fontItemSelected = null;
            }
        }
예제 #13
0
파일: Figure.cs 프로젝트: nadar71/Krea
 public Figure(Point pt,DisplayObject objParent)
 {
     this.m_ptPosition = pt;
     this.DisplayObjectParent = objParent;
 }
예제 #14
0
        public CoronaObject(DisplayObject displayObj)
        {
            Events = new List<CoronaEvent>();
            Timers = new List<CoronaTimer>();
            this.PhysicsBody = new PhysicsBody(this);
            this.PathFollow = new PathFollow(this);

            DisplayObject = displayObj;
            this.DisplayObject.CoronaObjectParent = this;

            this.isSelected = false;
            isVisible = true;

            onStartFunction = "function() \n\n end";
            onPauseFunction = "function() \n\n end";
            onDeleteFunction = "function() \n\n end";

            this.IsHandledByTilesMap = false;
        }
예제 #15
0
파일: Polygone.cs 프로젝트: nadar71/Krea
 public Polygone(Point position, List<Point> tabPoints, Byte coul_A, Byte coul_R, Byte coul_G, Byte coul_B, int epaisseur, bool rempli,DisplayObject objParent)
     : base(position, coul_A, coul_R,coul_G, coul_B, rempli, epaisseur, objParent)
 {
     this.tabPoints = tabPoints;
 }
예제 #16
0
파일: Polygone.cs 프로젝트: nadar71/Krea
 public Polygone(Point position, List<Point> tabPoints, Color fillColor, Color strokeColor, int epaisseur, bool rempli,DisplayObject objParent)
     : base(position, fillColor, strokeColor, rempli, epaisseur,objParent)
 {
     this.tabPoints = tabPoints;
 }
예제 #17
0
        public DisplayObject cloneInstance(bool keepLocation)
        {
            if (this.type.Equals("SPRITE"))
            {
                Point pDest;
                if (keepLocation == true)
                {
                    pDest = new Point(this.SurfaceRect.X,
                                      this.SurfaceRect.Y);
                }
                else
                {
                    pDest = new Point(this.SurfaceRect.X + 20, this.SurfaceRect.Y);
                }

                DisplayObject obj = new DisplayObject(this.SpriteSet, pDest, this.CoronaObjectParent);
                obj.OriginalAssetName = this.OriginalAssetName;
                obj.Name = this.Name;

                obj.setSequence(this.CurrentSequence);
                obj.CurrentFrame = this.CurrentFrame;
                obj.AutoPlay     = this.AutoPlay;

                return(obj);
            }
            else if (this.type.Equals("IMAGE"))
            {
                //Creer une nouvelle Image
                Image         newImage         = null;
                DisplayObject newDisplayObject = null;

                if (this.GorgonSprite != null)
                {
                    GorgonLibrary.Graphics.Sprite newGorgonSprite = (GorgonLibrary.Graphics.Sprite) this.GorgonSprite.Clone();
                    newDisplayObject = new DisplayObject(newGorgonSprite, new Point(0, 0), this.CoronaObjectParent);
                }
                else if (this.image != null)
                {
                    newImage         = new Bitmap(this.image);
                    newDisplayObject = new DisplayObject(newImage, new Point(0, 0), this.CoronaObjectParent);
                }
                else
                {
                    return(null);
                }


                newDisplayObject.OriginalAssetName = this.OriginalAssetName;
                newDisplayObject.Name = this.Name;
                //Changer la position de l'objet
                Point pDest;
                if (keepLocation == true)
                {
                    pDest = new Point(this.SurfaceRect.X,
                                      this.SurfaceRect.Y);
                }
                else
                {
                    pDest = new Point(this.SurfaceRect.X + 20, this.SurfaceRect.Y);
                }

                newDisplayObject.surfaceRect = new Rectangle(pDest, this.surfaceRect.Size);
                newDisplayObject.InitialRect = new Rectangle(this.InitialRect.X, this.InitialRect.Y,
                                                             this.InitialRect.Width, this.InitialRect.Height);

                newDisplayObject.ImageFillColor = this.ImageFillColor;


                return(newDisplayObject);
            }
            else if (this.type.Equals("FIGURE"))
            {
                //Recuperer le clone de la figure
                Figure newFig = this.Figure.CloneInstance(keepLocation);

                DisplayObject newDisplayObject = new DisplayObject(newFig, this.CoronaObjectParent);
                newFig.DisplayObjectParent         = newDisplayObject;
                newDisplayObject.OriginalAssetName = this.OriginalAssetName;
                newDisplayObject.Name = this.Name;

                //Copy the gradient color
                newDisplayObject.GradientColor.color1    = this.GradientColor.color1;
                newDisplayObject.GradientColor.color2    = this.GradientColor.color2;
                newDisplayObject.GradientColor.isEnabled = this.GradientColor.isEnabled;
                newDisplayObject.GradientColor.direction = this.GradientColor.direction;

                if (newFig.ShapeType.Equals("TEXT"))
                {
                    Texte text = (Texte)newFig;

                    if (this.GorgonSprite != null)
                    {
                        newDisplayObject.GorgonSprite = (GorgonLibrary.Graphics.Sprite) this.GorgonSprite.Clone();
                    }
                    Point pDest;
                    if (keepLocation == true)
                    {
                        pDest = new Point(text.Position.X,
                                          text.Position.Y);
                    }
                    else
                    {
                        pDest = new Point(text.Position.X + 20,
                                          text.Position.Y);
                    }
                    newDisplayObject.SurfaceRect = new Rectangle(pDest, this.surfaceRect.Size);
                }

                return(newDisplayObject);
            }

            return(null);
        }
예제 #18
0
        public void removeDisplayObject(DisplayObject obj)
        {
            if (this.CurrentAssetProject != null)
            {
                if (this.CurrentAssetProject.ListObjects.Contains(obj))
                    this.CurrentAssetProject.ListObjects.Remove(obj);

                if (obj.Image != null)
                {
                    obj.Image.Dispose();
                }

                obj = null;
            }
        }
예제 #19
0
        public void openSpriteManagerFromObject(DisplayObject obj)
        {
            hideAllObjectsPanel();

            //Si le tab est deja ouvert
            SpriteManagerPanel panel = null;
            UserControl page = getObjectPanelFromObject(obj);
            if (page != null)
            {
                page.Visible = true;
                panel = (SpriteManagerPanel)page;
            }
            //Sinn
            else
            {
                //Create a spite manager panel
                panel = new SpriteManagerPanel();
                panel.init(this, obj);
                panel.Dock = DockStyle.Fill;
                panel.Tag = obj;

                addNewControlToObjectsPanel(panel);

                panel.Visible = true;
            }

            panel.DisplayObjectProperties();
        }
예제 #20
0
파일: Form1.cs 프로젝트: nadar71/Krea
        public void addFigureBt_Click(object sender, EventArgs e)
        {
            if (this.sceneEditorView1.FigActive != null &&
                (this.gameElementTreeView1.LayerSelected != null ||
                (this.gameElementTreeView1.CoronaObjectSelected !=null && this.gameElementTreeView1.CoronaObjectSelected.isEntity == true)))
            {

                this.sceneEditorView1.FigActive.FillColor = Color.Gray;
                this.sceneEditorView1.FigActive.Fill = true;
                if (this.sceneEditorView1.FigActive.ShapeType.Equals("CURVE"))
                {
                    CGE_Figures.CourbeBezier courbe = this.sceneEditorView1.FigActive as CGE_Figures.CourbeBezier;
                    if (courbe.UserPoints.Count < 2)
                        return;
                }

                if (this.sceneEditorView1.FigActive.ShapeType.Equals("LINE"))
                {
                    CGE_Figures.Line line = this.sceneEditorView1.FigActive as CGE_Figures.Line;

                    if (line.Points.Count < 2)
                        return;
                }

                //Creer un displayObject
                DisplayObject dispObject = new DisplayObject(this.sceneEditorView1.FigActive,null);
                if (dispObject.Type.Equals("FIGURE"))
                {
                    if (dispObject.Figure.ShapeType.Equals("TEXT"))
                    {
                        CGE_Figures.Texte text = dispObject.Figure as CGE_Figures.Texte;

                        //int width = Convert.ToInt32(text.font2.Size * (text.txt.Length / 1.5));
                        //int height = Convert.ToInt32(text.font2.Size * 1.5);
                        Point pDest = this.sceneEditorView1.surfaceTextTemp.Location;
                        Size size = this.sceneEditorView1.surfaceTextTemp.Size;
                        dispObject.SurfaceRect = new Rectangle(pDest, size);
                        this.sceneEditorView1.surfaceTextTemp = Rectangle.Empty ;
                        //Recuperer la clé du translate
                        bool isFound = false;
                        for (int i = 0; i < this.CurrentProject.Langues.Count; i++)
                        {
                            LangueObject langue = this.CurrentProject.Langues[i];
                            if (langue.Langue.Equals(this.CurrentProject.DefaultLanguage))
                            {
                                for (int j = 0; j < langue.TranslationElement.Count; j++)
                                {
                                    LangueElement elem = langue.TranslationElement[j];
                                    if (elem.Key.Equals(text.txt))
                                    {
                                        elem.Key = text.txt;
                                        elem.Translation = text.txt;
                                        isFound = true;
                                        break;
                                    }

                                }

                                if (isFound == false)
                                {
                                    LangueElement elem = new LangueElement(text.txt, text.txt);
                                    langue.TranslationElement.Add(elem);
                                }

                                break;
                            }
                        }

                    }
                }

                if (this.gameElementTreeView1.CoronaObjectSelected != null &&
                    (this.gameElementTreeView1.CoronaObjectSelected.isEntity == true ||this.gameElementTreeView1.CoronaObjectSelected.EntityParent != null))
                {
                    dispObject.Name = this.gameElementTreeView1.ProjectSelected.IncrementObjectName("shape" + this.gameElementTreeView1.CoronaObjectSelected.LayerParent.CoronaObjects.Count);
                    //Creer un corona object
                    CoronaObject obj = new CoronaObject(dispObject);

                    this.sceneEditorView1.GraphicsContentManager.UpdateSpriteContent(obj, this.sceneEditorView1.CurrentScale, this.sceneEditorView1.getOffsetPoint());

                    if (this.gameElementTreeView1.CoronaObjectSelected.isEntity == true)
                    {
                        //Ajouter l'objet au projet
                        this.gameElementTreeView1.CoronaObjectSelected.Entity.addObject(obj);
                    }
                    else
                    {
                        //Ajouter l'objet au projet
                        this.gameElementTreeView1.CoronaObjectSelected.EntityParent.addObject(obj);
                    }

                    this.gameElementTreeView1.newCoronaObject(obj);
                }
                else
                {
                    dispObject.Name = this.gameElementTreeView1.ProjectSelected.IncrementObjectName("shape" + this.gameElementTreeView1.LayerSelected.CoronaObjects.Count);

                    //Creer un corona object
                    CoronaObject obj = new CoronaObject(dispObject);

                    //Ajouter l'objet au projet
                    this.gameElementTreeView1.LayerSelected.addCoronaObject(obj, true);
                    this.sceneEditorView1.GraphicsContentManager.UpdateSpriteContent(obj,this.sceneEditorView1.CurrentScale,this.sceneEditorView1.getOffsetPoint());
                    this.gameElementTreeView1.newCoronaObject(obj);
                }

                this.sceneEditorView1.FigActive = null;
                this.sceneEditorView1.isBezierCreated = false;
                this.sceneEditorView1.isLineCreated = false;
                this.SetModeObject();
            }
        }
예제 #21
0
 public void init(DisplayObject obj,AssetManagerForm mainForm)
 {
     this.mainForm = mainForm;
     initFromExistingSprite(obj);
 }
예제 #22
0
 public SpritePropertyConverter(DisplayObject obj, AssetManagerForm MainForm)
 {
     objSelected = obj;
 }
예제 #23
0
        public CoronaObject cloneObject(CoronaLayer layerDest, bool incrementName, bool keepPosition)
        {
            if (this.isEntity == true)
            {
                CoronaObject newEntity = new CoronaObject(true);
                newEntity.isEnabled = this.isEnabled;
                layerDest.addCoronaObject(newEntity, incrementName);
                newEntity.Entity = this.Entity.cloneEntity(newEntity);

                return(newEntity);
            }
            else if (this.EntityParent != null)
            {
                if (this.displayObject != null)
                {
                    //Dupliquer le displayObject
                    DisplayObject newDisplayObject = this.DisplayObject.cloneInstance(keepPosition);

                    CoronaObject newObject = new CoronaObject(newDisplayObject);
                    newObject.displayObject.Name = layerDest.SceneParent.projectParent.IncrementObjectName(newDisplayObject.Name);

                    if (newObject != null)
                    {
                        //Copier le body
                        if (this.PhysicsBody != null)
                        {
                            newObject.PhysicsBody = this.PhysicsBody.cloneBody(newObject);
                        }


                        newObject.isDraggable = this.isDraggable;

                        //Copier les events de l'objet
                        newObject.onStartFunction  = this.onStartFunction;
                        newObject.onPauseFunction  = this.onPauseFunction;
                        newObject.onDeleteFunction = this.onDeleteFunction;

                        StringBuilder sb = new StringBuilder();
                        //Retirer le nom des functions et les ajuster au nom de l'objet
                        //---POUR START

                        sb.Append(newObject.onStartFunction);
                        newObject.onStartFunction = sb.ToString().Replace(this.displayObject.Name, newObject.displayObject.Name);
                        sb.Clear();

                        //---POUR PAUSE

                        sb.Append(newObject.onPauseFunction);
                        newObject.onPauseFunction = sb.ToString().Replace(this.displayObject.Name, newObject.displayObject.Name);
                        sb.Clear();

                        //---POUR DELETE

                        sb.Append(newObject.onDeleteFunction);
                        newObject.onDeleteFunction = sb.ToString().Replace(this.displayObject.Name, newObject.displayObject.Name);
                        sb.Clear();


                        if (this.isGenerator == true)
                        {
                            newObject.isGenerator             = true;
                            newObject.generatorDelay          = this.generatorDelay;
                            newObject.generatorIteration      = this.generatorIteration;
                            newObject.generatorEmissionType   = this.generatorEmissionType;
                            newObject.FadeInEnabled           = this.FadeInEnabled;
                            newObject.FadeInSpeed             = this.FadeInSpeed;
                            newObject.FadeOutEnabled          = this.FadeOutEnabled;
                            newObject.FadeOutSpeed            = this.FadeOutSpeed;
                            newObject.RemoveOnCompleteFadeOut = this.RemoveOnCompleteFadeOut;
                            newObject.DelayBetweenFades       = this.DelayBetweenFades;
                            newObject.GeneratorXImpulse       = this.GeneratorXImpulse;
                            newObject.GeneratorYImpulse       = this.GeneratorYImpulse;
                        }

                        newObject.displayObject.GradientColor.isEnabled = this.displayObject.GradientColor.isEnabled;
                        newObject.displayObject.GradientColor.color1    = this.displayObject.GradientColor.color1;
                        newObject.displayObject.GradientColor.color2    = this.displayObject.GradientColor.color2;
                        newObject.displayObject.GradientColor.direction = this.displayObject.GradientColor.direction;
                        newObject.displayObject.Alpha = this.displayObject.Alpha;

                        newObject.PathFollow             = this.PathFollow.cloneInstance(newObject);
                        newObject.displayObject.Rotation = this.displayObject.Rotation;


                        newObject.isDraggable = this.isDraggable;

                        return(newObject);
                    }
                }
            }
            else
            {
                if (this.displayObject != null)
                {
                    //Dupliquer le displayObject
                    DisplayObject newDisplayObject = this.DisplayObject.cloneInstance(keepPosition);

                    CoronaObject newObject = new CoronaObject(newDisplayObject);


                    if (newObject != null)
                    {
                        newObject.isEnabled = this.isEnabled;
                        //Copier le layer parent
                        layerDest.addCoronaObject(newObject, incrementName);
                        newObject.displayObject.OriginalAssetName = this.displayObject.OriginalAssetName;

                        //Copier le body
                        if (this.PhysicsBody != null)
                        {
                            newObject.PhysicsBody = this.PhysicsBody.cloneBody(newObject);
                        }



                        //Copier les events de l'objet
                        newObject.onStartFunction  = this.onStartFunction;
                        newObject.onPauseFunction  = this.onPauseFunction;
                        newObject.onDeleteFunction = this.onDeleteFunction;

                        StringBuilder sb = new StringBuilder();
                        //Retirer le nom des functions et les ajuster au nom de l'objet
                        //---POUR START

                        sb.Append(newObject.onStartFunction);
                        newObject.onStartFunction = sb.ToString().Replace(this.displayObject.Name, newObject.displayObject.Name);
                        sb.Clear();

                        //---POUR PAUSE

                        sb.Append(newObject.onPauseFunction);
                        newObject.onPauseFunction = sb.ToString().Replace(this.displayObject.Name, newObject.displayObject.Name);
                        sb.Clear();

                        //---POUR DELETE

                        sb.Append(newObject.onDeleteFunction);
                        newObject.onDeleteFunction = sb.ToString().Replace(this.displayObject.Name, newObject.displayObject.Name);
                        sb.Clear();


                        if (this.isGenerator == true)
                        {
                            newObject.isGenerator             = true;
                            newObject.generatorDelay          = this.generatorDelay;
                            newObject.generatorIteration      = this.generatorIteration;
                            newObject.generatorEmissionType   = this.generatorEmissionType;
                            newObject.FadeInEnabled           = this.FadeInEnabled;
                            newObject.FadeInSpeed             = this.FadeInSpeed;
                            newObject.FadeOutEnabled          = this.FadeOutEnabled;
                            newObject.FadeOutSpeed            = this.FadeOutSpeed;
                            newObject.RemoveOnCompleteFadeOut = this.RemoveOnCompleteFadeOut;
                            newObject.DelayBetweenFades       = this.DelayBetweenFades;
                            newObject.GeneratorXImpulse       = this.GeneratorXImpulse;
                            newObject.GeneratorYImpulse       = this.GeneratorYImpulse;
                        }

                        newObject.displayObject.GradientColor.isEnabled = this.displayObject.GradientColor.isEnabled;
                        newObject.displayObject.GradientColor.color1    = this.displayObject.GradientColor.color1;
                        newObject.displayObject.GradientColor.color2    = this.displayObject.GradientColor.color2;
                        newObject.displayObject.GradientColor.direction = this.displayObject.GradientColor.direction;
                        newObject.displayObject.Alpha = this.displayObject.Alpha;

                        newObject.PathFollow             = this.PathFollow.cloneInstance(newObject);
                        newObject.displayObject.Rotation = this.displayObject.Rotation;

                        newObject.isDraggable = this.isDraggable;
                        return(newObject);
                    }
                }
            }


            return(null);
        }
예제 #24
0
        private void surfacePictBx_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(ListViewItem)))
            {
                ListViewItem item = e.Data.GetData(typeof(ListViewItem)) as ListViewItem;

                if (item.Tag is DisplayObject)
                {
                    DisplayObject obj = (DisplayObject)item.Tag;

                    GameElementTreeView treeView = this.mainForm.getElementTreeView();
                    if (treeView.LayerSelected != null)
                    {
                        DisplayObject dispObjTemp = obj.cloneInstance(true);
                        dispObjTemp.Name = obj.Name.ToLower().Replace(" ", "").Replace("_", "").Replace("-", ""); ;
                        dispObjTemp.OriginalAssetName = obj.Name;

                        //Creer un corona object et l'ajouter
                        CoronaObject finalObj = new CoronaObject(dispObjTemp);
                        this.GraphicsContentManager.UpdateSpriteContent(finalObj,this.CurrentScale,this.getOffsetPoint());
                        this.GraphicsContentManager.CleanProjectBitmaps();
                        if (this.mainForm.imageObjectsPanel1.ShouldBeRefreshed == true)
                        {
                            this.mainForm.imageObjectsPanel1.RefreshCurrentAssetProject();
                            this.mainForm.imageObjectsPanel1.ShouldBeRefreshed = false;
                        }

                        CoronaObject objectSelectedInTreeView = this.mainForm.getElementTreeView().CoronaObjectSelected;
                        if (objectSelectedInTreeView != null)
                        {
                            if (objectSelectedInTreeView.EntityParent != null)
                            {
                                objectSelectedInTreeView.EntityParent.addObject(finalObj);
                            }
                            else if (objectSelectedInTreeView.isEntity == true)
                            {
                                objectSelectedInTreeView.Entity.addObject(finalObj);
                            }
                            else
                            {
                                treeView.LayerSelected.addCoronaObject(finalObj, true);
                            }

                        }
                        else
                        {

                            treeView.LayerSelected.addCoronaObject(finalObj, true);
                        }

                        treeView.newCoronaObject(finalObj);

                        Point offSet = this.getOffsetPoint();
                        Rectangle surfacePictBx = this.surfacePictBx.RectangleToClient(new Rectangle(new Point(e.X, e.Y), new Size(10, 10)));

                        Point dest = new Point(Convert.ToInt32(surfacePictBx.X * (1 / this.CurrentScale)) - offSet.X - finalObj.DisplayObject.SurfaceRect.Width / 2,
                            Convert.ToInt32(surfacePictBx.Y * (1 / this.CurrentScale)) - offSet.Y - finalObj.DisplayObject.SurfaceRect.Height / 2);
                        finalObj.DisplayObject.SurfaceRect = new Rectangle(dest, finalObj.DisplayObject.SurfaceRect.Size);

                        if (this.mainForm.isFormLocked == false)
                            GorgonLibrary.Gorgon.Go();

                    }
                    else
                        MessageBox.Show("Please select a layer before adding a new display object!", "Select a layer", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
            }
            else
            {
                string filename = String.Empty;
                bool ret = false;
                if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy)
                {
                    Array data = ((IDataObject)e.Data).GetData("FileName") as Array;
                    if (data != null)
                    {
                        if ((data.Length == 1) && (data.GetValue(0) is String))
                        {
                            filename = ((string[])data)[0];
                            string ext = System.IO.Path.GetExtension(filename).ToLower();
                            if ((ext == ".jpg") || (ext == ".png") || (ext == ".bmp"))
                            {
                                ret = true;
                            }
                        }
                    }
                }

                if (ret == true)
                {

                    if (this.mainForm.CurrentProject != null)
                    {
                        GameElementTreeView treeView = this.mainForm.getElementTreeView();

                        if (treeView.LayerSelected != null)
                        {
                            System.Drawing.Image image = new Bitmap(System.Drawing.Image.FromFile(filename));
                            DisplayObject dispObjTemp = new DisplayObject(image, Point.Empty, null);
                            dispObjTemp.Name = System.IO.Path.GetFileNameWithoutExtension(filename).Replace("~","_");
                            dispObjTemp.OriginalAssetName = dispObjTemp.Name;

                            //Creer un corona object et l'ajouter
                            CoronaObject obj = new CoronaObject(dispObjTemp);
                            if (obj.DisplayObject != null)
                            {
                                obj.DisplayObject.SurfaceRect = new Rectangle(treeView.LayerSelected.SceneParent.SurfaceFocus.Location, obj.DisplayObject.SurfaceRect.Size);
                            }
                            this.GraphicsContentManager.UpdateSpriteContent(obj, this.CurrentScale, this.getOffsetPoint());
                            this.GraphicsContentManager.CleanProjectBitmaps();
                            if (this.mainForm.imageObjectsPanel1.ShouldBeRefreshed == true)
                            {
                                this.mainForm.imageObjectsPanel1.RefreshCurrentAssetProject();
                                this.mainForm.imageObjectsPanel1.ShouldBeRefreshed = false;
                            }

                            CoronaObject objectSelectedInTreeView = treeView.CoronaObjectSelected;
                            if (objectSelectedInTreeView != null)
                            {
                                if (objectSelectedInTreeView.EntityParent != null)
                                {
                                    objectSelectedInTreeView.EntityParent.addObject(obj);
                                }
                                else if (objectSelectedInTreeView.isEntity == true)
                                {
                                    objectSelectedInTreeView.Entity.addObject(obj);
                                }
                                else
                                {
                                    treeView.LayerSelected.addCoronaObject(obj, true);
                                }

                            }
                            else
                            {

                                treeView.LayerSelected.addCoronaObject(obj, true);
                            }

                            treeView.newCoronaObject(obj);

                            Point offSet = this.getOffsetPoint();
                            Rectangle surfacePictBx = this.surfacePictBx.RectangleToClient(new Rectangle(new Point(e.X, e.Y), new Size(10, 10)));

                            Point dest = new Point(Convert.ToInt32(surfacePictBx.X * (1 / this.CurrentScale)) - offSet.X - obj.DisplayObject.SurfaceRect.Width / 2,
                                Convert.ToInt32(surfacePictBx.Y * (1 / this.CurrentScale)) - offSet.Y - obj.DisplayObject.SurfaceRect.Height / 2);
                            obj.DisplayObject.SurfaceRect = new Rectangle(dest, obj.DisplayObject.SurfaceRect.Size);

                            if (this.mainForm.isFormLocked == false)
                                GorgonLibrary.Gorgon.Go();
                        }
                    }
                }

            }
        }
예제 #25
0
        private void newAssetBt_Click(object sender, EventArgs e)
        {
            if (this.CurrentAssetProject != null)
            {
                if (this.assetTypeListView.SelectedItems.Count > 0)
                {
                    string assetTypeSelected = this.assetTypeListView.SelectedItems[0].ToolTipText;
                    object objectCreated = null;
                    if (assetTypeSelected.Equals("Image"))
                    {
                        DisplayObject obj = new DisplayObject(new Bitmap(Properties.Resources.bmpFileIcon), new Point(0, 0), null);
                        obj.Name = "image" + this.CurrentAssetProject.ListObjects.Count;
                        this.CurrentAssetProject.ListObjects.Add(obj);
                        objectCreated = obj;

                    }
                    else if (assetTypeSelected.Equals("Sprite"))
                    {
                        DisplayObject obj = new DisplayObject(new CoronaSpriteSet(""), new Point(0, 0),null);
                        obj.Name = "sprite" + this.CurrentAssetProject.ListObjects.Count;
                        this.CurrentAssetProject.ListObjects.Add(obj);
                        objectCreated = obj;
                    }
                    else if (assetTypeSelected.Equals("Sprite Set"))
                    {
                        CoronaSpriteSet obj = new CoronaSpriteSet("Spriteset"+this.CurrentAssetProject.SpriteSets.Count);
                        this.CurrentAssetProject.SpriteSets.Add(obj);
                        objectCreated = obj;
                    }
                    else if (assetTypeSelected.Equals("Sprite Sheet"))
                    {
                        CoronaSpriteSheet obj = new CoronaSpriteSheet("Spritesheet" + this.CurrentAssetProject.SpriteSheets.Count);
                        this.CurrentAssetProject.SpriteSheets.Add(obj);
                        objectCreated = obj;
                    }
                    else if (assetTypeSelected.Equals("Audio"))
                    {
                        AudioObject obj = new AudioObject("", "Audio" + this.CurrentAssetProject.SpriteSheets.Count, 1, false, 1, "SOUND");
                        this.CurrentAssetProject.Audios.Add(obj);
                        objectCreated = obj;
                    }
                    else if (assetTypeSelected.Equals("Snippet"))
                    {
                        Snippet obj = new Snippet("snippet" + this.CurrentAssetProject.Snippets.Count,"", "", "", "", 1, "");
                        this.CurrentAssetProject.Snippets.Add(obj);
                        objectCreated = obj;
                    }
                    else if (assetTypeSelected.Equals("Font"))
                    {
                        if(this.CurrentAssetProject.Fonts == null)
                            this.CurrentAssetProject.Fonts = new List<FontItem>();

                        FontItem obj = new FontItem("font" + this.CurrentAssetProject.Fonts.Count, null);
                        this.CurrentAssetProject.Fonts.Add(obj);
                        objectCreated = obj;
                    }

                    if (objectCreated != null)
                    {
                        this.RefreshAssetListView();
                        this.openPanelFromObject(objectCreated);
                    }

                }

            }
        }
예제 #26
0
 public ImagePropertyConverter(DisplayObject obj, AssetManagerForm MainForm,ImageManagerPanel imagePanel)
 {
     objSelected = obj;
     this.MainForm = MainForm;
     this.imagePanel = imagePanel;
 }
예제 #27
0
        public DisplayObject cloneInstance(bool keepLocation)
        {
            if (this.type.Equals("SPRITE"))
            {
                Point pDest;
                if (keepLocation == true)
                {
                    pDest = new Point(this.SurfaceRect.X,
                                      this.SurfaceRect.Y);
                }
                else
                {
                    pDest = new Point(this.SurfaceRect.X + 20, this.SurfaceRect.Y );
                }

                DisplayObject obj = new DisplayObject(this.SpriteSet, pDest, this.CoronaObjectParent);
                obj.OriginalAssetName = this.OriginalAssetName;
                obj.Name = this.Name;

                obj.setSequence(this.CurrentSequence);
                obj.CurrentFrame = this.CurrentFrame;
                obj.AutoPlay = this.AutoPlay;

                return obj;
            }
            else if (this.type.Equals("IMAGE"))
            {
                //Creer une nouvelle Image
                Image newImage = null;
                DisplayObject newDisplayObject = null;

                if (this.GorgonSprite != null)
                {
                    GorgonLibrary.Graphics.Sprite newGorgonSprite = (GorgonLibrary.Graphics.Sprite)this.GorgonSprite.Clone();
                    newDisplayObject = new DisplayObject(newGorgonSprite, new Point(0, 0), this.CoronaObjectParent);
                }
                else if (this.image != null)
                {
                    newImage = new Bitmap(this.image);
                    newDisplayObject = new DisplayObject(newImage, new Point(0, 0), this.CoronaObjectParent);
                }
                else return null;

                newDisplayObject.OriginalAssetName = this.OriginalAssetName;
                newDisplayObject.Name = this.Name;
                //Changer la position de l'objet
                 Point pDest;
                 if (keepLocation == true)
                 {
                     pDest = new Point(this.SurfaceRect.X,
                                       this.SurfaceRect.Y);
                 }
                 else
                 {
                     pDest = new Point(this.SurfaceRect.X + 20, this.SurfaceRect.Y);
                 }

                newDisplayObject.surfaceRect = new Rectangle(pDest, this.surfaceRect.Size);
                newDisplayObject.InitialRect = new Rectangle(this.InitialRect.X, this.InitialRect.Y,
                                                        this.InitialRect.Width, this.InitialRect.Height);

                newDisplayObject.ImageFillColor = this.ImageFillColor;

                return newDisplayObject;
            }
            else if (this.type.Equals("FIGURE"))
            {
                //Recuperer le clone de la figure
                Figure newFig = this.Figure.CloneInstance(keepLocation);

                DisplayObject newDisplayObject = new DisplayObject(newFig, this.CoronaObjectParent);
                newFig.DisplayObjectParent = newDisplayObject;
                newDisplayObject.OriginalAssetName = this.OriginalAssetName;
                newDisplayObject.Name = this.Name;

                //Copy the gradient color
                newDisplayObject.GradientColor.color1 = this.GradientColor.color1;
                newDisplayObject.GradientColor.color2 = this.GradientColor.color2;
                newDisplayObject.GradientColor.isEnabled = this.GradientColor.isEnabled;
                newDisplayObject.GradientColor.direction = this.GradientColor.direction;

                if (newFig.ShapeType.Equals("TEXT"))
                {
                    Texte text = (Texte)newFig;

                    if (this.GorgonSprite != null)
                    {
                        newDisplayObject.GorgonSprite = (GorgonLibrary.Graphics.Sprite)this.GorgonSprite.Clone();

                    }
                     Point pDest;
                     if (keepLocation == true)
                     {
                         pDest = new Point(text.Position.X,
                                          text.Position.Y);
                     }
                     else
                     {
                         pDest = new Point(text.Position.X + 20,
                                           text.Position.Y);
                     }
                     newDisplayObject.SurfaceRect = new Rectangle(pDest, this.surfaceRect.Size);
                }

                return newDisplayObject;
            }

            return null;
        }
예제 #28
0
파일: Cercle.cs 프로젝트: nadar71/Krea
 public Cercle(Point position, int rayon, Color fillColor, Color strokeColor, int epaisseur, bool rempli,DisplayObject objParent)
     : base(position, fillColor, strokeColor, rempli, epaisseur,objParent)
 {
     this.typeFigure = "CIRCLE";
     this.m_nRayon = rayon;
 }
예제 #29
0
파일: Libre.cs 프로젝트: nadar71/Krea
 public Libre(Point position, List<Point> tabPoints, Color couleur, int epaisseur, bool rempli,DisplayObject objParent)
     : base(position, Color.Empty,couleur,rempli, epaisseur,objParent)
 {
     this.tabPoints = tabPoints;
 }