public IEnumerator _Share() { string imgPath = Application.persistentDataPath + "/image.png";///image.pngという名前で保存 // 前回のデータを削除 File.Delete(imgPath); //スクリーンショットを撮影 ScreenCapture.CaptureScreenshot("image.png"); // 撮影画像の保存が完了するまで待機 while (true) { if (File.Exists(imgPath)) { break; } yield return(null); } // 投稿する string tweetText = "今回のスコアはこれ!"; string tweetURL = "";//後々サイト作ったら入れる SocialConnector.Share(tweetText, tweetURL, imgPath); }
public void PushSocial() { Debug.Log("social"); string text = "【高校入試に出る英単語】\n iPhone : https://apple.co/2X5ieUx \n Android : https://bit.ly/2y4A0P0 \n #HorryApps"; string url = ""; string path = Application.streamingAssetsPath + "/SNS.png"; SocialConnector.Share(text, url, path); }
/// <summary> /// SNS連携先を表示 /// </summary> /// <param name="scene">Scene.</param> IEnumerator Share(string scene) { //スクリーンショットをとる Application.CaptureScreenshot("image.png"); //スクリーンショットが保存されるまで待機 long filesize = 0; float time = 0f; while (filesize == 0) { yield return(null); //ファイルのサイズを取得 System.IO.FileInfo fi = new System.IO.FileInfo(imagePath); if (fi != null) { filesize = fi.Length; } } //SNS表示テキスト if (scene == "Title") { //ハイスコアを表示 if (PlayerPrefs.GetFloat("HighScore") > 0.0f) { score = PlayerPrefs.GetFloat("HighScore"); } else { score = 0; } } else if (scene == "GameOver") { //ゲーム中のスコアを表示 score = gameController.GetScore(); } text = "FlappyRealFishで、スコア:" + score.ToString("F1") + "m を達成しました!"; //プラットフォームごとにアプリURLを設定 if (Application.platform == RuntimePlatform.Android) { URL = "https://play.google.com/store/apps/details?id=jp.co.orienst.flappy_real_fish"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { URL = "https://itunes.apple.com/jp/app/flappyrealfish/id1258427395?mt=8&ign-mpt=uo%3D4"; } else { URL = "OtherURL"; } //social-connectorから共有 SocialConnector.Share(text, URL, imagePath); }
// シェア処理 private IEnumerator Share() { // 画面をキャプチャ Application.CaptureScreenshot("screenShot.png"); // キャプチャを保存するので1フレーム待つ yield return(new WaitForEndOfFrame()); // シェアテキスト設定 string text = "アグレッシヴ節分ゲーム【GET!OUT!!OGRE!!!】\n今の最高点は" + PlayerPrefs.GetInt("highscore", 0) + "点\n #GetOutOgre "; string url = "https://shadowmunderbar.jimdo.com/"; // キャプチャの保存先を指定 string texture_url = Application.persistentDataPath + "/screenShot.png"; // iOS側の処理を呼び出す SocialConnector.Share(text, url, texture_url); }
void OnGUI() { if (GUILayout.Button("<size=30><b>Take</b></size>", GUILayout.Height(60))) { Application.CaptureScreenshot("image.png"); } GUILayout.Space(60); ///================= /// Share ///================= if (GUILayout.Button("<size=30><b>Share</b></size>", GUILayout.Height(60))) { SocialConnector.Share("Social Connector", "https://github.com/anchan828/social-connector", null); } if (GUILayout.Button("<size=30><b>Share Image</b></size>", GUILayout.Height(60))) { SocialConnector.Share("Social Connector", "https://github.com/anchan828/social-connector", imagePath); } }
// Token: 0x060001FB RID: 507 RVA: 0x00006BAC File Offset: 0x00004FAC public static void Share(string text, string url, string textureUrl) { SocialConnector._Share(text, url, textureUrl); }
// Token: 0x060001FA RID: 506 RVA: 0x00006BA2 File Offset: 0x00004FA2 public static void Share(string text, string url) { SocialConnector.Share(text, url, null); }