private void ShowSharingDialog(Action callback = null) { GenerateShareIntent(); var intentToShare = MakeSharingIntent(); //let's see if we have a package name set if (!string.IsNullOrEmpty(m_packageName)) { //Let's check if app with this package actually exists var pm = AN_MainActivity.Instance.GetPackageManager(); var info = pm.GetPackageInfo(m_packageName, AN_PackageManager.GET_ACTIVITIES); if (info == null) { //there is no requested app installed. if (callback != null) { callback.Invoke(); } return; } } m_proxyActivity = new AN_ProxyActivity(); m_proxyActivity.StartActivityForResult(intentToShare, (result) => { if (callback != null) { callback.Invoke(); } }); }
private void Mail2() { SA_ScreenUtil.TakeScreenshot((screenshot) => { AN_Intent sendIntent = new AN_Intent(); sendIntent.SetAction(AN_Intent.ACTION_SEND_MULTIPLE); sendIntent.PutExtra(AN_Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.SetType(AN_MIMEDataType.Image); sendIntent.PutExtra(AN_Intent.EXTRA_EMAIL, "*****@*****.**", "*****@*****.**"); sendIntent.PutExtra(AN_Intent.EXTRA_TEXT, "EXTRA_TEXT2"); sendIntent.PutExtra(AN_Intent.EXTRA_SUBJECT, "EXTRA_SUBJECT2s"); var list = new List <Texture2D>() { screenshot, screenshot }; sendIntent.PutExtra(AN_Intent.EXTRA_STREAM, list.ToArray()); AN_Intent chooser = AN_Intent.CreateChooser(sendIntent, "My chooser title"); AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(chooser, (result) => { Debug.Log("Unity: Activity Result: " + result.ResultCode.ToString()); proxy.Finish(); }); }); }
private IEnumerator ShowLeaderboards() { bool signInCancelled = false; if (!CheckGPlayReady()) //if GPlay not signed in { var isGPlaySignedIn = GPlayLoginHelper.Instance.IsSignedIn(); Debug.Log("GPlay not signed in. Requesting sign in..."); GPlayLoginHelper.Instance.SignInRequest((isSignedIn, statusCode) => { if (isSignedIn && statusCode == AN_CommonStatusCodes.SUCCESS) { isGPlaySignedIn = true; Initialization(); //initializing, after sign in } else { signInCancelled = true; } }, true); if (signInCancelled) { yield break; } yield return(new WaitUntil(() => isGPlaySignedIn)); //wait till GPlay gets sign in } _leaderBoardsClient.GetAllLeaderboardsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; var proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); }); Debug.Log("Showing Default Leaderboard UI"); } else { Debug.Log("Failed to get leader boards intent :: " + result.Error.FullMessage); } }); yield return(true); }
public void ShowUI() { var client = AN_Games.GetAchievementsClient(); client.GetAchievementsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); }); } else { Debug.LogError("Failed to Get Achievements Intent " + result.Error.FullMessage); } }); }
public void ShowUI(Action <SA_Result> callback) { var client = AN_Games.GetLeaderboardsClient(); client.GetAllLeaderboardsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); callback.Invoke(intentResult); }); } else { callback.Invoke(result); } }); }
public override void Test() { var client = AN_Games.GetAchievementsClient(); client.GetAchievementsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); SetResult(SA_TestResult.OK); }); } else { SetAPIResult(result); } }); }
public void showLeaderBoards() { var leaderboards = AN_Games.GetLeaderboardsClient(); leaderboards.GetAllLeaderboardsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); //Note: you might want to check is user had sigend out with that UI }); } else { Debug.Log("Failed to Get leaderboards Intent " + result.Error.FullMessage); } }); }
public void showArchievements() { var client = AN_Games.GetAchievementsClient(); client.GetAchievementsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); //TODO you might want to check is user had sigend out with that UI }); } else { Debug.Log("Failed to Get Achievements Intent " + result.Error.FullMessage); } }); }
public override void Test() { var client = AN_Games.GetLeaderboardsClient(); client.GetAllLeaderboardsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); //Note: you might want to check is user had sigend out with that UI SetResult(SA_TestResult.OK); }); } else { SetAPIResult(result); } }); }
private void Mail() { AN_Intent sendIntent = new AN_Intent(); sendIntent.SetAction(AN_Intent.ACTION_SEND); sendIntent.PutExtra(AN_Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.SetType("text/plain"); sendIntent.SetAction(AN_MIMEDataType.Image); sendIntent.PutExtra(AN_Intent.EXTRA_EMAIL, "*****@*****.**", "*****@*****.**"); sendIntent.PutExtra(AN_Intent.EXTRA_TEXT, "EXTRA_TEXT2"); sendIntent.PutExtra(AN_Intent.EXTRA_SUBJECT, "EXTRA_SUBJECT2s"); AN_Intent chooser = AN_Intent.CreateChooser(sendIntent, "My chooser title"); AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(chooser, (result) => { Debug.Log("Unity: Activity Result: " + result.ResultCode.ToString()); proxy.Finish(); }); }
public void ShowUI(string leaderboardId, UM_LeaderboardTimeSpan timeSpan, Action <SA_Result> callback) { var span = ToAndroidSpan(timeSpan); var client = AN_Games.GetLeaderboardsClient(); client.GetLeaderboardIntent(leaderboardId, span, result => { if (result.IsSucceeded) { var intent = result.Intent; var proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, intentResult => { proxy.Finish(); callback.Invoke(intentResult); }); } else { callback.Invoke(result); } }); }
public void ShowUI(string leaderboardId, UM_LeaderboardTimeSpan timeSpan, Action <SA_Result> callback) { AN_Leaderboard.TimeSpan span = AN_Leaderboard.TimeSpan.AllTime; switch (timeSpan) { case UM_LeaderboardTimeSpan.AllTime: span = AN_Leaderboard.TimeSpan.AllTime; break; case UM_LeaderboardTimeSpan.Daily: span = AN_Leaderboard.TimeSpan.Daily; break; case UM_LeaderboardTimeSpan.Weekly: span = AN_Leaderboard.TimeSpan.Weekly; break; } var client = AN_Games.GetLeaderboardsClient(); client.GetLeaderboardIntent(leaderboardId, span, (result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); callback.Invoke(intentResult); }); } else { callback.Invoke(result); } }); }
private void Start() { m_loadScores.onClick.AddListener(() => { var leaderboards = AN_Games.GetLeaderboardsClient(); int maxResults = 20; leaderboards.LoadTopScores(leaderboardsId, maxResults, (result) => { if (result.IsSucceeded) { var scores = result.Data; var buffer = scores.Scores; AN_Logger.Log("scores.Leaderboard.DisplayName: " + scores.Leaderboard.DisplayName); AN_Logger.Log("Loaded scores Count: " + buffer.Scores.Count); foreach (var score in buffer.Scores) { AN_Logger.Log("score.DisplayRank: " + score.DisplayRank); AN_Logger.Log("score.DisplayScore: " + score.DisplayScore); AN_Logger.Log("score.Rank: " + score.Rank); AN_Logger.Log("score.RawScore: " + score.RawScore); AN_Logger.Log("score.ScoreHolder: " + score.ScoreHolder); AN_Logger.Log("score.ScoreHolderDisplayName: " + score.ScoreHolderDisplayName); AN_Logger.Log("score.ScoreHolderIconImageUri: " + score.ScoreHolderIconImageUri); AN_Logger.Log("score.ScoreHolderHiResImageUri: " + score.ScoreHolderHiResImageUri); AN_Logger.Log("score.ScoreTag: " + score.ScoreTag); AN_Logger.Log("score.TimestampMillis: " + score.TimestampMillis); AN_Logger.Log("------------------------------------------------"); } } else { AN_Logger.Log("Failed to Load Top Scores " + result.Error.FullMessage); } }); }); m_sbmitNoCB.onClick.AddListener(() => { var leaderboards = AN_Games.GetLeaderboardsClient(); leaderboards.SubmitScore(leaderboardsId, 250); }); m_sbmit.onClick.AddListener(() => { var leaderboards = AN_Games.GetLeaderboardsClient(); leaderboards.SubmitScoreImmediate(leaderboardsId, 200, "Tag", (result) => { if (result.IsSucceeded) { var scoreSubmissionData = result.Data; AN_Logger.Log("SubmitScoreImmediate completed"); AN_Logger.Log("scoreSubmissionData.PlayerId: " + scoreSubmissionData.PlayerId); AN_Logger.Log("scoreSubmissionData.PlayerId: " + scoreSubmissionData.LeaderboardId); foreach (AN_Leaderboard.TimeSpan span in (AN_Leaderboard.TimeSpan[])System.Enum.GetValues(typeof(AN_Leaderboard.TimeSpan))) { var scoreSubmissionResult = scoreSubmissionData.GetScoreResult(span); AN_Logger.Log("scoreSubmissionData.FormattedScore: " + scoreSubmissionResult.FormattedScore); AN_Logger.Log("scoreSubmissionData.NewBest: " + scoreSubmissionResult.NewBest); AN_Logger.Log("scoreSubmissionData.RawScore: " + scoreSubmissionResult.RawScore); AN_Logger.Log("scoreSubmissionData.ScoreTag: " + scoreSubmissionResult.ScoreTag); } } else { AN_Logger.Log("Failed to Submit Score Immediate " + result.Error.FullMessage); } }); }); m_nativeUI.onClick.AddListener(() => { var leaderboards = AN_Games.GetLeaderboardsClient(); leaderboards.GetAllLeaderboardsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); //TODO you might want to check is user had sigend out with that UI }); } else { Debug.Log("Failed to Get leaderboards Intent " + result.Error.FullMessage); } }); }); m_loadOneLeaberboard.onClick.AddListener(() => { var leaderboards = AN_Games.GetLeaderboardsClient(); leaderboards.LoadLeaderboardMetadata(leaderboardsId, true, (result) => { if (result.IsSucceeded) { PrintLeaderboardsInfo(new List <AN_Leaderboard>() { result.Leaderboard }); } else { AN_Logger.Log("Load Leaderboard Failed: " + result.Error.FullMessage); } }); }); m_loadLeaberboards.onClick.AddListener(() => { var leaderboards = AN_Games.GetLeaderboardsClient(); leaderboards.LoadLeaderboardMetadata(false, (result) => { if (result.IsSucceeded) { AN_Logger.Log("Load Leaderboards Metadata Succeeded, count: " + result.Leaderboards.Count); PrintLeaderboardsInfo(result.Leaderboards); } else { AN_Logger.Log("Load Leaderboards Failed: " + result.Error.FullMessage); } }); }); }
private void Start() { m_nativeUI.onClick.AddListener(() => { var client = AN_Games.GetAchievementsClient(); client.GetAchievementsIntent((result) => { if (result.IsSucceeded) { var intent = result.Intent; AN_ProxyActivity proxy = new AN_ProxyActivity(); proxy.StartActivityForResult(intent, (intentResult) => { proxy.Finish(); //TODO you might want to check is user had sigend out with that UI }); } else { Debug.Log("Failed to Get Achievements Intent " + result.Error.FullMessage); } }); }); m_load.onClick.AddListener(() => { var client = AN_Games.GetAchievementsClient(); client.Load(false, (result) => { if (result.IsSucceeded) { AN_Logger.Log("Load Achievements Succeeded, count: " + result.Achievements.Count); foreach (var achievement in result.Achievements) { AN_Logger.Log("------------------------------------------------"); AN_Logger.Log("achievement.AchievementId: " + achievement.AchievementId); AN_Logger.Log("achievement.Description: " + achievement.Description); AN_Logger.Log("achievement.Name: " + achievement.Name); AN_Logger.Log("achievement.UnlockedImageUri: " + achievement.UnlockedImageUri); AN_Logger.Log("achievement.CurrentSteps: " + achievement.CurrentSteps); AN_Logger.Log("achievement.TotalSteps: " + achievement.TotalSteps); AN_Logger.Log("achievement.Type: " + achievement.Type); AN_Logger.Log("achievement.Sate: " + achievement.State); } AN_Logger.Log("------------------------------------------------"); } else { Debug.Log("Load Achievements Failed: " + result.Error.FullMessage); } foreach (var achievement in result.Achievements) { if (achievement.Type == AN_Achievement.AchievementType.INCREMENTAL) { client.Increment(achievement.AchievementId, 1); continue; } if (achievement.State == AN_Achievement.AchievementState.HIDDEN) { client.Reveal(achievement.AchievementId); continue; } if (achievement.State != AN_Achievement.AchievementState.UNLOCKED) { client.Unlock(achievement.AchievementId); } } }); }); }