// ------------------------------------------------------------------ // make an initial connection to game center public static bool ConnectToGameCenter() { if (CoreXT.IsDevice) { SocialXT.PostCompleted += OnPostCompleted; GameKitXT.LocalPlayerAuthenticated += OnLocalPlayerAuthenticated; GameKitXT.LocalPlayerAuthenticationFailed += OnLocalPlayerAuthenticationFailed; GameKitXT.AuthenticateLocalPlayer(); // if SL Requests cannot be made on the device, turn off the social buttons for this user if (U3DXT.iOS.Native.Social.SLRequest.ClassExists == false) { return(false); } else { return(true); } } else { return(false); } }
void Start() { if (CoreXT.IsDevice) { // subscribe to events GameKitXT.LocalPlayerAuthenticated += OnLocalPlayerAuthenticated; GameKitXT.LocalPlayerAuthenticationFailed += LocalPlayerAuthenticationFailed; GameKitXT.ScoreReported += OnScoreReported; GameKitXT.ScoreReportFailed += OnScoreReportFailed; GameKitXT.AchievementReported += OnAchievementReported; GameKitXT.AchievementReportFailed += OnAchievementReportFailed; // finally authenticate player GameKitXT.AuthenticateLocalPlayer(); } }
//private string leaderboardID = "CgkItsLusNkLEAIQAg"; #endif public void GameCenterConection() { #if UNITY_IOS && !UNITY_EDITOR if (CoreXT.IsDevice) { GameKitXT.LocalPlayerAuthenticated += delegate(object sender, EventArgs e) { PlayerData.playername = GameKitXT.localPlayer.alias; }; GameKitXT.LocalPlayerAuthenticationFailed += delegate(object sender, U3DXTErrorEventArgs e) { }; GameKitXT.AuthenticateLocalPlayer(); } #endif #if UNITY_ANDROID && !UNITY_EDITOR /*GooglePlayGames.PlayGamesPlatform.Activate(); * Debug.Log("Activate"); * GooglePlayGames.OurUtils.Logger.DebugLogEnabled=true; * * * * if (!Social.localUser.authenticated) { * // Authenticate * Debug.Log("Authenticating"); * * Social.localUser.Authenticate((bool success) => { * //GameObject.Find ("TESTE").transform.GetChild(0).GetComponent<Text>().text="After Authenticate"; * if (success) { * //GameObject.Find ("TESTE").transform.GetChild(0).GetComponent<Text>().text="Auth SUCCESS"; * Debug.Log("Authentication successful"); * } * else * { * //GameObject.Find ("TESTE").transform.GetChild(0).GetComponent<Text>().text="Auth Failed"; * Debug.Log("Authentication failed"); * } * }); * }*/ #endif }
void Start() { // only do it on device if (CoreXT.IsDevice) { // subscribe to events GameKitXT.LocalPlayerAuthenticated += OnLocalPlayerAuthenticated; GameKitXT.LocalPlayerAuthenticationFailed += LocalPlayerAuthenticationFailed; // init real time multiplayer events and controller RealTimeMatchesController.MatchMakerCancelled += OnMatchMakerCancelled; RealTimeMatchesController.MatchMakerFailed += OnMatchMakerFailed; RealTimeMatchesController.MatchMakerFoundMatch += OnMatchMakerFoundMatch; RealTimeMatchesController.InviteAccepted += OnInviteAccepted; RealTimeMatchesController.PlayersInvited += OnPlayersInvited; RealTimeMatchesController.Init(); // finally authenticate player GameKitXT.AuthenticateLocalPlayer(); } }