private IEnumerator PostResults_Coroutine(bool facebook, RoundFinalResult result) { // hide "social networks" widgets (will be hidden on posted screen-shots)... GUIBase_Widget socNetsRoot = Layout.GetWidget("SocialNetworks", true); socNetsRoot.ShowImmediate(false, true); // take & post screen-shot (with message)... yield return(new WaitForEndOfFrame()); int idx; int textIndex = result.Place; #if (FB_LOGIN_REVIEW) textIndex = 1; #endif if (result.GameType == E_MPGameType.DeathMatch) { idx = TextID_RankingsDM[textIndex]; } else { idx = TextID_RankingsZC[textIndex]; } string name = CloudUser.instance.primaryKey; if (FacebookPlugin.Instance.CurrentUser != null && !string.IsNullOrEmpty(FacebookPlugin.Instance.CurrentUser.Name)) { name = FacebookPlugin.Instance.CurrentUser.Name; } if (facebook == true) { byte[] screenshot = takeScreenshot(); if (screenshot != null) { yield return(StartCoroutine(FacebookPlugin.Instance.Init())); string requestedScope = "publish_actions"; if (FacebookPlugin.Instance.IsLoggedIn() == false || FacebookPlugin.Instance.HasPermittedScope(requestedScope) == false) { yield return(StartCoroutine(FacebookPlugin.Instance.Login(requestedScope))); } if (FacebookPlugin.Instance.IsLoggedIn() == true && FacebookPlugin.Instance.HasPermittedScope(requestedScope) == true) { yield return(StartCoroutine(FacebookPlugin.Instance.PostImage(string.Empty, screenshot))); } } else { Debug.LogWarning("Could not capture screenshot!"); } } else { #if (UNITY_ANDROID || UNITY_IPHONE) string msg = string.Format(TextDatabase.instance[idx], name, result.MapName); TwitterUtils.PostScreenshot(msg, OnPostResult); #endif } // show "social networks" widgets again... yield return(new WaitForSeconds(1.0f)); #if (UNITY_ANDROID || UNITY_IPHONE) socNetsRoot.ShowImmediate(Layout.Visible, true); #endif }