public void SaveAllParametrs(AllParametrs allParametrs) { string json = JsonUtility.ToJson(allParametrs); PlayerPrefs.SetString("allParametrs", json); GPGSManager.WriteSaveData(Encoding.UTF8.GetBytes(json)); }
public void Login() { #if UNITY_EDITOR onLoginned.Invoke(); #else GPGSManager.Login(() => onLoginned.Invoke()); #endif }
// Use this for initialization void Start() { uiText = GetComponent <Text>(); time = 0.00f; uiText.text = "Time : " + time.ToString(); bPause = false; gpgsIns = GPGSManager.GetInstance; }
public static void SendRecord(Action <Task> callback) { UserScoreData userScoreData = new UserScoreData(GPGSManager.GetUserName(), DataManager.record.GetValue()); DocumentReference userDocRef = db.Collection(leaderboardId).Document(auth.CurrentUser.UserId); userDocRef.SetAsync(userScoreData).ContinueWithOnMainThread(secondTask => { callback?.Invoke(secondTask); }); }
private void OnApplicationPause(bool pauseStatus) { if (pauseStatus) { Debug.Log("Start LocalAndCloudSave"); DataManager.LocalAndCloudSave(null); if (!isPaused) { onApplicationPause.Invoke(); } } else { GPGSManager.OpenSaveData(); } }
private void FirestoreAuth(Action <Task> callback) { if (GPGSManager.isAuthenticated) { string authCode = GPGSManager.GetServerAuthCode(); FirestoreManager.Auth(authCode, task => { firebaseIsReady = true; callback?.Invoke(task); }); } else { firebaseIsReady = true; } }
private void Awake() { if (!Instance) { Instance = this; DontDestroyOnLoad(this); } else { Destroy(this.gameObject); Debug.LogWarning("You have duplicate Google Managers GPGS in your scene!"); } #if UNITY_ANDROID leaderBoardID = GPGSIds.leaderboard_leaders; #endif }
private void Awake() { //Check if instance already exists if (Instance == null) { //if not, set instance to this Instance = this; } //If instance already exists and it's not this: else if (Instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); }
void Start() { DontDestroyOnLoad(gameObject); if (_instance == null) { _instance = this; } PlayGamesClientConfiguration config = new PlayGamesClientConfiguration .Builder() .EnableSavedGames() .RequestEmail() .RequestServerAuthCode(false) .RequestIdToken() .Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); }
private void InitializeServices() { GPGSManager.Initialize(false); FirestoreManager.Initialize(); IAPManager.Initialize((status) => purchasesIsReady = true); MobileAds.Initialize((status) => { RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetMaxAdContentRating(_maxAdContentRating).build(); MobileAds.SetRequestConfiguration(requestConfiguration); RewardedAdManager.CreateAndRequestAd(); InterstitialAdManager.CreateAndRequestAd(); adsIsReady = true; }); }
private void Awake() { Time.timeScale = 1; GPGSManager.Initialize(false); GPGSManager.Auth((success) => { if (success) { GPGSManager.ReadSaveData(GPGSManager.DEFAULT_SAVE_NAME, (status, data) => { if (status == GooglePlayGames.BasicApi.SavedGame.SavedGameRequestStatus.Success && data.Length > 0) { LoadData(data); } }); } }); LoadJson(); allParametrs.SaveAllParametrs(allParametrs); textScore.text = allParametrs.level.ToString(); }
// Use this for initialization void Start() { DontDestroyOnLoad(this); if (instance == null) { instance = this; AudioSource splash_bgm = GameObject.Find("SoundManager").GetComponent <AudioSource>(); Destroy(splash_bgm); //instance = new GameObject("GPGSManager").AddComponent<GPGSManager>(); } else if (instance != this) { //잘못된 인스턴스를 가르키고 있을 경우 Destroy(gameObject); } LoginUrl = "[email protected]/mobile_php_connect.php"; //StartCoroutine(LoginCor()); Login(); }
// Use this for initialization void Start() { DontDestroyOnLoad(this); if (instance == null) { instance = this; AudioSource splash_bgm = GameObject.Find("SoundManager").GetComponent <AudioSource>(); Destroy(splash_bgm); //instance = new GameObject("GPGSManager").AddComponent<GPGSManager>(); } else if (instance != this) { //잘못된 인스턴스를 가르키고 있을 경우 Destroy(gameObject); } bGameEnd = false; StartCoroutine(ResultCheck()); StartCoroutine(SetUserStatus()); Login(); }
// Start is called before the first frame update void Start() { GameOverManager gameOverManager = FindObjectOfType <GameOverManager>(); //Leaderboard score updating GPGSManager.AddScoreToLeaderboard(gameOverManager.FinalScore); //UI stuff GameOverCanvas = GameObject.Find("Game Over Canvas"); GameOverCanvas.transform.Find("Game Over Score").GetComponent <Text>().text = gameOverManager.FinalScore.ToString(); GameOverCanvas.transform.Find("Try Again Button").GetComponent <Button>(). onClick.AddListener(delegate { SceneManager.LoadScene("Main Game Scene"); }); GameOverCanvas.transform.Find("Home Button").GetComponent <Button>().onClick.AddListener(delegate { SceneManager.LoadScene("Main Menu"); }); //Destroying GameOverManager,It will be created when the game restarts. Destroy(gameOverManager.gameObject); //Ad stuff GameOverCount++; if (GameOverCount >= 3) { FindObjectOfType <AdsManager>().ShowVideoAd(); } }
public void Awake() { GPGSManager.instance = this; }
private void GooglePlayAuth(Action <bool> onAuth) { GPGSManager.Auth(onAuth); }
public void ShowLeaderBoardUI() { GPGSManager.ShowLeaderBoardUI(); }
public void Gototitle() { PlayerPrefs.SetInt("character", 0); PlayerPrefs.SetInt("job", 0); GPGSManager.instance().SendBoardScore(); }
public void Awake() { gpgsManager = FindObjectOfType <GPGSManager>(); if (btnClose != null) { btnClose.onClick.AddListener(() => { if (this.goCredit != null) { this.goCredit.SetActive(false); } if (this.goNewGame != null) { this.goNewGame.SetActive(false); } this.gameObject.SetActive(false); Time.timeScale = 1f; }); } if (btnRestart != null) { btnRestart.onClick.AddListener(() => { Time.timeScale = 1f; if (App.Instance != null) { App.Instance.LoadScene(reStartSceneName); } }); } if (btnBack != null) { btnBack.onClick.AddListener(() => { Time.timeScale = 1f; if (App.Instance != null) { App.Instance.LoadScene(backSceneName); } }); } if (btnNewGame) { btnNewGame.onClick.AddListener(() => { goNewGame.SetActive(true); }); btnNewGameOK.onClick.AddListener(() => { DataManager.GetInstance().CreateUserData(); Protocol.token = null; this.gpgsManager.SignOut(); PlayData.Init(); App.Instance.LoadScene("4. Mode Select"); }); btnNewGameNo.onClick.AddListener(() => { goNewGame.SetActive(false); }); } if (btnCredit) { btnCredit.onClick.AddListener(() => { goCredit.SetActive(true); }); btnCrediExit.onClick.AddListener(() => { goCredit.SetActive(false); }); } }
public void ShowLeaderbord() { GPGSManager.ShowLeaderboard(); }