Beispiel #1
0
    private void SaveTimeRecord()
    {
        GameTimeRecord rec = new GameTimeRecord()
        {
            sudokuTimePlayed    = GameTimeRecord.GameTimeRecorded,
            crosswordTimePlayed = loadedSavedTime.crosswordTimePlayed,
            pacmanTimePlayed    = loadedSavedTime.pacmanTimePlayed
        };

        string gameRecordedTime = JsonUtility.ToJson(rec);

        File.WriteAllText(Application.dataPath + "/recordingData.txt", gameRecordedTime);
        Debug.Log("Data saved");

        GameTimeRecord.GameTimeRecorded = 0;
    }
Beispiel #2
0
    void LoadGame(DataGame game, int index)
    {
        Debug.Log("Load game");
        //todo add comment
        if (File.Exists(Application.dataPath + "/recordingData.txt"))
        {
            string savedData = File.ReadAllText(Application.dataPath + "/recordingData.txt");
            loadedSavedTime = JsonUtility.FromJson <GameTimeRecord>(savedData);
            GameTimeRecord.GameTimeRecorded = loadedSavedTime.sudokuTimePlayed;
            Debug.Log("Load recorded time : " + RecordCrosswordTime.GameTimeRecorded);
            Debug.Log("loadedSavedTime : " + loadedSavedTime.crosswordTimePlayed);
        }
        else
        {
            loadedSavedTime = new GameTimeRecord()
            {
                crosswordTimePlayed = 0,
                sudokuTimePlayed    = 0,
                pacmanTimePlayed    = 0
            };
        }


        for (int i = 0; i < game.blocks.Count; i++)
        {
            blocks[i].DataBlock = game.blocks[i];
        }
        UpdateUI();
        UpdateAllBlockUI();
        SudokuGameManager.SavedGame  = game;
        SudokuGameManager.LastLoaded = index;
        stateList.Clear();

        UpdateAllBlockUI();
        if (!SudokuGameManager.IsGamePause)
        {
            StartCoroutine(PlayNewGameAnimation());
        }

        Timer.Schedule(this, 1f, () =>
        {
            CUtils.ShowInterstitialAd();
        });
    }
Beispiel #3
0
    void Start()
    {
        gameState = GameState.Init;
        UpdateTime();

        if (File.Exists(Application.dataPath + "/recordingData.txt"))
        {
            string savedData = File.ReadAllText(Application.dataPath + "/recordingData.txt");
            loadedSavedTime = JsonUtility.FromJson <GameTimeRecord>(savedData);
            GameTimeRecord.GameTimeRecorded = loadedSavedTime.pacmanTimePlayed;
            Debug.Log("Load recorded time : " + RecordPacmanTime.GameTimeRecorded);
            Debug.Log("loadedSavedTime : " + loadedSavedTime.pacmanTimePlayed);
        }
        else
        {
            loadedSavedTime = new GameTimeRecord()
            {
                crosswordTimePlayed = 0,
                sudokuTimePlayed    = 0,
                pacmanTimePlayed    = 0
            };
        }
    }