安卓分享
This commit is contained in:
1 parent
6c0d9f5dec
commit
a9e4b1fd34
7 files changed
+184
-6
No files matched your search
@@ -107,9 +107,9 @@ public class WeChatController
|
||||
/// <param name="url">网页链接</param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="description">描述</param>
|
||||
public void ShareWebpageToWX(int scene, string url, string title, string description)
|
||||
public void ShareWebpageToWX(int scene, string url, string title, string description,byte[] image)
|
||||
{
|
||||
mainActivityClass.CallStatic("ShareWebpageToWX", scene, url, title, description);
|
||||
mainActivityClass.CallStatic("ShareWebpageToWX", scene, url, title, description,image);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -178,6 +178,11 @@ public class RouteItem : MonoBehaviour
|
||||
//btnDelete.gameObject.SetActive(false);
|
||||
//btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
UIManager.AddEvent(left.Find("Main/ShareContainer/Wx").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Debug.Log(App.CurrentUser.WebHost);
|
||||
App.weChatController.ShareWebpageToWX(0, "http://192.168.0.101:3081/RoutesRecords/" + result.RankingId, result.RouteName, "By " + App.CurrentUser.Nickname, null);
|
||||
});
|
||||
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Detail());
|
||||
#else
|
||||
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Delete());
|
||||
|
||||
@@ -220,6 +220,9 @@ namespace Assets.Scripts
|
||||
}
|
||||
loading.GetComponent<LoadingPf>().Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool isUpdate(string currentVersion,string realVersion)
|
||||
{
|
||||
var a = currentVersion.Split('.');
|
||||
@@ -310,6 +313,13 @@ namespace Assets.Scripts
|
||||
/*删除父亲节点下的所有孩子*/
|
||||
|
||||
/*显示网络图片*/
|
||||
|
||||
public static void GetImageBytes(string url, Action<byte[]> p)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
return;
|
||||
UIManager.Instance.StartCoroutine(DownloadImageByte(url, p));
|
||||
}
|
||||
public static Dictionary<string, Texture> propTextureCache = new Dictionary<string, Texture>();
|
||||
public delegate Coroutine StartCoroutine(IEnumerator routine);
|
||||
public static void DisplayImage(RawImage img, string url, bool cache = false,Dictionary<string,Texture> caches = null)
|
||||
@@ -374,8 +384,24 @@ namespace Assets.Scripts
|
||||
startCoroutine(DownloadImageCallBack(img, url, action));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static IEnumerator DownloadImageByte(string MediaUrl, Action<byte[]> action = null)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);
|
||||
yield return request.SendWebRequest();
|
||||
if (request.isNetworkError || request.isHttpError)
|
||||
{
|
||||
Debug.Log(request.error);
|
||||
action.Invoke(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (action != null)
|
||||
{
|
||||
action.Invoke(request.downloadHandler.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
static IEnumerator DownloadImage(RawImage img,string MediaUrl, Action<Texture> action = null)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);
|
||||
|
||||
Reference in new issue
Block a user