Exemple #1
0
        public void SaveJSON()
        {
            string path     = "C:/LayoutJSONs/";
            string fileName = System.DateTime.Now.ToString("yyyyMMddhhmmss") + ".txt";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            LayoutJSON fileContents = new LayoutJSON(_angle, _columns, _margin, _marginColumn, _marginRow, _plane, _radius, _reverse, _fill, _layoutType);

            File.WriteAllText(path + fileName, JsonUtility.ToJson(fileContents), System.Text.Encoding.UTF8);
        }
Exemple #2
0
        public void LoadJSON(string jsonString)
        {
            LayoutJSON data = JsonUtility.FromJson <LayoutJSON>(jsonString);

            _angle        = data.angle;
            _columns      = (ushort)data.columns;
            _margin       = data.margin;
            _marginColumn = data.marginColumn;
            _marginRow    = data.marginRow;
            _radius       = data.radius;
            _reverse      = data.reverse;
            _fill         = data.fill;

            _layoutType = (LayoutType)System.Enum.Parse(typeof(LayoutType), data.type);
            _plane      = new Vector3(data.plane[0], data.plane[1], data.plane[2]);
        }