Esempio n. 1
0
        //----------------------------------------------------------
        //----------------SCENE-----------------------
        //----------------------------------------------------------
        public void newScene(Scene scene)
        {
            if (this.ProjectRootNodeSelected != null)
            {
                this.SceneSelected = scene;

                GameElement node = new GameElement("STAGE", scene.Name, scene);
                node.ExpandAll();
                this.ProjectRootNodeSelected.Nodes.Insert(scene.projectParent.Scenes.Count, node);

                if (scene.projectParent.isEnabled == false)
                {
                    scene.isEnabled = true;
                }

                node.Checked = scene.isEnabled;
              /*  //Ajouter une node pour les spritesheets  ---------------------------------------------
                TreeNode nodeSpriteSheets = new TreeNode("SpriteSheets");
                nodeSpriteSheets.Name = "SPRITESHEETS";
                nodeSpriteSheets.ImageIndex = 5;
                nodeSpriteSheets.SelectedImageIndex = 5;
                node.Nodes.Add(nodeSpriteSheets);

                for (int i = 0; i < scene.SpriteSheets.Count; i++)
                {
                    CoronaSpriteSheet sheet = scene.SpriteSheets[i];
                    GameElement nodeSheet = new GameElement("SPRITESHEET", sheet.Name, sheet);
                    nodeSpriteSheets.Nodes.Add(nodeSheet);
                }

                //Ajouter une node pour les spriteSets ---------------------------------------------
                TreeNode nodeSpriteSets = new TreeNode("SpriteSets");
                nodeSpriteSets.Name = "SPRITESETS";
                nodeSpriteSets.ImageIndex = 4;
                nodeSpriteSets.SelectedImageIndex = 4;
                node.Nodes.Add(nodeSpriteSets);

                for (int i = 0; i < scene.SpriteSets.Count; i++)
                {
                    CoronaSpriteSet set = scene.SpriteSets[i];
                    GameElement nodeSet = new GameElement("SPRITESET", set.Name, set);
                    nodeSpriteSets.Nodes.Add(nodeSet);
                }*/

                //Recreer les layer
                for (int i = 0; i < scene.Layers.Count; i++)
                {
                    if(scene.Layers[i].Entities == null)
                        scene.Layers[i].Entities = new List<CoronaEntity>();

                    this.newLayer(scene, scene.Layers[i]);
                }

                this.treeViewElements_NodeMouseClick(null, new TreeNodeMouseClickEventArgs(node, MouseButtons.Left, 1, 0, 0));

            }
        }
Esempio n. 2
0
        //----------------------------------------------------------
        //----------------CORONA JOINTURE-----------------------
        //----------------------------------------------------------
        public void newJoint(CoronaJointure joint,bool addToList,TreeNode nodeExisting)
        {
            if (joint != null)
            {
                CoronaObject coronaObjA = joint.coronaObjA;
                CoronaObject coronaObjB = joint.coronaObjB;
                if (coronaObjA != null && coronaObjB != null)
                {
                    if (coronaObjA.EntityParent != null && coronaObjB.EntityParent != null)
                    {
                        if (coronaObjA.EntityParent == coronaObjB.EntityParent)
                        {
                            GameElement entityNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, coronaObjA.EntityParent.objectParent);
                            if (entityNode != null)
                            {

                                if (addToList == true)
                                    coronaObjA.EntityParent.Jointures.Add(joint);

                                TreeNode nodeJoints = entityNode.Nodes["JOINTS"];

                                if (nodeExisting == null)
                                {
                                    GameElement nodeNewJoint = new GameElement("JOINT", joint.name, joint);
                                    nodeJoints.Nodes.Add(nodeNewJoint);

                                    nodeNewJoint.Checked = joint.isEnabled;
                                }
                                else
                                {
                                    nodeJoints.Nodes.Add(nodeExisting);
                                }

                                return;
                            }

                        }
                    }
                    else if (coronaObjA != null && coronaObjB == null)
                    {
                        if (coronaObjA.EntityParent != null)
                        {
                            GameElement entityNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, coronaObjA.EntityParent.objectParent);
                            if (entityNode != null)
                            {
                                if (addToList == true)
                                    coronaObjA.EntityParent.Jointures.Add(joint);

                                TreeNode nodeJoints = entityNode.Nodes["JOINTS"];

                                if (nodeExisting == null)
                                {
                                    GameElement nodeNewJoint = new GameElement("JOINT", joint.name, joint);
                                    nodeJoints.Nodes.Add(nodeNewJoint);
                                    nodeNewJoint.Checked = joint.isEnabled;
                                }
                                else
                                {
                                    nodeJoints.Nodes.Add(nodeExisting);
                                }

                                return;
                            }
                        }
                    }

                }

                GameElement layerNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, joint.layerParent);
                if (layerNode != null)
                {

                    if (addToList == true)
                        joint.layerParent.Jointures.Add(joint);

                    TreeNode nodeJoints = layerNode.Nodes["JOINTS"];

                    if (nodeExisting == null)
                    {
                        GameElement nodeNewJoint = new GameElement("JOINT", joint.name, joint);
                        nodeNewJoint.Checked = joint.isEnabled;
                        nodeJoints.Nodes.Add(nodeNewJoint);
                    }
                    else
                    {
                        nodeJoints.Nodes.Add(nodeExisting);
                    }
                }

            }
        }
Esempio n. 3
0
        //----------------------------------------------------------
        //----------------LAYER-----------------------
        //----------------------------------------------------------
        public void newLayer(Scene scene,CoronaLayer layer)
        {
            this.LayerSelected = layer;
            this.CoronaObjectSelected = null;
            this.LayerSelected.deselectAllObjects();
            GameElement node = new GameElement("LAYER",layer.Name, layer);
            if (scene.projectParent.isEnabled == false)
            {
                layer.isEnabled = true;
            }

            node.Checked = layer.isEnabled;

            GameElement sceneNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, scene);
            if (sceneNode != null)
            {

                sceneNode.Nodes.Add(node);

                //Ajouter les jointures
                TreeNode nodeJoints = new TreeNode("Joints");

                nodeJoints.Name = "JOINTS";
                nodeJoints.ImageIndex = 8;
                nodeJoints.SelectedImageIndex = 8;
                node.Nodes.Add(nodeJoints);
                this.HideCheckBox(this.treeViewElements, nodeJoints);
                for (int i = 0; i < layer.Jointures.Count; i++)
                {
                    this.newJoint(layer.Jointures[i], false, null);
                }

                //Ajouter une tiles map si existante
                if (layer.TilesMap != null)
                {
                    layer.TilesMap.LayerParent = layer;
                    this.newTilesMap(layer.TilesMap);

                }

                //Ajouter tous les objet du layer
                for (int i = 0; i < layer.CoronaObjects.Count; i++)
                {
                    this.newCoronaObject(layer.CoronaObjects[i]);
                    this.CoronaObjectSelected = null;
                }

                //Ajouter tous les Controls du layer

                for (int i = 0; i < layer.Controls.Count; i++)
                {
                    this.newCoronaControl(layer.Controls[i]);
                }

                //Ajouter tous les Widgets du layer

                for (int i = 0; i < layer.Widgets.Count; i++)
                {
                    this.newCoronaWidget(layer.Widgets[i]);
                }

                node.Expand();
            }

            sceneNode.Expand();
        }
Esempio n. 4
0
        //----------------------------------------------------------
        //----------------Corona Widget-----------------------
        //----------------------------------------------------------
        public void newCoronaWidget(CoronaWidget widget)
        {
            if (this.LayerSelected != null)
            {

                GameElement node = new GameElement("WIDGET", widget.Name, widget);
                node.Checked = false;

                GameElement layerNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, LayerSelected);
                if (layerNode != null)
                {
                    layerNode.Nodes.Add(node);

                }

            }
        }
Esempio n. 5
0
        //----------------------------------------------------------
        //----------------Corona FONT OBJECT-----------------------
        //----------------------------------------------------------
        public void newFontItem(FontItem font)
        {
            if (this.ProjectRootNodeSelected != null)
            {
                GameElement node = new GameElement("FONT", font.NameForIphone, font);
                node.Checked = false;
                this.ProjectRootNodeSelected.Nodes["FONTS"].Nodes.Add(node);
                this.HideCheckBox(this.treeViewElements, node);

            }
        }
Esempio n. 6
0
        //----------------------------------------------------------
        //---------------Sprite SHEETS-----------------------
        //----------------------------------------------------------
        public void newSpriteSheet(CoronaSpriteSheet sheet)
        {
            if (this.ProjectRootNodeSelected != null && this.SceneSelected != null)
            {
                if (isSheetExistsInScene(this.SceneSelected, sheet) == false)
                {
                    GameElement sceneNode = this.getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, this.SceneSelected);
                    GameElement node = new GameElement("SPRITESHEET", sheet.Name, sheet);
                    sceneNode.Nodes["SPRITESHEETS"].Nodes.Add(node);

                    if(!this.SceneSelected.SpriteSheets.Contains(sheet))
                        this.SceneSelected.SpriteSheets.Add(sheet);
                }

            }
        }
Esempio n. 7
0
        public void removeScene(GameElement elem)
        {
            //Recuperer la scene
            Scene scene = (Scene)elem.InstanceObjet;
            if (scene != null)
            {
                this.MainForm.CurrentProject.Scenes.Remove(scene);

                if (this.SelectedNodes.Contains(elem))
                    this.SelectedNodes.Remove(elem);

                isRemovingNode = true;
                elem.Remove();
                isRemovingNode = false;
            }

            this.SceneSelected = null;
            GorgonLibrary.Gorgon.Go();
        }
Esempio n. 8
0
        //DRAG AND DROP EVENT
        private void treeViewElements_ItemDrag(object sender, ItemDragEventArgs e)
        {
            try
            {

                for (int i = 0; i < this.SelectedNodes.Count; i++)
                {
                    if (this.SelectedNodes[i] is GameElement)
                    {
                        GameElement elem = (GameElement)this.SelectedNodes[i];
                        if (elem.NodeType.Equals("OBJECT") || elem.NodeType.Equals("ENTITY") || elem.NodeType.Equals("LAYER") || elem.NodeType.Equals("STAGE"))
                            DoDragDrop(elem, DragDropEffects.Move);
                        else
                            this.nodeTemp = null;
                    }

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("Drag&Drop not allowed!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }
Esempio n. 9
0
        //----------------------------------------------------------
        //----------------Corona AUDIO OBJECT-----------------------
        //----------------------------------------------------------
        public void newAudioObject(AudioObject audio)
        {
            if(this.ProjectRootNodeSelected != null)
            {
                GameElement node = new GameElement("AUDIO", audio.name, audio);
                node.Checked = false;

                this.ProjectRootNodeSelected.Nodes["AUDIOS"].Nodes.Add(node);
                this.HideCheckBox(this.treeViewElements, node);

            }
        }
Esempio n. 10
0
 public CoronaObject getObjectFromNode(GameElement node)
 {
     return (CoronaObject)node.InstanceObjet;
 }
Esempio n. 11
0
 public Scene getSceneFromNode(GameElement node)
 {
     if (node.InstanceObjet != null)
         return (Scene)node.InstanceObjet;
     else return null;
 }
Esempio n. 12
0
 public CoronaLayer getLayerFromNode(GameElement node)
 {
     return (CoronaLayer)node.InstanceObjet;
 }
Esempio n. 13
0
 public TilesMap getGrilleMapFromNode(GameElement node)
 {
     return (TilesMap)node.InstanceObjet;
 }
Esempio n. 14
0
 public void clearTreeView()
 {
     this.LayerSelected = null;
     this.SceneSelected = null;
     CoronaObjectSelected = null;
     this.JointureSelected = null;
     this.nodeTemp = null;
     this.treeViewElements.Nodes.Clear();
 }
Esempio n. 15
0
        //----------------------------------------------------------
        //----------------Corona Snippet - ----------------------
        //----------------------------------------------------------
        public void newSnippet(Snippet snippet)
        {
            if (this.ProjectRootNodeSelected != null)
            {
                GameElement node = new GameElement("SNIPPET", snippet.Name, snippet);
                node.Checked = false;

                this.ProjectRootNodeSelected.Nodes["SNIPPETS"].Nodes.Add(node);
                this.HideCheckBox(this.treeViewElements, node);

            }
        }
Esempio n. 16
0
        //----------------------------------------------------------
        //----------------Corona COntrol-----------------------
        //----------------------------------------------------------
        public void newCoronaControl(CoronaControl control)
        {
            if (this.LayerSelected != null)
            {
                 GameElement node = new GameElement("CONTROL", control.ControlName, control);
                 node.Checked = control.isEnabled;
                GameElement layerNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, LayerSelected);
                if (layerNode != null)
                {
                    layerNode.Nodes.Add(node);

                }

            }
        }
Esempio n. 17
0
        //----------------------------------------------------------
        //---------------Sprite Sets-----------------------
        //----------------------------------------------------------
        public void newSpriteSet(CoronaSpriteSet set)
        {
            if (this.ProjectRootNodeSelected != null && this.SceneSelected != null)
            {
                if (isSpriteSetExistsInScene(this.SceneSelected, set) == false)
                {
                    GameElement sceneNode = this.getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, this.SceneSelected);
                    GameElement node = new GameElement("SPRITESET", set.Name, set);
                    sceneNode.Nodes["SPRITESETS"].Nodes.Add(node);

                /*    if (!this.SceneSelected.SpriteSets.Contains(set))
                        this.SceneSelected.SpriteSets.Add(set);*/

                    //Ajouter toutes les sheets necessaires à la sprite set
                    for (int i = 0; i < set.Frames.Count; i++)
                    {
                        if (isSheetExistsInScene(this.SceneSelected, set.Frames[i].SpriteSheetParent) == false)
                        {
                            newSpriteSheet(set.Frames[i].SpriteSheetParent);
                        }
                    }
                }

            }
        }
Esempio n. 18
0
        //----------------------------------------------------------
        //----------------Corona Object-----------------------
        //----------------------------------------------------------
        public void newCoronaObject(CoronaObject obj)
        {
            if (this.LayerSelected != null ||
                (this.CoronaObjectSelected !=null && (this.CoronaObjectSelected.isEntity == true || this.CoronaObjectSelected.EntityParent != null)))
            {

                GameElement node = null;
                if(obj.isEntity == false)
                    node = new GameElement("OBJECT", obj.DisplayObject.Name, obj);
                else
                    node = new GameElement("ENTITY", obj.Entity.Name, obj);

                node.Checked = obj.isEnabled;

                if (this.CoronaObjectSelected != null && obj.isEntity == false)
                {
                    if(this.CoronaObjectSelected.EntityParent != null)
                    {
                         GameElement entityNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, this.CoronaObjectSelected.EntityParent.objectParent);
                        if (entityNode != null)
                        {
                            entityNode.Nodes.Add(node);

                        }

                        this.CoronaObjectSelected = obj;
                    }
                    else if (this.CoronaObjectSelected.isEntity == true)
                    {
                        GameElement entityNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, this.CoronaObjectSelected);
                        if (entityNode != null)
                        {
                            entityNode.Nodes.Add(node);

                        }

                        this.CoronaObjectSelected = obj;
                    }
                    else
                    {
                        GameElement layerNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, LayerSelected);
                        if (layerNode != null)
                        {
                            layerNode.Nodes.Add(node);

                        }

                        this.CoronaObjectSelected = obj;
                    }

                }

                else
                {
                    GameElement layerNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, LayerSelected);
                    if (layerNode != null)
                    {
                        layerNode.Nodes.Add(node);

                    }

                    this.CoronaObjectSelected = obj;

                    if (obj.isEntity == true)
                    {
                        //Ajouter les jointures
                        TreeNode nodeJoints = new TreeNode("Joints");

                        nodeJoints.Name = "JOINTS";
                        nodeJoints.ImageIndex = 8;
                        nodeJoints.SelectedImageIndex = 8;
                        node.Nodes.Add(nodeJoints);
                        this.HideCheckBox(this.treeViewElements, nodeJoints);
                        for (int i = 0; i < obj.Entity.CoronaObjects.Count; i++)
                        {
                            this.newCoronaObject(obj.Entity.CoronaObjects[i]);
                        }

                        for (int i = 0; i < obj.Entity.Jointures.Count; i++)
                        {
                            this.newJoint(obj.Entity.Jointures[i], false, null);
                        }
                    }
                }

            }
        }
Esempio n. 19
0
        //----------------------------------------------------------
        //----------------Grille Map-----------------------
        //----------------------------------------------------------
        public void newTilesMap(TilesMap map)
        {
            if (this.LayerSelected != null)
            {
                GameElement node = new GameElement("TILESMAP", map.TilesMapName, map);

                node.Checked = map.isEnabled;
                GameElement layerNode = getNodeFromObjectInstance(this.treeViewElements.Nodes, LayerSelected);
                if (layerNode != null)
                {
                    Console.WriteLine("Map ADDED");
                    layerNode.Nodes.Add(node);
                }

            }
        }
Esempio n. 20
0
        public void removeLayer(GameElement layerNode)
        {
            if (this.SceneSelected != null)
            {
                CoronaLayer layer = this.getLayerFromNode(layerNode);
                if (layer != null)
                {

                    //this.MainForm.UndoRedo.DO(this.SceneSelected);

                    this.SceneSelected.Layers.Remove(layer);

                    this.MainForm.sceneEditorView1.GraphicsContentManager.CleanLayerGraphics(layer, true, true);

                    //Remove all
                    isRemovingNode = true;
                    layerNode.Remove();
                    isRemovingNode = false;
                }
                this.LayerSelected = null;

                this.MainForm.propertyGrid1.SelectedObject = null;

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

            }
        }