예제 #1
0
        //---------------------------------------------------
        //-------------------Attributes-----------------------

        //---------------------------------------------------
        //-------------------Constructeurs-------------------
        //---------------------------------------------------
        public TilesMapEditorMobile(CoronaGameProject projectParent)
            : base(new Size(320, 480), projectParent.Orientation, projectParent)
        {
            this.projectParent = projectParent;

            this.Name = "mapmobileeditor";
        }
예제 #2
0
파일: Emulator.cs 프로젝트: slagusev/Krea
 public void Init(CoronaGameProject _project, Boolean _isDebugMode)
 {
     this.cProject    = _project;
     this.isDebugMode = _isDebugMode;
     this.isRunning   = false;
     this.isInit      = true;
 }
예제 #3
0
 public void Init(CoronaGameProject cProject, Form1 mainForm)
 {
     this.project       = cProject;
     this.mainForm      = mainForm;
     listCommands       = new List <string>();
     LastCommandReceive = "";
     CurrentCommandSend = "";
 }
예제 #4
0
        public ImageResizer(CoronaGameProject CurrentProject)
        {
            if (CurrentProject == null)
            {
                return;
            }

            Project = CurrentProject;
        }
예제 #5
0
        public void Init(Form1 mainForm, CoronaGameProject project)
        {
            this.mainForm = mainForm;

            this.project = project;

            this.reloadComboBox();
            this.reloadListTranslation();
        }
예제 #6
0
        private void reloadFramesBitmap()
        {
            if (this.set != null)
            {
                CoronaGameProject projectParent = this.mainForm.CurrentProject;

                for (int i = 0; i < set.Frames.Count; i++)
                {
                    SpriteFrame obj = set.Frames[i];
                    if (obj.Image == null)
                    {
                        string sheetDirectory = Path.Combine(projectParent.ProjectPath + "\\Resources\\SpriteSheets", obj.SpriteSheetParent.Name);
                        string frameFileName  = Path.Combine(sheetDirectory, obj.SpriteSheetParent.Name + "_frame" + i + ".png");
                        if (File.Exists(frameFileName))
                        {
                            obj.Image = Bitmap.FromFile(frameFileName);
                        }
                    }
                }
            }
        }
예제 #7
0
 public void Init(CoronaGameProject cProject, Form1 mainForm)
 {
     this.project  = cProject;
     this.mainForm = mainForm;
 }
예제 #8
0
        private void assetsListView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (this.MainForm.CurrentProject != null)
            {
                GameElementTreeView treeView = this.MainForm.getElementTreeView();
                if (this.objectCategoryCmbBx.SelectedIndex == 0 || this.objectCategoryCmbBx.SelectedIndex == 1)
                {
                    if (this.displayObjectSelected != null && treeView.LayerSelected != null)
                    {
                        DisplayObject dispObjTemp = this.displayObjectSelected.cloneInstance(true);
                        dispObjTemp.Name = this.displayObjectSelected.Name.ToLower().Replace(" ", "").Replace("-", "");
                        dispObjTemp.OriginalAssetName = this.displayObjectSelected.Name;

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

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


                        treeView.newCoronaObject(obj);

                        if (this.MainForm.isFormLocked == false)
                        {
                            GorgonLibrary.Gorgon.Go();
                        }
                    }
                }
                else if (this.objectCategoryCmbBx.SelectedIndex == 2)
                {
                    if (audioObjectSelected != null)
                    {
                        try
                        {
                            AudioObject obj = audioObjectSelected.cloneInstance();
                            obj.name = obj.name.ToLower().Replace(" ", "").Replace("_", "").Replace("-", "");
                            string assetProjectsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Native-Software\\Asset Manager";
                            if (!Directory.Exists(assetProjectsDirectory))
                            {
                                Directory.CreateDirectory(assetProjectsDirectory);
                            }

                            File.Copy(assetProjectsDirectory + "\\" + this.assetsToSerialize.ProjectName + "\\" + audioObjectSelected.name,
                                      this.MainForm.CurrentProject.SourceFolderPath + "\\" + obj.name, true);

                            this.MainForm.getElementTreeView().newAudioObject(obj);
                            this.MainForm.CurrentProject.AudioObjects.Add(obj);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Error during audio file transfert ! \n" + ex.Message);
                        }
                    }
                }
                else if (this.objectCategoryCmbBx.SelectedIndex == 3)
                {
                    if (snippetSelected != null)
                    {
                        Snippet           snippet = snippetSelected.cloneInstance();
                        CoronaGameProject project = this.MainForm.CurrentProject;
                        if (project != null)
                        {
                            bool res = false;
                            for (int i = 0; i < project.Snippets.Count; i++)
                            {
                                if (project.Snippets[i].Name.Equals(snippet.Name))
                                {
                                    res = true;
                                    break;
                                }
                            }

                            if (res == false)
                            {
                                this.MainForm.getElementTreeView().newSnippet(snippet);
                                project.Snippets.Add(snippet);
                                this.MainForm.cgEeditor1.RefreshSnippetLuaCode(project);
                            }
                        }
                    }
                }
                else if (this.objectCategoryCmbBx.SelectedIndex == 4)
                {
                    if (this.fontItemSelected != null)
                    {
                        FontItem font = fontItemSelected.cloneInstance();
                        if (File.Exists(font.OriginalPath))
                        {
                            string destFile = this.MainForm.CurrentProject.SourceFolderPath + "\\" + font.NameForAndroid + ".ttf";
                            File.Copy(font.OriginalPath, destFile, true);
                            font.FileName     = destFile;
                            font.OriginalPath = destFile;
                        }



                        CoronaGameProject project = this.MainForm.CurrentProject;
                        font.projectParent = project;
                        if (project != null)
                        {
                            bool res = false;
                            for (int i = 0; i < project.AvailableFont.Count; i++)
                            {
                                if (project.AvailableFont[i].NameForIphone.Equals(font.NameForIphone))
                                {
                                    res = true;
                                    break;
                                }
                            }

                            if (res == false)
                            {
                                this.MainForm.getElementTreeView().newFontItem(font);
                                project.AvailableFont.Add(font);
                            }
                        }
                    }
                }
            }
        }
예제 #9
0
 //---------------------------------------------------
 //-------------------Constructeurs--------------------
 //---------------------------------------------------
 public SpriteSheetLuaGenerator(CoronaSpriteSheet SpriteSheet, CoronaGameProject currentProject)
 {
     this.SpriteSheet    = SpriteSheet;
     this.currentProject = currentProject;
 }
예제 #10
0
        public void refreshAPI(string sourcePage)
        {
            //Clear all lists
            this.Categories.Clear();
            this.Items.Clear();


            //Chercher toutes les infex de href="#
            int    indexStart           = 0;
            int    indexFirstEndBalise  = 0;
            int    indexSecondEndBalise = 0;
            string strStart             = "href=\"#";
            string strEndFirstBalise    = ">";
            string strEndSecondBalise   = "</a>";

            while (indexStart < sourcePage.Length)
            {
                indexStart = sourcePage.IndexOf(strStart, indexSecondEndBalise);
                if (indexStart == -1)
                {
                    break;
                }

                indexFirstEndBalise = sourcePage.IndexOf(strEndFirstBalise, indexStart);
                if (indexFirstEndBalise == -1)
                {
                    break;
                }

                indexSecondEndBalise = sourcePage.IndexOf(strEndSecondBalise, indexFirstEndBalise);
                if (indexSecondEndBalise == -1)
                {
                    break;
                }

                string content = sourcePage.Substring(indexFirstEndBalise + 1, indexSecondEndBalise - indexFirstEndBalise - 1);

                //Treat the content
                content = content.Replace("\n", "");
                content = content.Replace(" ", "");

                //Treat if is a category
                if (content.Contains("."))
                {
                    string catName  = content.Substring(0, content.IndexOf("."));
                    int    len      = content.Length - content.IndexOf(".");
                    string itemName = content.Substring(content.IndexOf(".") + 1, len - 1);
                    this.addItem(catName, itemName, false);
                }
                else if (content.Contains(":"))
                {
                    string catName  = content.Substring(0, content.IndexOf(":"));
                    int    len      = content.Length - content.IndexOf(":");
                    string itemName = content.Substring(content.IndexOf(":") + 1, len - 1);
                    this.addItem(catName, itemName, true);
                }
                else
                {
                    this.addItem(null, content, false);
                }
            }

            APICategory objectCategory = null;

            for (int i = 0; i < this.Categories.Count; i++)
            {
                if (this.Categories[i].name.ToLower().Equals("object"))
                {
                    objectCategory = this.Categories[i];
                    break;
                }
            }

            if (this.editorParent.sceneSelected != null)
            {
                CoronaGameProject currentProject = this.editorParent.sceneSelected.projectParent;
                if (currentProject != null)
                {
                    APICategory catStoryboard = new APICategory("storyboard");
                    this.Categories.Add(catStoryboard);

                    if (currentProject.Snippets.Count > 0)
                    {
                        APICategory catSnippets = new APICategory("snippets");
                        this.Categories.Add(catSnippets);
                        for (int i = 0; i < currentProject.Snippets.Count; i++)
                        {
                            Snippet snippet     = currentProject.Snippets[i];
                            APIItem itemSnippet = new APIItem(snippet.Name.Replace(" ", ""), true);
                            catSnippets.Items.Add(itemSnippet);
                        }
                    }


                    APICategory catResources = new APICategory("resources");
                    catStoryboard.SubCategories.Add(catResources);

                    //AJouter les scenes
                    for (int i = 0; i < currentProject.Scenes.Count; i++)
                    {
                        Scene       scene    = currentProject.Scenes[i];
                        APICategory catScene = new APICategory(scene.Name);
                        catResources.SubCategories.Add(catScene);

                        for (int j = 0; j < scene.Layers.Count; j++)
                        {
                            CoronaLayer layer    = scene.Layers[j];
                            APICategory catLayer = new APICategory(layer.Name);
                            catScene.SubCategories.Add(catLayer);

                            for (int k = 0; k < layer.CoronaObjects.Count; k++)
                            {
                                CoronaObject obj    = layer.CoronaObjects[k];
                                APICategory  catObj = new APICategory(obj.DisplayObject.Name);
                                catLayer.SubCategories.Add(catObj);

                                if (objectCategory != null)
                                {
                                    catObj.SubCategories.Add(objectCategory);
                                }
                            }

                            for (int k = 0; k < layer.Jointures.Count; k++)
                            {
                                CoronaJointure joint     = layer.Jointures[k];
                                APIItem        itemJoint = new APIItem(joint.name, false);
                                catLayer.Items.Add(itemJoint);
                            }

                            for (int k = 0; k < layer.Controls.Count; k++)
                            {
                                CoronaControl control     = layer.Controls[k];
                                APIItem       itemControl = new APIItem(control.ControlName, false);
                                catLayer.Items.Add(itemControl);
                            }
                        }
                    }
                }
            }
        }
예제 #11
0
 public ProjectPropertyConverter(CoronaGameProject project, Form1 mainForm)
 {
     this.project  = project;
     this.mainForm = mainForm;
 }
예제 #12
0
파일: FontItem.cs 프로젝트: slagusev/Krea
 public FontItem(string fontName, CoronaGameProject projectParent)
 {
     this.NameForAndroid = fontName;
     this.NameForIphone  = fontName;
     this.projectParent  = projectParent;
 }
예제 #13
0
 public void Init(CoronaGameProject cProject)
 {
     this.project = cProject;
 }