예제 #1
0
    private void LoadSwitch()
    {
#if UNITY_SWITCH && !UNITY_EDITOR
        WorldMapSave = new WorldMapSaveClass();
        // Attempt to open the file in read-only mode.
        result = nn.fs.File.Open(ref fileHandle, filePath, nn.fs.OpenFileMode.Read);
        if (!result.IsSuccess())
        {
            if (nn.fs.FileSystem.ResultPathNotFound.Includes(result))
            {
                Debug.LogFormat("File not found: {0}", filePath);
            }
            else
            {
                Debug.LogErrorFormat("Unable to open {0}: {1}", filePath, result.ToString());
            }
        }

        // Get the file size.
        long fileSize = 0;
        nn.fs.File.GetSize(ref fileSize, fileHandle);
        // Allocate a buffer that matches the file size.
        byte[] data = new byte[fileSize];
        // Read the save data into the buffer.
        nn.fs.File.Read(fileHandle, 0, data, fileSize);
        // Close the file.
        nn.fs.File.Close(fileHandle);
        // Decode the UTF8-encoded data and store it in the string buffer.
        WorldMapSave = PlaytraGamesLtd.Utils.DeserializeFromString <WorldMapSaveClass>(Encoding.UTF8.GetString(data));
#endif
    }
예제 #2
0
    public void SetupWorldMap()
    {
        WorldMapSave = null;

        if (WorldMapSave == null)
        {
            WorldMapSave = new WorldMapSaveClass();
            Debug.Log("---------------------- empty");
            for (int i = 0; i < 10; i++)
            {
                WorldMapSave.arenas.Add(new WorldMapArenaSaveClass(i, i == 0 ? true : false));
            }

#if UNITY_SWITCH && !UNITY_EDITOR
            SaveSwitch();
#elif UNITY_EDITOR
            Save();
#endif
        }

#if UNITY_SWITCH && !UNITY_EDITOR
        LoadSwitch();
#elif UNITY_EDITOR
        Load();
#endif

        for (int i = 0; i < Arenas.Count; i++)
        {
            Arenas[i].Arena.ArenaBtn.interactable = WorldMapSave.arenas.Where(r => r.Id == Arenas[i].Id).First().isArenaCompleted;
        }

        LoaderManagerScript.Instance.MainCanvasGroup.alpha = 0;
    }
예제 #3
0
 public void Load()
 {
     WorldMapSave = PlaytraGamesLtd.Utils.DeserializeFromString <WorldMapSaveClass>(PlayerPrefs.GetString(PlayerPref_Name));
 }