private void LoadRecord()
    {
        string savePath = GetSavePath();

        if (File.Exists(savePath))
        {
            string json = File.ReadAllText(savePath);
            Debug.Log("Loaded json: " + json);
            MazeProgressSave mazeProgressSave = JsonUtility.FromJson <MazeProgressSave>(json);
            this.mazeProgressModel = new MazeProgressModel(mazeProgressSave.currentProgress);
            Debug.Log("maze progress save current progress: " + this.mazeProgressModel.currentProgress.ToString());
        }
    }
Exemplo n.º 2
0
    // IMPLEMENTATION METHODS

    private void DoMazeProgressProcesses()
    {
        MazeProgressModel mazeProgressModel = MazeProgressService.GetModel();

        mazeProgressModel.currentProgress += 1;
        this.mazeProgress = mazeProgressModel.currentProgress;
        if (mazeProgressModel.currentProgress == MazeProgressModel.MAX_PROGRESS)
        {
            this.UnlockRandomKittyOrAccessory();
            this.itemIsUnlocked = true;
            mazeProgressModel.currentProgress = 0;
            this.RenderItemUnlock();
        }
        MazeProgressService.Save(mazeProgressModel);
        //print(
        //	"maze progress: " +
        //	mazeProgressModel.currentProgress.ToString() +
        //	"/" +
        //	MazeProgressModel.MAX_PROGRESS.ToString()
        //);
        //print("item is unlocked: " + this.itemIsUnlocked.ToString());
    }
 public static void Save(MazeProgressModel model)
 {
     GameManager.instance.mazeProgressData.SaveModel(model);
 }
 public void SaveModel(MazeProgressModel model)
 {
     this.mazeProgressModel = model;
     this.SynchRecordToJsonFile();
 }
    // CONSTRUCTOR

    public MazeProgressData()
    {
        this.mazeProgressModel = new MazeProgressModel(0);
        this.InitDirectories();
        this.LoadRecord();
    }