Пример #1
0
        protected virtual string ConvertToEmojiOne(string p_json)
        {
            try
            {
                //Unity cannot deserialize Dictionary, so we converted the dictionary to List using MiniJson
                p_json = ConvertToUnityJsonFormat(p_json);
                PreConvertedSpritesheetData    v_preData  = JsonUtility.FromJson <PreConvertedSpritesheetData>(p_json);
                TexturePacker.SpriteDataObject v_postData = v_preData.ToTexturePacketDataObject(m_gridSize, m_padding, m_spacing);

                return(JsonUtility.ToJson(v_postData));
            }
            catch (System.Exception p_exception)
            {
                Debug.Log("Failed to convert to EmojiOne\n: " + p_exception);
            }

            return("");
        }
        public static string ConvertToTexturePackerFormat(string json, Vector2Int gridSize, Vector2Int padding, Vector2Int spacing)
        {
            try
            {
                //Unity cannot deserialize Dictionary, so we converted the dictionary to List using MiniJson
                json = ConvertToUnityJsonFormat(json);
                PreConvertedSpritesheetData        v_preData  = JsonUtility.FromJson <PreConvertedSpritesheetData>(json);
                TexturePackerData.SpriteDataObject v_postData = v_preData.ToTexturePacketDataObject(gridSize, padding, spacing);

                return(JsonUtility.ToJson(v_postData));
            }
            catch (System.Exception p_exception)
            {
                Debug.Log("Failed to convert to EmojiOne\n: " + p_exception);
            }

            return("");
        }