修改其他的

This commit is contained in:
Caiyanpeng committed 2022-05-31 16:51:07 +08:00
1 parent be687d6b77
commit ff6d61a606
18 files changed
+291 -50

No files matched your search

@@ -1,9 +1,11 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using Facebook.Unity;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
#if UNITY_STANDALONE_WIN
@@ -30,6 +32,9 @@ public class ActivityController : PFUIPanel
#endif
#else
webView = browser.GetComponent<UniWebView>();
webView.Frame = new Rect(0, 0, Screen.width, Screen.height);
webView.ReferenceRectTransform = browser.GetComponent<RectTransform>();
#endif
//webView.Show();
}
@@ -89,10 +94,10 @@ public class ActivityController : PFUIPanel
{
Debug.Log("开始");
// Load a URL.
webView.Frame = new Rect(0, 0, Screen.width, Screen.height);
webView.ReferenceRectTransform = browser.GetComponent<RectTransform>();
webView.Hide();
webView.SetUserAgent($"UniWebView {Application.platform} {Application.version}");
webView.BackgroundColor = Utils.HexToColorHtml("#23232d");
//webView.CleanCache();
if (action == null)
{
webView.Load(url);
@@ -113,6 +118,7 @@ public class ActivityController : PFUIPanel
case "Close": CloseFunc(); break;
case "StartRide": StartRide(int.Parse(message.Args["id"]),message.Args.ContainsKey("routeResult")?message.Args["routeResult"]:null); break;
case "Share": Share(int.Parse(message.Args["type"]),int.Parse(message.Args["id"])); break;
case "ShareRower": ShareRower(int.Parse(message.Args["type"]), message.Args["url"], message.Args["title"]); break;
case "OpenUrl": OpenUrl(message.Args["url"]); break;
default:break;
}
@@ -148,6 +154,33 @@ public class ActivityController : PFUIPanel
}
}
/// <summary>
///
/// </summary>
/// <param name="sharetype">0 1</param>
/// <param name="id">记录id</param>
/// <param name="type">rower ride</param>
private void ShareRower(int type, string url, string title)
{
if (type < 2)
{
if (App.weChatController.IsWeChatAppInstalled())
{
App.weChatController.ShareWebpageToWX(type, url, title, "By " + App.CurrentUser.Nickname, null);
RunJavaScript("window.postMessage(\"webview;Endshare\")");
}
else
{
Utils.showToast(null, "未安装微信");
}
}
else
{
FB.ShareLink(contentURL: new Uri(url),
contentTitle: title,
contentDescription: $"By {App.CurrentUser.Nickname}");
}
}
private void StartRide(int id,string routeResult)
{
App.RouteIdParam = id;
@@ -162,6 +195,9 @@ public class ActivityController : PFUIPanel
{
CancelInvoke("StartPageFunc");
Close();
webView.LoadHTMLString("<div style=\"background:#23232d\" />", this.url);
//Destroy(gameObject);
//UIManager.Instance.mActivityController = null;
}
private void RunJavaScript(string js)