public void EditLevel() { PuzzleLoader pl = Instantiate(puzzleLoader).GetComponent <PuzzleLoader>(); pl.loadMode = LevelManager.LevelMode.Editor; pl.levelToLoad = BinarySaveSystem.LoadFile <Level>(Path.Combine(Application.persistentDataPath, "Levels", lastLevelShown.id)); }
private void Awake() { instance = this; if (File.Exists(Path.Combine(Application.persistentDataPath, "Data", "playerAccount.data"))) { username = BinarySaveSystem.LoadFile <AccountFile>(Path.Combine(Application.persistentDataPath, "Data", "playerAccount.data")).Username; } }
static public Level LoadLevel(string levelName) { string path = Path.Combine(Application.persistentDataPath, "Levels", levelName); if (File.Exists(path)) { return(BinarySaveSystem.LoadFile <Level>(path)); } return(null); }
public void PlayLevel() { switch (lastLevelShown.type) { case LevelInfo.LevelType.Online: DataTransferer.instance.DownloadLevel(lastLevelShown.id); break; case LevelInfo.LevelType.Local: PuzzleLoader pl = Instantiate(puzzleLoader).GetComponent <PuzzleLoader>(); pl.loadMode = LevelManager.LevelMode.Play; pl.levelToLoad = BinarySaveSystem.LoadFile <Level>(Path.Combine(Application.persistentDataPath, "Levels", lastLevelShown.id)); break; } }
// Start is called before the first frame update void Start() { if (File.Exists(accountDataPath)) { accountFile = BinarySaveSystem.LoadFile <AccountFile>(accountDataPath); if (!firstTime) { ChangeMenu(Menu_States.Selector); return; } ChangeMenu(Menu_States.ACCOUNTDETECTED); return; } ChangeMenu(current_state); }
public void LoadSavedLevels() { string path = Path.Combine(Application.persistentDataPath, "Levels"); if (!Directory.Exists(path)) { return; } var levels = Directory.GetFiles(path); for (int i = 0; i < levels.Length; ++i) { if (Path.GetExtension(levels[i]) == ".data") { continue; } LevelInfo levelInfo = new LevelInfo(LevelInfo.LevelType.Local); LevelSummary ls = Instantiate(levelSummary, communityLocal.transform).GetComponent <LevelSummary>(); levelInfo.levelSummary = ls; Level level = BinarySaveSystem.LoadFile <Level>(levels[i]); levelInfo.id = Path.GetFileName(levels[i]); levelInfo.levelname = level.name; levelInfo.size = level.size; levelInfo.username = level.creatorName; levelInfo.description = level.description; ls.ApplyInfo(levelInfo); } communityLocal.padding.right = levels.Length > 12 ? 60 : 15; scrollbarLocal.enabled = levels.Length > 12; Invoke(nameof(SetLocalLevelsSize), 0.1f); }