Ejemplo n.º 1
0
        public void GenerateMapView()
        {
            if (newField != null)
            {
                if (XCPManager.currentXCP != null)
                {
                    newField.hNr = 3;
                    if (XCPManager.currentXCP.xpcMaps != null)
                    {
                        noMaps.gameObject.SetActive(false);

                        newField.items = new FieldItem[XCPManager.currentXCP.xpcMaps.Length];
                        for (int i = 0; i < newField.items.Length; i++)
                        {
                            newField.items[i].index           = i;
                            newField.items[i].useIcon         = true;
                            newField.items[i].selectable      = true;
                            newField.items[i].itemPressMethod = ItemHandler;
                            if (i == XCPManager.currentXCP.mainMapIndex)
                            {
                                newField.items[i].itemIcon = Resources.Load <Sprite>("BerrySystem/Icons/MMain");
                            }
                            else
                            {
                                newField.items[i].itemIcon = Resources.Load <Sprite>("BerrySystem/Icons/MAP");
                            }
                            newField.items[i].itemDisplayText = XCPManager.currentXCP.xpcMaps[i].map;
                        }
                        newField.GenerateViewItems();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public void GenerateMapView()
 {
     if (XCPManager.currentXCP.entities != null)
     {
         if (newField != null)
         {
             if (XCPManager.currentXCP != null)
             {
                 newField.hNr = 3;
                 if (XCPManager.currentXCP.xpcMaps != null)
                 {
                     newField.items = new FieldItem[XCPManager.currentXCP.entities.Length];
                     for (int i = 0; i < newField.items.Length; i++)
                     {
                         newField.items[i].index = i;
                         if (XCPManager.currentXCP.entities[i].entSprites.Length != 0)
                         {
                             newField.items[i].useIcon  = true;
                             newField.items[i].itemIcon = XCPManager.PngToSprite(XCPManager.currentXCP.entities[i].entSprites[0]);
                         }
                         newField.items[i].selectable           = true;
                         newField.items[i].itemPressMethod      = ItemHandler;
                         newField.items[i].itemRightPressMethod = CreateSpriteEditor;
                     }
                     newField.GenerateViewItems();
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
        public void GenerateMapView()
        {
            if (XCPManager.currentXCP.tileTextures != null)
            {
                if (ScenePrimer.curEditorPrimer.curTileId == -1)
                {
                    ScenePrimer.curEditorPrimer.curTileId = 0;
                }

                if (newField != null)
                {
                    if (XCPManager.currentXCP != null)
                    {
                        newField.hNr = 3;
                        newField.useNumberShortCut = true;
                        if (XCPManager.currentXCP.xpcMaps != null)
                        {
                            newField.items = new FieldItem[XCPManager.currentXCP.tileTextures.Length];
                            for (int i = 0; i < newField.items.Length; i++)
                            {
                                if (ScenePrimer.curEditorPrimer.curTileId == i)
                                {
                                    newField.items[i].startSelect = true;
                                }
                                newField.items[i].index           = i;
                                newField.items[i].useIcon         = true;
                                newField.items[i].selectable      = true;
                                newField.items[i].itemIcon        = XCPManager.PngToSprite(XCPManager.currentXCP.tileTextures[i]);
                                newField.items[i].itemPressMethod = ItemHandler;
                                //newField.items[i].itemDisplayText = "item";
                            }
                            newField.GenerateViewItems();
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void GenerateMapView()
        {
            if (XCPManager.currentXCP.itemTextures != null)
            {
                if (ScenePrimer.curEditorPrimer.curSpriteId == -1)
                {
                    ScenePrimer.curEditorPrimer.curSpriteId = 0;
                }

                if (newField != null)
                {
                    if (XCPManager.currentXCP != null)
                    {
                        newField.hNr = 3;
                        if (XCPManager.currentXCP.xpcMaps != null)
                        {
                            newField.items = new FieldItem[XCPManager.currentXCP.itemTextures.Length];
                            for (int i = 0; i < newField.items.Length; i++)
                            {
                                if (ScenePrimer.curEditorPrimer.curSpriteId == i)
                                {
                                    newField.items[i].startSelect = true;
                                }
                                newField.items[i].index                = i;
                                newField.items[i].useIcon              = true;
                                newField.items[i].selectable           = true;
                                newField.items[i].itemIcon             = XCPManager.PngToSprite(XCPManager.currentXCP.itemTextures[i]);
                                newField.items[i].itemPressMethod      = ItemHandler;
                                newField.items[i].itemRightPressMethod = CreateSpriteEditor;
                            }
                            newField.GenerateViewItems();
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void GenerateFeild(string path)
        {
            if (Directory.Exists(path))
            {
                feildObj.text = path;
                string[] strings = Directory.GetFiles(feildObj.text, "*" + fileTypeTarget);
                string[] folders = Directory.GetDirectories(feildObj.text);

                if (noFiles)
                {
                    newField.items = new FieldItem[folders.Length + 1];
                }
                else
                {
                    newField.items = new FieldItem[strings.Length + folders.Length + 1];
                }

                if (Directory.GetParent(path) == null)
                {
                    newField.items[0].hidden = true;
                }
                else
                {
                    newField.items[0].itemIcon        = ScenePrimer.curEditorPrimer.editorIcons[29];
                    newField.items[0].itemDisplayText = "Up";
                    newField.items[0].filePath        = Directory.GetParent(path).FullName;
                    newField.items[0].itemPressMethod = GoInsideFolder;
                }

                for (int i = 0; i < folders.Length; i++)
                {
                    newField.items[i + 1].itemIcon        = ScenePrimer.curEditorPrimer.editorIcons[3];
                    newField.items[i + 1].itemDisplayText = Path.GetFileNameWithoutExtension(folders[i]);
                    newField.items[i + 1].filePath        = folders[i];
                    newField.items[i + 1].itemPressMethod = GoInsideFolder;
                    newField.items[i + 1].useIcon         = true;
                }
                if (!noFiles)
                {
                    for (int i = 0; i < strings.Length; i++)
                    {
                        Texture2D tex = new Texture2D(1, 1);
                        newField.items[folders.Length + 1 + i].useIcon = true;
                        tex.LoadImage(File.ReadAllBytes(strings[i]));
                        tex.filterMode = FilterMode.Point;
                        if (fileTypeTarget == ".png" || fileTypeTarget == ".jpg")
                        {
                            newField.items[folders.Length + 1 + i].itemIcon = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f);
                        }
                        else
                        {
                            if (fileTypeTarget == ".xcp")
                            {
                                newField.items[folders.Length + 1 + i].itemIcon = Resources.Load <Sprite>("BerrySystem/Icons/xcp 1");
                            }
                            else
                            {
                                newField.items[folders.Length + 1 + i].itemIcon = ScenePrimer.curEditorPrimer.editorIcons[13];
                            }
                        }
                        newField.items[folders.Length + 1 + i].itemDisplayText = Path.GetFileNameWithoutExtension(strings[i]);
                        newField.items[folders.Length + 1 + i].filePath        = strings[i];
                        newField.items[folders.Length + 1 + i].itemPressMethod = ItemHandler;
                        newField.items[folders.Length + 1 + i].selectable      = true;
                    }
                }
                else
                {
                }
                newField.GenerateViewItems();
            }
            else
            {
            }
        }