Exemple #1
0
    private void Initialize()
    {
        CloudSave = new CloudSave();

        _jsonSerializerSettings                        = new JsonSerializerSettings();
        _jsonSerializerSettings.Formatting             = Formatting.Indented;
        _jsonSerializerSettings.ReferenceLoopHandling  = ReferenceLoopHandling.Ignore;
        _jsonSerializerSettings.ObjectCreationHandling = ObjectCreationHandling.Replace;

        if (!PlayerPrefs.HasKey(SAVE_NAME))
        {
            var stringPlayerData = JsonConvert.SerializeObject(CloudSave.PlayerData, _jsonSerializerSettings);
            PlayerPrefs.SetString(SAVE_NAME, stringPlayerData);
        }

        if (!PlayerPrefs.HasKey("IsFirstTime"))
        {
            PlayerPrefs.SetInt("IsFirstTime", 1);
        }

        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
                                              .EnableSavedGames()
                                              .Build();

        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.DebugLogEnabled = Debug.isDebugBuild;
        PlayGamesPlatform.Activate();

        // Load local save data
        LoadLocal();
    }
Exemple #2
0
    public static IEnumerator loadOut(MonoBehaviour parent, int Game)
    {
        if (Game == 1)
        {
            yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, GlobalDefines.returnsFirstGame.ToString())));

            yield return(parent.StartCoroutine(WaitForExit(Game, parent)));

            yield return(parent.StartCoroutine(CheckWinner(Game, parent, GlobalDefines.Que)));
        }
        if (Game == 2)
        {
            yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, GlobalDefines.returnsSecondGame.ToString())));

            yield return(parent.StartCoroutine(WaitForExit(Game, parent)));

            yield return(parent.StartCoroutine(CheckWinner(Game, parent, GlobalDefines.Que)));
        }
        if (Game == 3)
        {
            yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, GlobalDefines.returnsThirdGame.ToString())));

            yield return(parent.StartCoroutine(WaitForExit(Game, parent)));

            yield return(parent.StartCoroutine(CheckWinner(Game, parent, GlobalDefines.Que)));
        }
        yield return(parent.StartCoroutine(LeaveFromRoom(Game, GlobalDefines.RecRoom, PlayFabLogin.ReturnMobileID())));

        SceneManager.LoadScene("Win");
        yield return(new WaitForSeconds(10));

        SceneManager.LoadScene("SampleScene");
    }
Exemple #3
0
 public void OnOKBtn()
 {
     GameManager.Instance.CurrentDataset = CloudSave.OpenOrCreateDataset(_datasetName);
     GetComponent <InputViewController>().SwitchDataset();
     Hide();
 }
Exemple #4
0
    public static IEnumerator Disconnect(MonoBehaviour parent, string id, int Game, int score)
    {
        yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, score.ToString())));

        yield return(parent.StartCoroutine(LeaveFromRoom(Game, GlobalDefines.RecRoom, PlayFabLogin.ReturnMobileID(), true)));
    }
 public void WipeLocal()
 {
     CloudSave.WipeOut();
 }