/// <summary> /// 点击分享按钮 /// </summary> public void OnClickShare() { com.yxixia.utile.YxDebug.YxDebug.Log(" === 点击分享按钮 === "); YxWindowManager.ShowWaitFor(); Facade.Instance <WeChatApi>().InitWechat(); UserController.Instance.GetShareInfo(info => { YxWindowManager.HideWaitFor(); Img.DoScreenShot(new Rect(0, 0, Screen.width, Screen.height), imageUrl => { if (Application.platform == RuntimePlatform.Android) { imageUrl = "file://" + imageUrl; } info.ImageUrl = imageUrl; info.ShareType = ShareType.Image; Facade.Instance <WeChatApi>().ShareContent(info, str => { Dictionary <string, object> parm = new Dictionary <string, object>() { { "option", 2 }, { "bundle_id", Application.bundleIdentifier }, { "share_plat", SharePlat.WxSenceTimeLine.ToString() }, }; Facade.Instance <TwManager>().SendAction("shareAwards", parm, null); }); }); }); }
/// <summary> /// 点击分享战绩按钮,可复用 /// </summary> public void OnClickShare() { YxWindowManager.ShowWaitFor(); Facade.Instance <WeChatApi>().InitWechat(); CompressImg img = GetComponent <CompressImg>() ?? gameObject.AddComponent <CompressImg>(); UserController.Instance.GetShareInfo(info => { YxWindowManager.HideWaitFor(); img.DoScreenShot(new Rect(0, 0, Screen.width, Screen.height), imageUrl => { if (Application.platform == RuntimePlatform.Android) { imageUrl = "file://" + imageUrl; } info.ImageUrl = imageUrl; info.ShareType = ShareType.Image; Facade.Instance <WeChatApi>().ShareContent(info, str => { Dictionary <string, object> parm = new Dictionary <string, object>() { { "option", 2 }, { "bundle_id", Application.bundleIdentifier }, { "share_plat", ChatShareType.ToString() }, }; Facade.Instance <TwManager>().SendAction("shareAwards", parm, null); }); }); }); }
void AddOnClick() { ////添加返回大厅按钮的OnClick事件 _bcakButton.onClick.Add(new EventDelegate(() => { YxMessageBox.Show(new YxMessageBoxData { Msg = "确定要返回大厅吗?", IsTopShow = true, BtnStyle = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle, Listener = (box, btnName) => { if (btnName == YxMessageBox.BtnLeft) { App.QuitGame(); } }, }); } )); //微信邀请 _invitButton.onClick.Add(new EventDelegate(() => { YxTools.ShareFriend(_roomId.ToString(), _ruleInfo); })); //分享战绩 _shareButton.onClick.Add(new EventDelegate(() => { YxWindowManager.ShowWaitFor(); Facade.Instance <WeChatApi>().InitWechat(); UserController.Instance.GetShareInfo(info => { YxWindowManager.HideWaitFor(); _img.DoScreenShot(new Rect(0, 0, Screen.width, Screen.height), imageUrl => { if (Application.platform == RuntimePlatform.Android) { imageUrl = "file://" + imageUrl; } info.ImageUrl = imageUrl; info.ShareType = ShareType.Image; Facade.Instance <WeChatApi>().ShareContent(info); }); }); })); _agreeBtn.onClick.Add(new EventDelegate(() => { App.GetRServer <TexasGameServer>().DismissRoom(3); SetMannerBtn(false); })); _disagreeBtn.onClick.Add(new EventDelegate(() => { App.GetRServer <TexasGameServer>().DismissRoom(-1); SetMannerBtn(false); })); _closeBtn.onClick.Add(new EventDelegate(() => { DismissRoom.transform.GetChild(0).gameObject.SetActive(false); })); }
/// <summary> /// 总战绩截图分享 /// </summary> public void OnshareTtResultScreen() { #if UNITY_ANDROID || UNITY_IPHONE Img.DoScreenShot(new Rect(0, 0, Screen.width, Screen.height), imageUrl => { if (Application.platform == RuntimePlatform.Android) { imageUrl = "file://" + imageUrl; } EventDispatch.Dispatch((int)ShareEventID.OnWeiChatShareGameResult, new EventData(imageUrl)); }); #endif }
/// <summary> /// 点击分享按钮 /// </summary> public void OnClickShare() { if (Img == null) { Img = gameObject.GetComponent <CompressImg>(); } YxWindowManager.ShowWaitFor(); Facade.Instance <WeChatApi>().InitWechat(); UserController.Instance.GetShareInfo(delegate(ShareInfo info) { YxWindowManager.HideWaitFor(); Img.DoScreenShot(new Rect(0, 0, Screen.width, Screen.height), imageUrl => { YxDebug.Log("Url == " + imageUrl); if (Application.platform == RuntimePlatform.Android) { imageUrl = "file://" + imageUrl; } info.ImageUrl = imageUrl; info.ShareType = ShareType.Image; Facade.Instance <WeChatApi>().ShareContent(info, str => { //成功后给奇哥发消息 var parm = new Dictionary <string, object> { { "option", 2 }, { "bundle_id", Application.bundleIdentifier }, { "share_plat", SharePlat.WxSenceTimeLine.ToString() }, }; Facade.Instance <TwManager>().SendAction("shareAwards", parm, null); }); }); }); //YxDebug.Log(" === 点击分享按钮 === "); //YxWindowManager.ShowWaitFor(); //Facade.Instance<WeChatApi>().InitWechat(AppInfo.AppId); //UserController.Instance.GetShareInfo(info => //{ // YxWindowManager.HideWaitFor(); // Img.DoScreenShot(new Rect(0, 0, Screen.width, Screen.height), imageUrl => // { // if (Application.platform == RuntimePlatform.Android) // { // imageUrl = "file://" + imageUrl; // } // info.ImageUrl = imageUrl; // info.ShareType = ShareType.Image; // Facade.Instance<WeChatApi>().ShareContent(info, str => // { // Dictionary<string, object> parm = new Dictionary<string, object>() // { // {"option",2}, // {"bundle_id",Application.bundleIdentifier}, // {"share_plat",SharePlat.WxSenceTimeLine.ToString() }, // }; // Facade.Instance<TwManger>().SendAction("shareAwards", parm, null); // }); // }); //}); }