Ejemplo n.º 1
0
    public void SaveAllParametrs(AllParametrs allParametrs)
    {
        string json = JsonUtility.ToJson(allParametrs);

        PlayerPrefs.SetString("allParametrs", json);
        GPGSManager.WriteSaveData(Encoding.UTF8.GetBytes(json));
    }
Ejemplo n.º 2
0
    public void Login()
    {
#if UNITY_EDITOR
        onLoginned.Invoke();
#else
        GPGSManager.Login(() => onLoginned.Invoke());
#endif
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        uiText = GetComponent <Text>();

        time        = 0.00f;
        uiText.text = "Time : " + time.ToString();
        bPause      = false;

        gpgsIns = GPGSManager.GetInstance;
    }
Ejemplo n.º 4
0
    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);
        });
    }
Ejemplo n.º 5
0
    private void OnApplicationPause(bool pauseStatus)
    {
        if (pauseStatus)
        {
            Debug.Log("Start LocalAndCloudSave");
            DataManager.LocalAndCloudSave(null);

            if (!isPaused)
            {
                onApplicationPause.Invoke();
            }
        }
        else
        {
            GPGSManager.OpenSaveData();
        }
    }
Ejemplo n.º 6
0
    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;
        }
    }
Ejemplo n.º 7
0
    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
    }
Ejemplo n.º 8
0
    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);
    }
Ejemplo n.º 9
0
    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();
    }
Ejemplo n.º 10
0
    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;
        });
    }
Ejemplo n.º 11
0
    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();
    }
Ejemplo n.º 12
0
    // 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();
    }
Ejemplo n.º 13
0
    // 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();
    }
Ejemplo n.º 14
0
    // 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();
        }
    }
Ejemplo n.º 15
0
 public void Awake()
 {
     GPGSManager.instance = this;
 }
Ejemplo n.º 16
0
 private void GooglePlayAuth(Action <bool> onAuth)
 {
     GPGSManager.Auth(onAuth);
 }
Ejemplo n.º 17
0
 public void ShowLeaderBoardUI()
 {
     GPGSManager.ShowLeaderBoardUI();
 }
Ejemplo n.º 18
0
 public void Gototitle()
 {
     PlayerPrefs.SetInt("character", 0);
     PlayerPrefs.SetInt("job", 0);
     GPGSManager.instance().SendBoardScore();
 }
Ejemplo n.º 19
0
    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);
            });
        }
    }
Ejemplo n.º 20
0
 public void ShowLeaderbord()
 {
     GPGSManager.ShowLeaderboard();
 }