Exemple #1
0
        /////////////////////////////////////////
        // Create Lua Langue
        // Generate language.settings and all <LangueName>.langue
        /////////////////////////////////////////
        public void CreateLuaLangue(CoronaGameProject project)
        {
            if (project.Langues == null)
            {
                return;
            }
            if (project.DefaultLanguage == null)
            {
                return;
            }

            string path = this.project.BuildFolderPath + "\\lang.set";

            StringBuilder sb = new StringBuilder();

            String contentToWrite = "{\n";

            if (!project.DefaultLanguage.Equals(""))
            {
                contentToWrite += "\"default\":\"" + project.DefaultLanguage.ToLower() + "\",\n\n";
            }


            if (project.Langues.Count > 0)
            {
                contentToWrite += "\"languages\":\n[\n";
                for (int i = 0; i < project.Langues.Count; i++)
                {
                    if (i == project.Langues.Count)
                    {
                        contentToWrite += "\"" + project.Langues[i].Langue.ToLower() + "\"\n";
                    }
                    else
                    {
                        contentToWrite += "\"" + project.Langues[i].Langue.ToLower() + "\"\n";
                    }

                    if (i < project.Langues.Count - 1)
                    {
                        contentToWrite += ",";
                    }
                    CreateLuaLangueFile(project.Langues[i]);
                }
                contentToWrite += "]";
            }


            contentToWrite += "}\n";

            //Save to File
            sb.Append(contentToWrite);

            FileStream fs = File.Create(path);

            fs.Close();

            File.AppendAllText(path, sb.ToString());
            sb.Clear();
            sb = null;
        }
Exemple #2
0
        //---------------------------------------------------
        //-------------------Attributes-----------------------
        //---------------------------------------------------
        //-------------------Constructeurs-------------------
        //---------------------------------------------------
        public TilesMapEditorMobile(CoronaGameProject projectParent)
            : base(new Size(320,480),projectParent.Orientation,projectParent)
        {
            this.projectParent = projectParent;

             this.Name = "mapmobileeditor";
        }
Exemple #3
0
        public void Init(Form1 mainForm, CoronaGameProject project)
        {
            this.mainForm = mainForm;

            this.project = project;

            this.reloadComboBox();
            this.reloadListTranslation();
        }
Exemple #4
0
        //---------------------------------------------------
        //-------------------Constructeurs-------------------
        //---------------------------------------------------
        public Scene(Size sceneSize, CoronaGameProject.OrientationScreen or, CoronaGameProject projectParent)
        {
            this.projectParent = projectParent;
            this.Layers = new List<CoronaLayer>();
            this.SpriteSets = new List<CoronaSpriteSet>();
            this.SpriteSheets = new List<CoronaSpriteSheet>();

            this.functions = new List<CoronaFunction>();
            this.vars = new List<CoronaVariable>();

            this.InitialSize = sceneSize;
            this.Size = sceneSize;

            Rectangle cameraFollowLimitRectangle = new Rectangle(0, 0, this.projectParent.width, this.projectParent.height);
            Rectangle surfaceFocusCamera = new Rectangle(new Point(this.Size.Width / 2, this.Size.Height / 2),Size.Empty);
            this.Camera = new Camera(this, surfaceFocusCamera, cameraFollowLimitRectangle);
            this.setOrientation(or);

            this.Ad = new CoronaAds();
            this.initCollisionGroupFilter();
        }
Exemple #5
0
 public void Init(CoronaGameProject cProject, Form1 mainForm)
 {
     this.project = cProject;
     this.mainForm = mainForm;
 }
Exemple #6
0
        private List <string> getAllFontsUsed(CoronaGameProject project)
        {
            if (project != null)
            {
                List <string> list = new List <string>();
                for (int i = 0; i < project.Scenes.Count; i++)
                {
                    Scene scene = this.project.Scenes[i];
                    for (int j = 0; j < scene.Layers.Count; j++)
                    {
                        CoronaLayer layer = scene.Layers[j];
                        for (int k = 0; k < layer.CoronaObjects.Count; k++)
                        {
                            CoronaObject obj = layer.CoronaObjects[k];
                            if (obj.isEntity == false)
                            {
                                if (obj.DisplayObject.Figure != null)
                                {
                                    Figure fig = obj.DisplayObject.Figure;
                                    if (fig.ShapeType.Equals("TEXT"))
                                    {
                                        Texte  txt      = fig as Texte;
                                        string fontName = txt.font2.getFontNameForAndroid();
                                        if (!list.Contains(fontName))
                                        {
                                            list.Add(fontName);

                                            string fontsfolder = System.Environment.GetFolderPath(
                                                System.Environment.SpecialFolder.Fonts);

                                            FontNameGetter fontNameGetter = new FontNameGetter();
                                            string         res            = fontNameGetter.GetFontFileName(new DirectoryInfo(fontsfolder), txt.font2);
                                            if (File.Exists(res))
                                            {
                                                string fileDest = project.BuildFolderPath + "\\" + fontName + ".ttf";
                                                File.Copy(res, fileDest, true);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                for (int l = 0; l < obj.Entity.CoronaObjects.Count; l++)
                                {
                                    CoronaObject child = obj.Entity.CoronaObjects[l];

                                    if (child.DisplayObject.Figure != null)
                                    {
                                        Figure fig = child.DisplayObject.Figure;
                                        if (fig.ShapeType.Equals("TEXT"))
                                        {
                                            Texte  txt      = fig as Texte;
                                            string fontName = txt.font2.getFontNameForAndroid();
                                            if (!list.Contains(fontName))
                                            {
                                                list.Add(fontName);

                                                string fontsfolder = System.Environment.GetFolderPath(
                                                    System.Environment.SpecialFolder.Fonts);

                                                FontNameGetter fontNameGetter = new FontNameGetter();
                                                string         res            = fontNameGetter.GetFontFileName(new DirectoryInfo(fontsfolder), txt.font2);
                                                if (File.Exists(res))
                                                {
                                                    string fileDest = project.BuildFolderPath + "\\" + fontName + ".ttf";
                                                    File.Copy(res, fileDest, true);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                return(list);
            }
            return(null);
        }
Exemple #7
0
 public FontItem(string fontName, CoronaGameProject projectParent)
 {
     this.NameForAndroid = fontName;
     this.NameForIphone = fontName;
     this.projectParent = projectParent;
 }
Exemple #8
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();
                }
            }
        }
Exemple #9
0
 public void Init(CoronaGameProject _project, Boolean _isDebugMode)
 {
     this.cProject = _project;
     this.isDebugMode = _isDebugMode;
     this.isRunning = false;
     this.isInit = true;
 }
Exemple #10
0
        //---------------------------------------------------
        //-------------------Methodes------------------------
        //---------------------------------------------------
        public Boolean Init(String _ProjectName, String _ProjectPath,
 CoronaGameProject.OrientationScreen _orientation,
        int _width, int _height, String _scale, String _xAlign, String _yAlign, System.Windows.Forms.ListBox.ObjectCollection _imageSuffix, int _fps, Boolean _antialias,
        String _AndroidVersionCode, System.Windows.Forms.ListBox.ObjectCollection _SupportedOrientation, System.Windows.Forms.ListBox.ObjectCollection _AndroidPermissions, String _CustomBuildName, Image _icon)
        {
            if (_ProjectName == "" || _ProjectPath == "") return false;

            if (this.ProjectPath != null && this.ProjectName != null)
            {
                if (!(this.ProjectPath + "\\" + this.ProjectName + ".krp").Equals(this.ProjectPath + "\\" + _ProjectName.Replace(" ", "_") + ".krp"))
                {
                    if (File.Exists(this.ProjectPath + "\\" + this.ProjectName + ".krp"))
                        File.Move(this.ProjectPath + "\\" + this.ProjectName + ".krp", this.ProjectPath + "\\" + _ProjectName.Replace(" ", "_") + ".krp");

                    //Renommer le projet de ressource correspondant
                    string assetProjectsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Native-Software\\Asset Manager";
                    if (!Directory.Exists(assetProjectsDirectory))
                        Directory.CreateDirectory(assetProjectsDirectory);

                    if (File.Exists(assetProjectsDirectory + "\\" + this.ProjectName + "\\" + this.ProjectName + ".kres"))
                        File.Move(assetProjectsDirectory + "\\" + this.ProjectName + "\\" + this.ProjectName + ".kres",
                            assetProjectsDirectory+"\\" + this.ProjectName + "\\" + _ProjectName.Replace(" ", "_") + ".kres");

                    if (Directory.Exists(assetProjectsDirectory+"\\" + this.ProjectName))
                        Directory.Move(assetProjectsDirectory +"\\" + this.ProjectName, assetProjectsDirectory+"\\" + _ProjectName.Replace(" ", "_"));
                }

            }

            this.ProjectName = _ProjectName.Replace(" ","_");

            if (this.BuildFolderPath != null)
            {
                if(!this.BuildFolderPath.Equals( this.ProjectPath + "\\" + this.ProjectName))
                    if (Directory.Exists(this.BuildFolderPath))
                        Directory.Move(this.BuildFolderPath, this.ProjectPath + "\\" + this.ProjectName);
            }

            if (this.ProjectPath != null)
            {
                if (!this.ProjectPath.Equals(_ProjectPath))
                    if (Directory.Exists(this.ProjectPath))
                        Directory.Move(this.ProjectPath, _ProjectPath);
            }

            this.ProjectPath = _ProjectPath;
            this.BuildFolderPath = this.ProjectPath + "\\" + this.ProjectName;
            this.SourceFolderPath = this.ProjectPath + "\\Sources";
            this.CgeProjectFilename = this.ProjectPath + "\\" + this.ProjectName + ".krp";
            this.Orientation = _orientation;

            this.Icone = _icon;
            if (this.Icone == null) this.Icone = Properties.Resources.Icon;

            this.width = _width;
            this.height = _height;
            this.scale = _scale;

            if (_xAlign.Equals("center"))
                this.ScreenXAlign = XScreenAlignment.center;
            else if (_xAlign.Equals("left"))
                this.ScreenXAlign = XScreenAlignment.left;
            else if (_xAlign.Equals("right"))
                this.ScreenXAlign = XScreenAlignment.right;

            if (_yAlign.Equals("center"))
                this.ScreenYAlign = YScreenAlignment.center;
            else if (_yAlign.Equals("top"))
                this.ScreenYAlign = YScreenAlignment.top;
            else if (_yAlign.Equals("bottom"))
                this.ScreenYAlign = YScreenAlignment.bottom;

            if (_imageSuffix != null)
            {
                this.ImageSuffix.Clear();
                for (int i = 0; i < _imageSuffix.Count; i++)
                {
                    this.ImageSuffix.Add(_imageSuffix[i].ToString());
                }
            }

            this.fps = _fps;
            this.antialias = _antialias;
            this.AndroidVersionCode = _AndroidVersionCode;

            if (_SupportedOrientation != null)
            {
                this.SupportedOrientation.Clear();
                for (int i = 0; i < _SupportedOrientation.Count; i++)
                {
                    this.SupportedOrientation.Add(_SupportedOrientation[i].ToString());
                }
            }

            if (_AndroidPermissions != null)
            {
                this.AndroidPermissions.Clear();
                for (int i = 0; i < _AndroidPermissions.Count; i++)
                {
                    this.AndroidPermissions.Add(_AndroidPermissions[i].ToString());
                }
            }

            this.CustomBuildName = _CustomBuildName;

            return true;
        }
Exemple #11
0
        public void loadProject(string filename, BackgroundWorker worker)
        {
            worker.ReportProgress(10);

            //DialogResult rs = MessageBox.Show("Do you want to create a project back up before continuing ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            //if (rs == System.Windows.Forms.DialogResult.Yes)
            //{
            //    //Make a backUp
            //    File.Copy(filename, filename.Replace(".krp", "_backup.krp"),true);
            //}

            //do back up up
            if(File.Exists(filename))
                File.Copy(filename, filename.Replace(".krp", "_backup.krp"),true);

            FileStream fs = File.OpenRead(filename);
            if (fs.Length > 0)
            {
                MemoryStream ms = new MemoryStream();
                ms.SetLength(fs.Length);

                fs.Read(ms.GetBuffer(), 0, (int)ms.Length);

                this.CurrentProject = (CoronaGameProject)SerializerHelper.DeSerializeBinary(ms);
                ms.Close();
                ms.Dispose();

                this.CurrentProject.updateBuildFields();
                this.CurrentProject.updateConfigFields(1,1);

                this.CurrentProject.BuildFolderPath = filename.Substring(0, filename.LastIndexOf("\\"))+"\\"+ this.CurrentProject.ProjectName;
                this.CurrentProject.ProjectPath = filename.Substring(0, filename.LastIndexOf("\\"));
                this.CurrentProject.SourceFolderPath = filename.Substring(0, filename.LastIndexOf("\\")) + "\\Sources";
                this.CurrentProject.CgeProjectFilename = this.CurrentProject.ProjectPath + "\\" + this.CurrentProject.ProjectName + ".krp";

                this.sceneEditorView1.GraphicsContentManager.SetCurrentProject(this.CurrentProject, this.sceneEditorView1.CurrentScale, Point.Empty);

                this.debuggerPanel1.Init(this.CurrentProject, this);
                worker.ReportProgress(40);
                if (this.CurrentProject != null)
                {

                    worker.ReportProgress(70);

                    //Recharger toutes les tilesMap existantes
                    //Create all files needed for tilesmaps
                    for (int i = 0; i < this.CurrentProject.Scenes.Count; i++)
                    {
                        Scene scene = this.CurrentProject.Scenes[i];
                        scene.projectParent = this.CurrentProject;

                        for (int j = 0; j < scene.Layers.Count; j++)
                        {
                            CoronaLayer layer = scene.Layers[j];

                            if (layer.TilesMap != null)
                            {
                                layer.TilesMap.reloadMapContent(CurrentProject.SourceFolderPath);
                                //layer.TilesMap.reloadFromFile(this.CurrentProject.SourceFolderPath);
                            }
                        }

                    }

                    //Gerer les fonts

                    if (this.CurrentProject.AvailableFont == null)
                        this.CurrentProject.AvailableFont = new List<FontItem>();

                }
            }
            fs.Close();
            fs.Dispose();
            fs = null;
            //this.UndoRedo.clearBuffers();
        }
Exemple #12
0
        ///---------------------------------------------------------------------------------------------------------
        ///---------------------------------------------------------------------------------------------------------
        ///---------------------GEsTION DE  CREATION DE JOINTURES -------------------------------
        ///---------------------------------------------------------------------------------------------------------
        ///---------------------------------------------------------------------------------------------------------
        ///---------------------------------------------------------------------------------------------------------
        // ------------  SERIALISATION DU PROJET EN COURs-------------
        //---------------------------------------------------
        //-------------------Methodes-------------------
        ///---------------------------------------------------------------------------------------------------------
        public void clearCurrentProject()
        {
            this.gameElementTreeView1.clearTreeView();

            this.cgEeditor1.closeAll(false);

            if(this.CurrentProject != null)
            {
                this.sceneEditorView1.GraphicsContentManager.CleanProjectGraphics(false, false);
                this.CurrentProject.clearProject();
            }

            this.CurrentProject = null;
            this.sceneEditorView1.CurentCalque = "NONE";

            this.CoronaObjectSelected = null;
            this.propertyGrid1.SelectedObject = null;

            if (this.isFormLocked == false)
            {
                this.scenePreview1.Refresh();
                GorgonLibrary.Gorgon.Go();
            }
        }
Exemple #13
0
 public void Init(CoronaGameProject cProject, Form1 mainForm)
 {
     this.project = cProject;
     this.mainForm = mainForm;
     listCommands = new List<string>();
     LastCommandReceive = "";
     CurrentCommandSend = "";
 }
Exemple #14
0
 //---------------------------------------------------
 //-------------------Constructeur------------------------
 //---------------------------------------------------
 public CoronaGameBuilder(CoronaGameProject project)
 {
     this.project = project;
 }
Exemple #15
0
        public ImageResizer(CoronaGameProject CurrentProject)
        {
            if (CurrentProject == null) return;

            Project = CurrentProject;
        }
Exemple #16
0
        public void RefreshSnippetLuaCode(CoronaGameProject project)
        {
            try
            {

                if (!File.Exists(project.SourceFolderPath + "\\snippets.lua"))
                {
                    FileStream fs = File.Create(project.SourceFolderPath + "\\snippets.lua");
                    fs.Close();

                }

                OpenFileInEditor(project.SourceFolderPath + "\\snippets.lua");

                this.saveCurrentSnippetsFile();

                StringBuilder sb = new StringBuilder();
                sb.AppendLine("local snippets = {}\n");
                for (int i = 0; i < project.Snippets.Count; i++)
                {
                    Corona_Classes.Snippet snippet = project.Snippets[i];
                    sb.AppendLine("--##### Snippet Begin #####");
                    sb.AppendLine("--## Name: " + snippet.Name);
                    sb.AppendLine("--## Category: " + snippet.Category);
                    sb.AppendLine("--## Author: " + snippet.Author);
                    sb.AppendLine("--## Description: " + snippet.Description);
                    sb.AppendLine("--## Function Begin ##");
                    sb.AppendLine(snippet.Function);
                    sb.AppendLine("--## Function End ##");
                    sb.AppendLine("snippets." + snippet.Name + " = " + snippet.Name);
                    sb.AppendLine("--##### Snippet End #####");
                    sb.Append("\n\n");
                }

                sb.AppendLine("return snippets");
                this.ActiveDocument.Scintilla.Text = sb.ToString();
                this.ActiveDocument.Save();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        //-------------------------------------------------------------------------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------------------------------------------------------------------------
        //------------------------------------------ CONTENTMANAGER ------------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------------------------------------------------------------------------
        public void SetCurrentProject(CoronaGameProject currentProject, float worldScale,Point offSetPoint)
        {
            if (this.currentProject != null)
            {
                this.CleanProjectGraphics(false,false);

            }

            this.currentProject = currentProject;

            if (!Directory.Exists(this.currentProject.ProjectPath + "\\Resources"))
                Directory.CreateDirectory(this.currentProject.ProjectPath + "\\Resources");

            this.LoadProjectGraphics(worldScale, offSetPoint);
        }
Exemple #18
0
        public void initALLProjectEnabledState(CoronaGameProject project)
        {
            if (project.isEnabled == false)
            {
                project.isEnabled = true;
                for (int i = 0; i < project.Scenes.Count; i++)
                {
                    Scene scene = project.Scenes[i];
                    scene.isEnabled = true;

                    for (int j = 0; j < scene.Layers.Count; j++)
                    {
                        CoronaLayer layer = scene.Layers[j];
                        layer.isEnabled = true;

                        if (layer.TilesMap != null)
                        {
                            layer.TilesMap.isEnabled = true;
                        }

                        for (int k = 0; k < layer.CoronaObjects.Count; k++)
                        {
                            CoronaObject obj = layer.CoronaObjects[k];
                            obj.isEnabled = true;

                            if (obj.isEntity == true)
                            {
                                CoronaEntity entity = obj.Entity;
                                if (entity != null)
                                {
                                    entity.isEnabled = true;

                                    for (int l = 0; l < entity.CoronaObjects.Count; l++)
                                    {
                                        CoronaObject child = entity.CoronaObjects[l];
                                        child.isEnabled = true;
                                    }

                                    for (int l = 0; l < entity.Jointures.Count; l++)
                                    {
                                        CoronaJointure jointChild = entity.Jointures[l];
                                        jointChild.isEnabled = true;
                                    }
                                }
                            }
                        }

                        for (int k = 0; k < layer.Jointures.Count; k++)
                        {
                            CoronaJointure joint = layer.Jointures[k];
                            joint.isEnabled = true;
                        }

                        for (int k = 0; k < layer.Controls.Count; k++)
                        {
                            CoronaControl control = layer.Controls[k];
                            control.isEnabled = true;
                        }
                    }
                }

                for (int i = 0; i < project.AudioObjects.Count; i++)
                {
                    project.AudioObjects[i].isEnabled = true;
                }
            }
        }
 public ProjectPropertyConverter(CoronaGameProject project, Form1 mainForm)
 {
     this.project = project;
     this.mainForm = mainForm;
 }
Exemple #20
0
        //---------------------------------------------------
        //-------------------Methodes------------------------
        //---------------------------------------------------
        //----------------------------------------------------------
        //----------------Project-----------------------
        //----------------------------------------------------------
        public void loadProject(CoronaGameProject project)
        {
            if (project != null)
            {
                // FROM KREA 1.3.9 TO KREA 1.3.10
                initALLProjectEnabledState(project);

                for (int i = 0; i < project.Scenes.Count; i++)
                {
                    Scene scene = project.Scenes[i];
                    if (scene.Camera == null)
                    {
                        scene.Camera = new Corona_Classes.Camera(scene, scene.SurfaceFocus, scene.CameraFollowLimitRectangle);
                        if (scene.objectFocusedByCamera != null)
                            scene.Camera.setObjectFocusedByCamera(scene.objectFocusedByCamera);
                        scene.Camera.isSurfaceFocusVisible = scene.isSurfaceFocusVisible;

                    }

                    if (scene.CollisionFilterGroups == null)
                    {
                        scene.initCollisionGroupFilter();
                    }
                }

                this.treeViewElements.Nodes.Clear();
                this.treeViewElements.BeginUpdate();
                //Creer une node pour le project---------------------------------------------
                TreeNode nodeProject = new TreeNode(project.ProjectName);

                nodeProject.Tag = project;
                nodeProject.Name = "PROJECT";
                nodeProject.ImageIndex = 6;
                nodeProject.SelectedImageIndex = 6;
                this.treeViewElements.Nodes.Add(nodeProject);
                this.HideCheckBox(this.treeViewElements, nodeProject);
                this.ProjectRootNodeSelected = nodeProject;

                //Recreer les scenes
                for (int i = 0; i < project.Scenes.Count; i++)
                {
                    this.newScene(project.Scenes[i]);
                }

                //Creer une node pour les audios--------------------------------------------------
                TreeNode nodeAudios = new TreeNode("Audios");

                nodeAudios.Tag = project.AudioObjects;
                nodeAudios.Name = "AUDIOS";
                nodeAudios.ImageIndex = 0;
                nodeAudios.SelectedImageIndex = 0;
                nodeProject.Nodes.Add(nodeAudios);
                this.HideCheckBox(this.treeViewElements, nodeAudios);
                //Recreer les Sons
                for (int i = 0; i < project.AudioObjects.Count; i++)
                {
                    this.newAudioObject(project.AudioObjects[i]);
                }

                //Creer une node pour les Fonts--------------------------------------------------
                TreeNode nodeFonts = new TreeNode("Fonts");

                nodeFonts.Tag = project.AudioObjects;
                nodeFonts.Name = "FONTS";
                nodeFonts.ImageIndex = 13;
                nodeFonts.SelectedImageIndex = 13;
                nodeProject.Nodes.Add(nodeFonts);
                this.HideCheckBox(this.treeViewElements, nodeFonts);
                //Recreer les Sons
                for (int i = 0; i < project.AvailableFont.Count; i++)
                {
                    FontItem font =  project.AvailableFont[i];
                    string fileNameDestFont = project.SourceFolderPath +"\\"+font.NameForAndroid+".ttf";
                    if (File.Exists(fileNameDestFont))
                    {
                        bool res = font.InitFont(font.NameForAndroid, fileNameDestFont);

                    }
                    else
                    {
                        MessageBox.Show("Could not found the True Type Font file \"" + font.NameForAndroid + "\" at location \""+fileNameDestFont+"\" !\n Please copy the correct font file to your project source folder: \"" + project.SourceFolderPath +"\" then install your font before restarting Krea!",
                            "Warning", MessageBoxButtons.OK,
                            MessageBoxIcon.Warning);
                    }

                     this.newFontItem(project.AvailableFont[i]);

                }
               /* //Creer une node pour les langues-------------------------------------------------------
                TreeNode nodeLangues = new TreeNode("Languages");
                nodeLangues.Tag = project.Langues;
                nodeLangues.Name = "LANGUES";
                nodeLangues.ImageIndex = 1;
                nodeLangues.SelectedImageIndex = 1;
                nodeProject.Nodes.Add(nodeLangues);*/

                //Recreer les Sons
                /*for (int i = 0; i < project.Langues.Count; i++)
                {
                    //   this.newLangue(project.Langues[i]);
                }*/

                 //Creer une node pour les langues-------------------------------------------------------
                TreeNode nodeSnippets = new TreeNode("Snippets");
                nodeSnippets.Tag = project.Snippets;
                nodeSnippets.Name = "SNIPPETS";
                nodeSnippets.ImageIndex = 11;
                nodeSnippets.SelectedImageIndex = 11;
                nodeProject.Nodes.Add(nodeSnippets);
                this.HideCheckBox(this.treeViewElements, nodeSnippets);
                //Recreer les Sons
                for (int i = 0; i < project.Snippets.Count; i++)
                {
                    this.newSnippet(project.Snippets[i]);
                }

                //Selectionner la node project
                this.ProjectRootNodeSelected = nodeProject;
                this.ProjectSelected = project;

                //Ouvrir toutes les nodes
                this.ProjectRootNodeSelected.Expand();

                this.treeViewElements.EndUpdate();
            }
            else
            {
                MessageBox.Show("The project file seems to be corrupted ! \n Loading Failed !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #21
0
        private List<string> getAllFontsUsed(CoronaGameProject project)
        {
            if (project != null)
            {
                List<string> list = new List<string>();
                for (int i = 0; i < project.Scenes.Count; i++)
                {
                    Scene scene = this.project.Scenes[i];
                    for (int j = 0; j < scene.Layers.Count; j++)
                    {
                        CoronaLayer layer = scene.Layers[j];
                        for (int k = 0; k < layer.CoronaObjects.Count; k++)
                        {
                            CoronaObject obj = layer.CoronaObjects[k];
                            if (obj.isEntity == false)
                            {
                                if (obj.DisplayObject.Figure != null)
                                {
                                    Figure fig = obj.DisplayObject.Figure;
                                    if (fig.ShapeType.Equals("TEXT"))
                                    {
                                        Texte txt = fig as Texte;
                                        string fontName = txt.font2.getFontNameForAndroid();
                                        if (!list.Contains(fontName))
                                        {
                                            list.Add(fontName);

                                            string fontsfolder = System.Environment.GetFolderPath(
                                                System.Environment.SpecialFolder.Fonts);

                                            FontNameGetter fontNameGetter = new FontNameGetter();
                                            string res = fontNameGetter.GetFontFileName(new DirectoryInfo(fontsfolder), txt.font2);
                                            if (File.Exists(res))
                                            {
                                                string fileDest = project.BuildFolderPath + "\\" + fontName + ".ttf";
                                                File.Copy(res, fileDest, true);
                                            }

                                        }

                                    }
                                }
                            }
                            else
                            {

                                for (int l = 0; l < obj.Entity.CoronaObjects.Count; l++)
                                {
                                    CoronaObject child = obj.Entity.CoronaObjects[l];

                                    if (child.DisplayObject.Figure != null)
                                    {
                                        Figure fig = child.DisplayObject.Figure;
                                        if (fig.ShapeType.Equals("TEXT"))
                                        {
                                            Texte txt = fig as Texte;
                                            string fontName = txt.font2.getFontNameForAndroid();
                                            if (!list.Contains(fontName))
                                            {
                                                list.Add(fontName);

                                                string fontsfolder = System.Environment.GetFolderPath(
                                                    System.Environment.SpecialFolder.Fonts);

                                                FontNameGetter fontNameGetter = new FontNameGetter();
                                                string res = fontNameGetter.GetFontFileName(new DirectoryInfo(fontsfolder), txt.font2);
                                                if (File.Exists(res))
                                                {
                                                    string fileDest = project.BuildFolderPath + "\\" + fontName + ".ttf";
                                                    File.Copy(res, fileDest, true);
                                                }

                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                return list;
            }
            return null;
        }
Exemple #22
0
        public void setOrientation(CoronaGameProject.OrientationScreen or)
        {
            this.orientation = or;

            if (this.orientation == CoronaGameProject.OrientationScreen.Landscape)
                this.Camera.SurfaceFocus.Size = new Size(480, 320);
            else if (this.orientation == CoronaGameProject.OrientationScreen.Portrait)
                this.Camera.SurfaceFocus.Size = new Size(320, 480);
        }
Exemple #23
0
 //---------------------------------------------------
 //-------------------Constructeur------------------------
 //---------------------------------------------------
 public CoronaGameBuilder(CoronaGameProject project)
 {
     this.project = project;
 }
Exemple #24
0
        /////////////////////////////////////////
        // Create Lua Langue
        // Generate language.settings and all <LangueName>.langue
        /////////////////////////////////////////
        public void CreateLuaLangue(CoronaGameProject project)
        {
            if (project.Langues == null) return;
            if (project.DefaultLanguage == null) return;

            string path = this.project.BuildFolderPath + "\\lang.set";

            StringBuilder sb = new StringBuilder();

            String contentToWrite = "{\n";

            if (!project.DefaultLanguage.Equals("")) contentToWrite += "\"default\":\"" + project.DefaultLanguage.ToLower() + "\",\n\n";

            if (project.Langues.Count > 0)
            {
                contentToWrite += "\"languages\":\n[\n";
                for (int i = 0; i < project.Langues.Count; i++)
                {
                    if (i == project.Langues.Count) contentToWrite += "\"" + project.Langues[i].Langue.ToLower() + "\"\n";
                    else contentToWrite += "\"" + project.Langues[i].Langue.ToLower() + "\"\n";

                    if (i < project.Langues.Count - 1) contentToWrite += ",";
                    CreateLuaLangueFile(project.Langues[i]);
                }
                contentToWrite += "]";
            }

            contentToWrite += "}\n";

            //Save to File
            sb.Append(contentToWrite);

            FileStream fs = File.Create(path);
            fs.Close();

            File.AppendAllText(path, sb.ToString());
            sb.Clear();
            sb = null;
        }
Exemple #25
0
 public void Init(CoronaGameProject cProject)
 {
     this.project = cProject;
 }