예제 #1
0
        private void SaveDebugData()
        {
            GameDataList dataList = new GameDataList();

            dataList.SaveFileNames.AddRange(new List <string> {
                "Save 1", "Save 2", "Save 3"
            });
            PlayerPrefs.SetString(SaveFileKey, JsonUtility.ToJson(dataList));
        }
예제 #2
0
        private void LoadFileList()
        {
            if (!PlayerPrefs.HasKey(SaveFileKey))
            {
                return;
            }

            string jsonString = PlayerPrefs.GetString(SaveFileKey);

            GameData = JsonUtility.FromJson <GameDataList>(jsonString);

            if (GameData.SaveFileNames.Count <= 0)
            {
                return;
            }

            foreach (string saveName in GameData.SaveFileNames)
            {
                //RectTransform widget = Instantiate(SaveSlotPrefab).GetComponent<RectTransform>();

                SaveSlotWidget widget = Instantiate(SaveSlotPrefab, LoadItemPanel).GetComponent <SaveSlotWidget>();
                widget.Initialize(this, saveName);
            }
        }