예제 #1
0
        private void LoadKeyData()
        {
            string filePath = Application.streamingAssetsPath + keyDataFile;

            if (File.Exists(filePath))
            {
                string dataAsJson = File.ReadAllText(filePath);
                data = JsonUtility.FromJson <KeyData>(dataAsJson);
                if (data != null)
                {
                    for (int i = 0; i < data.Keys.Length; i++)
                    {
                        SetKeyAt(i + 1, data.Keys[i]);
                    }
                }
            }
            else
            {
                File.Create(filePath);
            }
        }
예제 #2
0
 private void Start()
 {
     Instance = this;
     data     = new KeyData();
     LoadKeyData();
 }