/// <summary> /// Initializes the service. This is required before any other actions can be done e.g reporting scores. /// During the initialization process, a login popup will show up if the user hasn't logged in, otherwise /// the process will carry on silently. /// Note that on iOS, the login popup will show up automatically when the app gets focus for the first 3 times /// while subsequent authentication calls will be ignored. /// </summary> public static void Init() { // Authenticate and register a ProcessAuthentication callback // This call needs to be made before we can proceed to other calls in the Social API #if UNITY_IOS GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); Social.localUser.Authenticate(ProcessAuthentication); #elif UNITY_ANDROID && EM_GPGS PlayGamesClientConfiguration.Builder gpgsConfigBuilder = new PlayGamesClientConfiguration.Builder(); if (EM_Settings.GameServices.IsSavedGamesEnabled) { gpgsConfigBuilder.EnableSavedGames(); } // Build the config PlayGamesClientConfiguration gpgsConfig = gpgsConfigBuilder.Build(); // Initialize PlayGamesPlatform PlayGamesPlatform.InitializeInstance(gpgsConfig); // Enable logging if required PlayGamesPlatform.DebugLogEnabled = EM_Settings.GameServices.IsGPGSDebug; // Set PlayGamesPlatforms as active if (Social.Active != PlayGamesPlatform.Instance) { PlayGamesPlatform.Activate(); } // Now authenticate Social.localUser.Authenticate(ProcessAuthentication); #elif UNITY_ANDROID && !EM_GPGS Debug.LogError("SDK missing. Please import Google Play Games plugin for Unity."); #else Debug.Log("Init FAILED: platform not supported."); #endif }
public void Awake() { #if FACEBOOK FB.Init(OnFBInitComplete, OnFBHideUnity); #endif #if GOOGLEGAMES PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .AddOauthScope("profile") .RequestServerAuthCode(false) .Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); #endif if (ClearPlayerPrefs) { _AuthService.UnlinkSilentAuth(); _AuthService.ClearRememberMe(); _AuthService.AuthType = Authtypes.None; } //Set our remember me button to our remembered state. RememberMe.isOn = _AuthService.RememberMe; //Subscribe to our Remember Me toggle RememberMe.onValueChanged.AddListener((toggle) => { _AuthService.RememberMe = toggle; }); // #Critical // this makes sure we can use PhotonNetwork.LoadLevel() on the master client and all clients in the same room sync their level automatically PhotonNetwork.AutomaticallySyncScene = true; }
void Start() { //UnityEngine.Debug.LogError( Social.localUser.authenticated ); //UnityEngine.Debug.LogError( Social.localUser.id ); List <LoginPromotionData> test = new List <LoginPromotionData>(); test.Add(new LoginPromotionData() { Id = "a", StartDateInMs = 1, EndDateInMs = 0 }); test.Add(new LoginPromotionData() { Id = "a", StartDateInMs = 1, EndDateInMs = 0 }); string json = JsonConvert.SerializeObject(test); UnityEngine.Debug.LogError(json); #if UNITY_STANDALONE Screen.SetResolution(768, 1024, false); Application.runInBackground = true; #elif UNITY_ANDROID PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .AddOauthScope("email") .AddOauthScope("profile") .RequireGooglePlus() .Build(); PlayGamesPlatform.InitializeInstance(config); // recommended for debugging: PlayGamesPlatform.DebugLogEnabled = true; // Activate the Google Play Games platform PlayGamesPlatform.Activate(); #endif SceneManager.LoadScene("Login"); }
// ... other code here... public void Start() { // Initialize the Google Mobile Ads SDK. MobileAds.Initialize(initStatus => { }); ldrButton = GameObject.Find("StartButton_LB"); GameObject startButton = GameObject.Find("StartButton_LogIn"); EventSystem.current.firstSelectedGameObject = startButton; // ADD THIS CODE BETWEEN THESE COMMENTS // Create client configuration PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .Build(); // Enable debugging output (recommended) PlayGamesPlatform.DebugLogEnabled = true; // Initialize and activate the platform PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); // END THE CODE TO PASTE INTO START // ADD THESE LINES // Get object instances signInButtonText = GameObject.Find("StartButton_LogIn").GetComponentInChildren <Text>(); authStatus = GameObject.Find("authStatus").GetComponent <Text>(); // ... // PASTE THESE LINES AT THE END OF Start() // Try silent sign-in (second parameter is isSilent) PlayGamesPlatform.Instance.Authenticate(SignInCallback, true); }
void AuthenticateUser() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); Social.localUser.Authenticate((bool success) => { if (success == true) { Debug.Log("Logged in to Google Play Games Services"); if (PlayerPrefs.GetInt("best") > 0) { Social.ReportScore(PlayerPrefs.GetInt("best"), pillueloscores.leaderboard_los_pilluelos_mas_voladores, (bool successo) => { if (successo) { Debug.Log("Posted new score to leaderboard"); } else { Debug.LogError("Unable to post new score to leaderboard"); } }); } SceneManager.LoadScene("menu"); } else { Debug.LogError("Unable to sign in to Google Play Games Services"); mainText.text = "Could not login to Google Play Games Services"; mainText.color = Color.red; SceneManager.LoadScene("menu"); } }); }
private void Awake() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // //--------enables saving game progress-------------- .EnableSavedGames().Build(); // PlayGamesPlatform.InitializeInstance(config); //------------------ recommended for debugging:------------------------------- //PlayGamesPlatform.DebugLogEnabled = true; ////------------------Activate the Google Play Games platform-------------------------- PlayGamesPlatform.Activate(); //ConnectToGoogleService(); //LoadAllData (); //StartCoroutine(CheckInternet()); //CheckInternet(); InvokeRepeating("CheckInternet", 0f, 2f); }
public static void AuthenticateUserFromgamemanager() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); Social.localUser.Authenticate((bool success) => { if (success == true) { Debug.Log("Logged in to Google Play Games Services"); ; } else { Debug.LogError("Unable to sign in to Google Play Games Services"); //mainText.text = "Could not login to Google Play Games Services"; // mainText.color = Color.red; // if cant conect still oad game screen } }); }
void Start() { loaderInst = Instantiate(loader); Cloud.Initialize(); // recommended for debugging: PlayGamesPlatform.DebugLogEnabled = true; // Activate the Google Play Games platform PlayGamesPlatform.Activate(); PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // enables saving game progress. .EnableSavedGames() .Build(); PlayGamesPlatform.InitializeInstance(config); StartCoroutine(Connect()); lvlmanager = GameObject.Find("SceneManager(Clone)").GetComponent <lvlManager>(); UpdateEndGameData(); }
void Awake() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // enables saving game progress. //.EnableSavedGames() // registers a callback to handle game invitations received while the game is not running. //.WithInvitationDelegate(<callback method>) // registers a callback for turn based match notifications received while the // game is not running. //.WithMatchDelegate(<callback method>) .Build(); PlayGamesPlatform.InitializeInstance(config); // recommended for debugging: PlayGamesPlatform.DebugLogEnabled = true; // Activate the Google Play Games platform PlayGamesPlatform.Activate(); // authenticate user: Social.localUser.Authenticate((bool success) => { // handle success or failure }); //----выпиленая реклама Advertisement.Initialize ("25545"); }
void Start() { //Building platform and turning it on PlayGamesClientConfiguration.Builder builder = new PlayGamesClientConfiguration.Builder().EnableSavedGames(); Debug.Log("playgames configured"); PlayGamesPlatform.InitializeInstance(builder.Build()); Debug.Log("playgames Initialized"); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); Debug.Log("playgames Activated"); //This is Signing in. Could put into a 'SignIn' function later.. Social.localUser.Authenticate((bool success) => { if (success) { Debug.Log("Login Succes"); } else { Debug.Log("Login Failed"); } }); }
void Start() { if (platform == null) { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().EnableSavedGames().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; platform = PlayGamesPlatform.Activate(); } Social.Active.localUser.Authenticate(success => { if (success) { Debug.Log("LOGIN: SUCCESS"); } else { Debug.Log("LOGIN: FALIDO"); } }); }
void Start() { // Select the Google Play Games platform as our social platform implementation //GooglePlayGames.PlayGamesPlatform.Activate(); PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // enables saving game progress. .EnableSavedGames() // registers a callback to handle game invitations received while the game is not running. //.WithInvitationDelegate(<callback method>) // registers a callback for turn based match notifications received while the // game is not running. //.WithMatchDelegate(<callback method>) .Build(); PlayGamesPlatform.InitializeInstance(config); // Activate the Google Play Games platform PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); AuthenticateUser(); }
public void Start() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // registers a callback to handle game invitations. .Build(); PlayGamesPlatform.InitializeInstance(config); // recommended for debugging: PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); PlayGamesPlatform.InitializeNearby((client) => { Debug.Log("Nearby connections initialized"); }); Dictionary <string, string> dic = new Dictionary <string, string> { { "EndPoint", PlayGamesPlatform.Nearby.LocalEndpointId() }, { "Name", PlayerPrefs.GetString("myName") }, { "Avatar", PlayerPrefs.GetString("myAvatar") } }; player.Add(dic); }
void Start() { if (platform == null) { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; platform = PlayGamesPlatform.Activate(); Social.Active.localUser.Authenticate(success => { if (success) { Debug.Log("Loggeado"); } else { Debug.Log("Fallido"); } }); } }
public void AuthenticateUser() { mainText.text = "Logging in..."; mainText.color = Color.green; PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); Social.localUser.Authenticate((bool success) => { if (success == true) { GlobalController.currUser = Social.localUser.userName; SceneManager.LoadScene("Scene_MainMenu"); } else { Debug.LogError("Unable to sign in to Google Play Games Services"); mainText.text = "Could not login to Google Play Games Services"; mainText.color = Color.red; } }); }
public void Login() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); if (Social.localUser.authenticated) { return; } Social.localUser.Authenticate((bool success) => { if (success) { print("Удачно вошёл"); } else { print("НЕУдачно вошёл"); } }); }
// ... other code here... public void Start() { EventSystem.current.firstSelectedGameObject = signInButton; // ADD THIS CODE BETWEEN THESE COMMENTS // Create client configuration PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .Build(); // Enable debugging output (recommended) PlayGamesPlatform.DebugLogEnabled = true; // Initialize and activate the platform PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); // END THE CODE TO PASTE INTO START // Try silent sign-in (second parameter is isSilent) PlayGamesPlatform.Instance.Authenticate(SignInCallback, true); }
public void Authenticate() { if (!PlayGamesPlatform.Instance.IsAuthenticated()) { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); PlayGamesPlatform.Instance.Authenticate((bool sucess) => { if (sucess) { ShowMPStatus("Autenticado com sucesso."); } else { ShowMPStatus("Falha na autenticação."); } }); } }
private void Awake() { if (Instance == null) { Instance = this; PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .Build() ; PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; AUTHpROGRESS = "configInit"; PlayGamesPlatform.Activate(); AUTHpROGRESS = "activated"; } else { Destroy(gameObject); } DontDestroyOnLoad(Instance); }
private void Start() { if (platform == null) { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; platform = PlayGamesPlatform.Activate(); } Social.Active.localUser.Authenticate((bool success) => { if (success) { Debug.Log("logged in successfully"); } else { Debug.Log("not loffed in"); } }); }
public void SignIn() { if (PlayGamesPlatform.Instance.IsAuthenticated() == false) { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().WithInvitationDelegate(OnInvitationReceived).Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); PlayGamesPlatform.Instance.Authenticate((bool success) => { if (success) { Debug.Log("Success SignIn"); } else { Debug.Log("fail"); } }); } }
private void Awake() { GameManager.Get(); NetworkManager.Get(); #if UNITY_ANDROID Log.Info("GPGS config"); PlayGamesClientConfiguration config = new PlayGamesClientConfiguration .Builder() .EnableSavedGames() .Build(); Log.Info("GPGS Init"); PlayGamesPlatform.InitializeInstance(config); Log.Info("GPGS Activate"); gpgs = PlayGamesPlatform.Activate(); Log.Info("Auth Start"); gpgs.Authenticate(suc => OnAuthenticate(suc)); #endif versionText.text = $"{Application.version}"; }
//static FirebaseStorage DefaultInstance; private void Awake() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .RequestServerAuthCode(false /* Don't force refresh */) .Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => { var dependencyStatus = task.Result; if (dependencyStatus == Firebase.DependencyStatus.Available) { // Create and hold a reference to your FirebaseApp, // where app is a Firebase.FirebaseApp property of your application class. // app = Firebase.FirebaseApp.DefaultInstance; // Set a flag here to indicate whether Firebase is ready to use by your app. } else { UnityEngine.Debug.LogError(System.String.Format( "Could not resolve all Firebase dependencies: {0}", dependencyStatus)); // Firebase Unity SDK is not safe to use here. } }); // Get a reference to the storage service, using the default Firebase App FirebaseStorage storage = FirebaseStorage.DefaultInstance; Firebase.Storage.StorageReference storage_ref = storage.GetReferenceFromUrl("gs://chasy-legend.appspot.com"); // Create a child reference // images_ref now points to "unlockedCars" Firebase.Storage.StorageReference unlockedCars_ref = storage_ref.Child("unlockedCars"); }
void Start() { GameObject startButton = GameObject.Find("startButton"); EventSystem.current.firstSelectedGameObject = startButton; // ADD Play Game Services init code here. //https://codelabs.developers.google.com/codelabs/playservices_unity/index.html?index=..%2F..%2Findex#6 //튜토리얼의 가이드에 따라 추가된 코드 //클라이언트 설정 생성 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .EnableSavedGames() .Build(); //게임 저장 기능 추가 : .EnableSavedGames() //디버깅 아웃풋 활성화 PlayGamesPlatform.DebugLogEnabled = true; //초기화 및 플랫폼 활성화 PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); // ADD THESE LINES // Get object instances signInButtonText = GameObject.Find("signInButton").GetComponentInChildren <Text>(); authStatus = GameObject.Find("authStatus").GetComponent <Text>(); achButton = GameObject.Find("achButton"); //업적 버튼 변수에 등록되도록 검색 ldrButton = GameObject.Find("ldrButton"); //리더보드 버튼 변수에 등록되도록 검색 //본 스크립트가 시작될때 곧바로 아래 SignIncallback 콜백함수를 이용해 로그인 PlayGamesPlatform.Instance.Authenticate(SignInCallback, true); }
public void GoogleLogin() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // 서버 인증 코드가 생성되도록 요청하여 // 연결된 게임스파크 서버 응용 프로그램과 토큰을 교환합니다. .RequestServerAuthCode(false) // 해당 유저의 이메일 주소를 요청합니다. // 이것이 추가되면 어플리케이션이 처음 실행될 때 동의창이 열립니다. .RequestEmail() .Build(); // 초기화 PlayGamesPlatform.InitializeInstance(config); // 활성화 PlayGamesPlatform.Activate(); Social.localUser.Authenticate(success => { Debug.Log("IsSuccess: " + success); if (!success) { return; } // 로그인이 성공되었습니다. Debug.Log("GetServerAuthCode - " + PlayGamesPlatform.Instance.GetServerAuthCode()); Debug.Log("GetIdToken - " + PlayGamesPlatform.Instance.GetIdToken()); Debug.Log("Email - " + ((PlayGamesLocalUser)Social.localUser).Email); Debug.Log("GoogleId - " + Social.localUser.id); Debug.Log("UserName - " + Social.localUser.userName); Debug.Log("UserName - " + PlayGamesPlatform.Instance.GetUserDisplayName()); GameSparkGoogleLogin(); }); }
public void Init() { Debug.Log("gbros GooglePlayServiceCtrl Init start"); PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() //.EnableSavedGames() .AddOauthScope("profile") // .AddOauthScope("https://www.googleapis.com/auth/games") // .AddOauthScope("https://www.googleapis.com/auth/plus.login") .Build(); // PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // // enables saving game progress. // .EnableSavedGames() // .RequestEmail() // // requests a server auth code be generated so it can be passed to an // // associated back end server application and exchanged for an OAuth token. // .RequestServerAuthCode(false) // // requests an ID token be generated. This OAuth token can be used to // // identify the player to other services such as Firebase. // .RequestIdToken() // .Build(); PlayGamesPlatform.InitializeInstance(config); // recommended for debugging: if (BuildManager.Instance.GetBuildPhase() == BUILD_PHASE.DEV) { PlayGamesPlatform.DebugLogEnabled = true; } // Activate the Google Play Games platform PlayGamesPlatform.Activate(); Debug.Log("gbros GooglePlayServiceCtrl Init end"); }
void Start() { if (platform == null) { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; platform = PlayGamesPlatform.Activate(); } Social.Active.localUser.Authenticate(succes => { if (succes) { isSignedIn = true; } else { isSignedIn = false; } } ); }
public override void Init() { //The following grants profile access to the Google Play Games SDK. //Note: If you also want to capture the player's Google email, be sure to add //.RequestEmail() to the PlayGamesClientConfiguration PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() .AddOauthScope("profile") .RequestServerAuthCode(false) .Build(); PlayGamesPlatform.InitializeInstance(config); // recommended for debugging: PlayGamesPlatform.DebugLogEnabled = true; // Activate the Google Play Games platform PlayGamesPlatform.Activate(); PlayGamesPlatform.Instance.Authenticate(OnAuthenticateCompleted); GameServiceManager.IsInit = true; }
void Start() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); GooglePlayGames.PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); Advertisement.Initialize("NUMBER", true); test.SetActive(false); //EDIT: SignIn(); if (PlayerPrefs.HasKey("record")) { record.text = "Record actual: " + PlayerPrefs.GetInt("record"); Analytics.CustomEvent("Start Play", new Dictionary <string, object> { { "Record", PlayerPrefs.GetInt("record") } }); } else { record.text = "Consigue un record!!"; } }
// Use this for initialization void Start() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // requests the email address of the player be available. // Will bring up a prompt for consent. .RequestEmail() // requests a server auth code be generated so it can be passed to an // associated back end server application and exchanged for an OAuth token. .RequestServerAuthCode(false) // requests an ID token be generated. This OAuth token can be used to // identify the player to other services such as Firebase. .RequestIdToken() .Build(); PlayGamesPlatform.InitializeInstance(config); // recommended for debugging: PlayGamesPlatform.DebugLogEnabled = true; // Activate the Google Play Games platform PlayGamesPlatform.Activate(); GooglePlayLogin(); }