Esempio n. 1
0
        /// <summary>
        /// Generate the settings for an atlas of the given folder.
        /// </summary>
        /// <param name="folderToAdd"></param>
        /// <returns></returns>
        private dataStructArrayStruct CreateNewAtlasSettings(string folderToAdd)
        {
            var newSettings = new dataStructArrayStruct
            {
                type             = "AutoSDSettings",
                Items            = new object[10],
                ItemsElementName = new ItemsChoiceType[10]
            };

            newSettings.ItemsElementName[0] = ItemsChoiceType.key;
            newSettings.Items[0]            = "scale";
            newSettings.ItemsElementName[1] = ItemsChoiceType.@double;
            newSettings.Items[1]            = (byte)1;
            newSettings.ItemsElementName[2] = ItemsChoiceType.key;
            newSettings.Items[2]            = "extension";
            newSettings.ItemsElementName[3] = ItemsChoiceType.@string;

            string processedFolder = folderToAdd;

            if (processedFolder.EndsWith("/"))
            {
                processedFolder = processedFolder.Substring(0, processedFolder.Length - 1);
            }
            var extension = "_" + processedFolder.Replace("/", "_");

            newSettings.Items[3]            = "_" + processedFolder.Replace("/", "_");
            newSettings.ItemsElementName[4] = ItemsChoiceType.key;
            newSettings.Items[4]            = "spriteFilter";
            newSettings.ItemsElementName[5] = ItemsChoiceType.@string;
            newSettings.Items[5]            = folderToAdd;
            newSettings.ItemsElementName[6] = ItemsChoiceType.key;
            newSettings.Items[6]            = "acceptFractionalValues";
            newSettings.ItemsElementName[7] = ItemsChoiceType.@false;
            newSettings.Items[7]            = new object();
            newSettings.ItemsElementName[8] = ItemsChoiceType.key;
            newSettings.Items[8]            = "maxTextureSize";
            newSettings.ItemsElementName[9] = ItemsChoiceType.QSize;
            var qSize = new dataStructQSize {
                Items = new object[4]
            };

            qSize.Items[0]       = "width";
            qSize.Items[1]       = -1;
            qSize.Items[2]       = "height";
            qSize.Items[3]       = -1;
            newSettings.Items[9] = qSize;

            if (string.IsNullOrEmpty(folderToAdd))
            {
                newSettings.Items[3] = "";
                newSettings.Items[5] = "";
            }

            return(newSettings);
        }
Esempio n. 2
0
        private dataStructQSize CreateSizeStruct(int width, int height)
        {
            var qSize = new dataStructQSize {
                Items = new object[4]
            };

            qSize.Items[0] = "width";
            qSize.Items[1] = width;
            qSize.Items[2] = "height";
            qSize.Items[3] = height;

            return(qSize);
        }
Esempio n. 3
0
        /// <summary>
        /// Generate the settings for an atlas of the given folder.
        /// </summary>
        /// <param name="folderToAdd"></param>
        /// <returns></returns>
        private dataStructArrayStruct CreateNewAtlasSettings(string folderToAdd)
        {
            var newSettings = new dataStructArrayStruct
                              {
                                  type = "AutoSDSettings",
                                  Items = new object[10],
                                  ItemsElementName = new ItemsChoiceType[10]
                              };
            newSettings.ItemsElementName[0] = ItemsChoiceType.key;
            newSettings.Items[0] = "scale";
            newSettings.ItemsElementName[1] = ItemsChoiceType.@double;
            newSettings.Items[1] = (byte) 1;
            newSettings.ItemsElementName[2] = ItemsChoiceType.key;
            newSettings.Items[2] = "extension";
            newSettings.ItemsElementName[3] = ItemsChoiceType.@string;

            string processedFolder = folderToAdd;
            if(processedFolder.EndsWith("/"))
            {
                processedFolder = processedFolder.Substring(0, processedFolder.Length - 1);
            }
            var extension = "_" + processedFolder.Replace("/", "_");
            newSettings.Items[3] = "_" + processedFolder.Replace("/", "_");
            newSettings.ItemsElementName[4] = ItemsChoiceType.key;
            newSettings.Items[4] = "spriteFilter";
            newSettings.ItemsElementName[5] = ItemsChoiceType.@string;
            newSettings.Items[5] = folderToAdd;
            newSettings.ItemsElementName[6] = ItemsChoiceType.key;
            newSettings.Items[6] = "acceptFractionalValues";
            newSettings.ItemsElementName[7] = ItemsChoiceType.@false;
            newSettings.Items[7] = new object();
            newSettings.ItemsElementName[8] = ItemsChoiceType.key;
            newSettings.Items[8] = "maxTextureSize";
            newSettings.ItemsElementName[9] = ItemsChoiceType.QSize;
            var qSize = new dataStructQSize { Items = new object[4] };
            qSize.Items[0] = "width";
            qSize.Items[1] = -1;
            qSize.Items[2] = "height";
            qSize.Items[3] = -1;
            newSettings.Items[9] = qSize;

            if (string.IsNullOrEmpty(folderToAdd))
            {
                newSettings.Items[3] = "";
                newSettings.Items[5] = "";
            }

            return newSettings;
        }
Esempio n. 4
0
        private dataStructQSize CreateSizeStruct(int width, int height)
        {
            var qSize = new dataStructQSize {Items = new object[4]};
            qSize.Items[0] = "width";
            qSize.Items[1] = width;
            qSize.Items[2] = "height";
            qSize.Items[3] = height;

            return qSize;
        }