Esempio n. 1
0
        public FontPropertyEditor(FontItem  font,
            IWindowsFormsEditorService editorServiceParam )
        {
            editorService = editorServiceParam;
            InitializeComponent();

            this.View = System.Windows.Forms.View.Tile;

            //Default Font
            ListViewItem itemDefault = new ListViewItem();
            itemDefault.Tag = new FontItem("DEFAULT",font.projectParent);
            itemDefault.Text = "Default Font";
            this.Items.Add(itemDefault);

            // Add three font files to the private collection.
            for (int i = 0; i < font.projectParent.AvailableFont.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                item.Tag = font.projectParent.AvailableFont[i];
                item.Font = new Font(font.projectParent.AvailableFont[i].NameForIphone, 14);
                item.Text = font.projectParent.AvailableFont[i].NameForIphone;
                this.Items.Add(item);

            }

            //this.Invalidate();
        }
Esempio n. 2
0
        ///////////////////////////////////
        //Custom Constructor
        ///////////////////////////////////
        public FontManagerPanel(FontItem customFont, AssetManagerForm mainForm)
        {
            InitializeComponent();
            this.MainForm = mainForm;

            this.customFont = customFont;

            refreshPanel();
        }
Esempio n. 3
0
 public FontItem cloneInstance()
 {
     FontItem item = new FontItem();
     item.OriginalPath = this.OriginalPath;
     item.FileName = this.FileName;
     item.NameForAndroid = this.NameForAndroid;
     item.NameForIphone = this.NameForIphone;
     item.FontFamilyName = this.FontFamilyName;
     return item;
 }
Esempio n. 4
0
        public FontItem cloneInstance()
        {
            FontItem item = new FontItem();

            item.OriginalPath   = this.OriginalPath;
            item.FileName       = this.FileName;
            item.NameForAndroid = this.NameForAndroid;
            item.NameForIphone  = this.NameForIphone;
            item.FontFamilyName = this.FontFamilyName;
            return(item);
        }
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
        private void treeViewElements_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (hasChecked == false)
            {
                try
                {
                    bool isCustomBuild = this.MainForm.IsCustomBuild;
                    float XRatio = 1;
                    float YRatio = 1;
                    if (isCustomBuild == true)
                    {
                        XRatio = (float)this.MainForm.currentTargetResolution.Resolution.Width / (float)this.MainForm.CurrentProject.width;
                        YRatio = (float)this.MainForm.currentTargetResolution.Resolution.Height / (float)this.MainForm.CurrentProject.height;
                    }

                    //Recuperer la node Project root
                    ProjectRootNodeSelected = getRootNode(e.Node);
                    ProjectSelected = (CoronaGameProject)ProjectRootNodeSelected.Tag;

                    //Si il y a deja un panel Physic d'ouvert : Le fermer

                    if (this.MainForm.CurrentObjectPhysicEditorPanel != null)
                        if (this.MainForm.getMapEditorPage().Controls.Contains(this.MainForm.CurrentObjectPhysicEditorPanel))
                        {
                            this.MainForm.getMapEditorPage().Controls.Remove(this.MainForm.CurrentObjectPhysicEditorPanel);
                        }

                    //SI la node selectionnée est un game element

                    if (e.Node == this.ProjectRootNodeSelected)
                    {
                        ProjectPropertyConverter converter = new ProjectPropertyConverter(this.ProjectSelected, this.MainForm);

                        this.MainForm.propertyGrid1.SelectedObject = converter;
                    }
                    if (e.Node.Name.Equals("GAME_ELEMENT"))
                    {
                        //Faire le traitement de selection
                        GameElement nodeSelected = (GameElement)e.Node;

                        if (nodeSelected.NodeType.Equals("STAGE"))
                        {

                            this.SceneSelected = ((Scene)nodeSelected.InstanceObjet);
                            this.MainForm.sceneEditorView1.objectsSelected.Clear();
                            this.MainForm.sceneEditorView1.setModeSceneEditor(this.SceneSelected);

                            //Deselect others
                            if (this.LayerSelected != null)
                            {
                                this.LayerSelected.deselectAllObjects();
                                this.LayerSelected.deselectAllControls();
                            }

                            this.LayerSelected = null;
                            this.CoronaObjectSelected = null;

                            //Afficher les proprietes du layer dans le property grid
                            ScenePropertyConverter sceneConverter = new ScenePropertyConverter(this.SceneSelected, this.MainForm);
                            this.MainForm.propertyGrid1.SelectedObject = sceneConverter;

                            //Mettre a jour le fichier lua
                            this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio);
                        }
                        else if (nodeSelected.NodeType.Equals("LAYER"))
                        {

                            //Deselect others
                            if (this.LayerSelected != null)
                            {
                                this.LayerSelected.deselectAllObjects();
                                this.LayerSelected.deselectAllControls();
                            }

                            this.LayerSelected = ((CoronaLayer)nodeSelected.InstanceObjet);
                            this.LayerSelected.deselectAllObjects();
                            this.LayerSelected.deselectAllControls();
                            this.MainForm.sceneEditorView1.objectsSelected.Clear();

                            this.SceneSelected = this.LayerSelected.SceneParent;
                            this.CoronaObjectSelected = null;

                            this.MainForm.sceneEditorView1.setModeLayerEditor(this.LayerSelected);

                            //Afficher les proprietes du layer dans le property grid
                            LayerPropertyConverter layerConverter = new LayerPropertyConverter(this.LayerSelected, this.MainForm);
                            this.MainForm.propertyGrid1.SelectedObject = layerConverter;

                            //Mettre a jour le fichier lua
                            //this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio);
                        }
                        else if (nodeSelected.NodeType.Equals("OBJECT") || nodeSelected.NodeType.Equals("ENTITY"))
                        {

                            CoronaObject obj = ((CoronaObject)nodeSelected.InstanceObjet);

                            //Selectionner le layer parent
                            this.LayerSelected = obj.LayerParent;

                            if (nodeSelected.NodeType.Equals("ENTITY"))
                            {
                                this.MainForm.SetModeEntity();
                                //this.LayerSelected.deselectAllObjects();
                            }
                            else
                                this.MainForm.SetModeObject();

                            //Fermer le layer et la scene
                            this.SceneSelected = this.LayerSelected.SceneParent;

                            this.CoronaObjectSelected = obj;

                            //Mettre a jour le fichier lua
                            //this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio);

                            /*if (this.MainForm.isFormLocked == false)
                                this.MainForm.sceneEditorView1.surfacePictBx.Refresh();*/
                        }
                        else if (nodeSelected.NodeType.Equals("TILESMAP"))
                        {
                            this.MainForm.SetModeObject();
                            TilesMap map = ((TilesMap)nodeSelected.InstanceObjet);

                            //Selectionner le layer parent
                            this.CoronaObjectSelected = null;

                            this.LayerSelected = (CoronaLayer)((GameElement)nodeSelected.Parent).InstanceObjet;
                            this.SceneSelected = this.LayerSelected.SceneParent;

                            //Deselect all objects
                            this.LayerSelected.deselectAllObjects();

                            //Afficher les proprietes de l'objet dans le property grid
                            TilesMapPropertyConverter mapConverter = new TilesMapPropertyConverter(map, this.MainForm);
                            this.MainForm.propertyGrid1.SelectedObject = mapConverter;

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

                        }
                        else if (nodeSelected.NodeType.Equals("CONTROL"))
                        {
                            this.MainForm.SetModeControl();
                            CoronaControl control = ((CoronaControl)nodeSelected.InstanceObjet);
                            this.ControlSelected = control;
                            if (control.type == CoronaControl.ControlType.joystick)
                            {

                                JoystickControl joy = (JoystickControl)control;
                                JoystickPropertyConverter joyConverter = new JoystickPropertyConverter(joy, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = joyConverter;

                            }
                        }
                        else if (nodeSelected.NodeType.Equals("WIDGET"))
                        {
                            CoronaWidget widget = ((CoronaWidget)nodeSelected.InstanceObjet);
                            this.WidgetSelected = widget;
                            widget.Type = CoronaWidget.WidgetType.tabBar;
                            if (widget.Type == CoronaWidget.WidgetType.tabBar)
                            {

                                TabBarPropertyConverter converter = new TabBarPropertyConverter(widget, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;

                            }
                            else if (widget.Type == CoronaWidget.WidgetType.pickerWheel)
                            {

                                WidgetPickerWheel pickerW = (WidgetPickerWheel)widget;
                                this.MainForm.propertyGrid1.SelectedObject = pickerW;

                            }
                        }
                        else if (nodeSelected.NodeType.Equals("JOINT"))
                        {

                            CoronaJointure joint = nodeSelected.InstanceObjet as CoronaJointure;

                            this.MainForm.setModeJoint();

                            //Selectionner le layer parent
                            this.CoronaObjectSelected = null;
                            this.JointureSelected = joint;
                            this.LayerSelected = joint.layerParent;
                            this.LayerSelected.JointureSelected = joint;
                            this.SelectedNodes.Add(nodeSelected);

                            this.MainForm.sceneEditorView1.setModeLayerEditor(joint.layerParent);
                            //Ouvrir le property converter correspondant au joint
                            if (this.JointureSelected.type.Equals("DISTANCE"))
                            {
                                DistancePropertyConverter converter = new DistancePropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }
                            else if (this.JointureSelected.type.Equals("FRICTION"))
                            {
                                FrictionPropertyConverter converter = new FrictionPropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }
                            else if (this.JointureSelected.type.Equals("PISTON"))
                            {
                                PistonPropertyConverter converter = new PistonPropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }
                            else if (this.JointureSelected.type.Equals("PIVOT"))
                            {
                                PivotPropertyConverter converter = new PivotPropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }
                            else if (this.JointureSelected.type.Equals("WELD"))
                            {
                                WeldPropertyConverter converter = new WeldPropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }
                            else if (this.JointureSelected.type.Equals("WHEEL"))
                            {
                                WheelPropertyConverter converter = new WheelPropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }
                            else if (this.JointureSelected.type.Equals("PULLEY"))
                            {
                                PulleyPropertyConverter converter = new PulleyPropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }
                            else if (this.JointureSelected.type.Equals("TOUCH"))
                            {
                                TouchPropertyConverter converter = new TouchPropertyConverter(this.JointureSelected, this.MainForm);
                                this.MainForm.propertyGrid1.SelectedObject = converter;
                            }

                            //Mettre a jour le fichier lua
                            this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio);

                        }
                        else if (nodeSelected.NodeType.Equals("AUDIO"))
                        {

                            this.AudioObjectSelected = (AudioObject)nodeSelected.InstanceObjet;
                        }
                        else if (nodeSelected.NodeType.Equals("SNIPPET"))
                        {
                            this.SnippetSelected = (Snippet)nodeSelected.InstanceObjet;
                            this.MainForm.cgEeditor1.RefreshSnippetLuaCode(this.ProjectSelected);
                        }
                        else if (nodeSelected.NodeType.Equals("FONT"))
                        {
                            this.FontSelected = (FontItem)nodeSelected.InstanceObjet;
                        }

                        //------------Verifier si le clic est un clic droit
                        if (e.Button == System.Windows.Forms.MouseButtons.Right)
                        {

                            if (nodeSelected.NodeType.Equals("STAGE"))
                            {
                                this.treeViewElements.ContextMenuStrip = this.menuScene;
                                this.treeViewElements.ContextMenuStrip.Show();
                                this.LayerSelected = null;
                            }
                            else if (nodeSelected.NodeType.Equals("LAYER"))
                            {

                                this.treeViewElements.ContextMenuStrip = this.menuLayer;
                                this.treeViewElements.ContextMenuStrip.Show();

                            }
                            else if (nodeSelected.NodeType.Equals("OBJECT") || nodeSelected.NodeType.Equals("ENTITY"))
                            {

                                CoronaObject obj = ((CoronaObject)nodeSelected.InstanceObjet);

                                activerBoutonsNecessairesMenuObject(obj);

                                this.treeViewElements.ContextMenuStrip = this.menuObject;
                                this.treeViewElements.ContextMenuStrip.Show();

                            }
                            else if (nodeSelected.NodeType.Equals("CONTROL"))
                            {
                                this.treeViewElements.ContextMenuStrip = this.menuControl;
                                this.treeViewElements.ContextMenuStrip.Show();
                            }
                            else if (nodeSelected.NodeType.Equals("WIDGET"))
                            {
                                CoronaWidget widget = (CoronaWidget)nodeSelected.InstanceObjet;
                                if (widget.Type == CoronaWidget.WidgetType.tabBar)
                                {
                                    this.treeViewElements.ContextMenuStrip = this.menuWidgetTabBar;
                                    this.treeViewElements.ContextMenuStrip.Show();
                                }
                                else if (widget.Type == CoronaWidget.WidgetType.pickerWheel)
                                {
                                    this.treeViewElements.ContextMenuStrip = this.menuWidgetPickerWheel;
                                    this.treeViewElements.ContextMenuStrip.Show();
                                }

                            }
                            else if (nodeSelected.NodeType.Equals("SPRITESHEET") || nodeSelected.NodeType.Equals("SPRITESET"))
                            {
                                this.treeViewElements.ContextMenuStrip = this.menuSpriteSetSheet;
                                this.treeViewElements.ContextMenuStrip.Show();
                            }
                            else if (nodeSelected.NodeType.Equals("JOINT"))
                            {

                                this.treeViewElements.ContextMenuStrip = this.menuJointures;
                                this.treeViewElements.ContextMenuStrip.Show();
                            }
                            else if (nodeSelected.NodeType.Equals("AUDIO"))
                            {
                                this.treeViewElements.ContextMenuStrip = this.menuAudio;
                                this.treeViewElements.ContextMenuStrip.Show();
                            }
                            else if (nodeSelected.NodeType.Equals("TILESMAP"))
                            {
                                this.treeViewElements.ContextMenuStrip = this.menuTilesmap;
                                this.treeViewElements.ContextMenuStrip.Show();
                            }
                            else if (nodeSelected.NodeType.Equals("SNIPPET"))
                            {
                                this.treeViewElements.ContextMenuStrip = this.menuSnippets;
                                this.treeViewElements.ContextMenuStrip.Show();
                            }
                            else if (nodeSelected.NodeType.Equals("FONT"))
                            {
                                this.treeViewElements.ContextMenuStrip = this.fontMenu;
                                this.treeViewElements.ContextMenuStrip.Show();
                            }
                            else
                                this.treeViewElements.ContextMenuStrip = null;
                        }

                        else
                            this.treeViewElements.ContextMenuStrip = null;
                    }
                    else if (e.Node.Name.Equals("PROJECT"))
                    {
                        //Verifier si le clic est un clic droit
                        if (e.Button == System.Windows.Forms.MouseButtons.Right)
                        {
                            this.treeViewElements.ContextMenuStrip = this.menuProject;
                            this.treeViewElements.ContextMenuStrip.Show();
                        }
                    }
                    else
                        this.treeViewElements.ContextMenuStrip = null;

                }
                catch (Exception ex)
                {
                    Application.Exit();
                }
            }
        }
Esempio n. 7
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;
            }
        }
Esempio n. 8
0
        public void openFontManagerPanelFromObject(FontItem obj)
        {
            hideAllObjectsPanel();

            //Si le tab est deja ouvert
            FontManagerPanel panel = null;
            UserControl page = getObjectPanelFromObject(obj);
            if (page != null)
            {
                page.Visible = true;
                panel = (FontManagerPanel)page;
            }
            //Sinn
            else
            {
                //Create a tabPageImage panel
                panel = new FontManagerPanel(obj, this);
                panel.Dock = DockStyle.Fill;
                panel.Tag = obj;
                addNewControlToObjectsPanel(panel);
                panel.Visible = true;
            }
        }
Esempio n. 9
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);
                    }

                }

            }
        }
Esempio n. 10
0
        public void removeFontObject(FontItem obj)
        {
            if (this.CurrentAssetProject != null)
            {
                if (this.CurrentAssetProject.Fonts.Contains(obj))
                    this.CurrentAssetProject.Fonts.Remove(obj);

                obj = null;

            }
        }