修改其他的

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)
+39 -6
View File
@@ -92,6 +92,15 @@ public class NewMainNav : MonoBehaviour
/// <param name="flag"></param>
public void SetExpand(bool flag)
{
if (flag)
{
autoClose = true;
}
else
{
autoClose = false;
}
closeTime = 5f;
List<string> types = new List<string>();
if (indexs != null)
{
@@ -172,7 +181,14 @@ public class NewMainNav : MonoBehaviour
Utils.DisplayHead(transform.Find("Avatar").GetComponent<Image>(), App.CurrentUser.WxHeadImg);
UIManager.AddEvent(transform.Find("Avatar").gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
if (App.IsRowerMode == true)
{
UIManager.ShowEditUserPanel();
}
else
{
UIManager.ShowUserInfoPanel();
}
});
UIManager.AddEvent(transform.Find("PF").gameObject, EventTriggerType.PointerClick, b =>
{
@@ -294,18 +310,25 @@ public class NewMainNav : MonoBehaviour
}
bool isTouch = false;
float hideTime = 5;
bool autoClose = false;
float closeTime = 5;
// Update is called once per frame
void Update()
{
if (Input.touchCount > 0)
if (Input.touchCount > 0)
{
isTouch = true;
if (autoClose)
{
closeTime = 5f;
}
GetComponent<CanvasGroup>().DOFade(1, 0.5f);
}
hideTime -= Time.deltaTime;
if (hideTime < 0)
if (hideTime < 0)
{
if (!isTouch)
if (!isTouch)
{
GetComponent<CanvasGroup>().DOFade(0.4f, 0.5f);
}
@@ -317,16 +340,26 @@ public class NewMainNav : MonoBehaviour
{
Debug.Log("小时");
delayTime = 0;
transform.Find("Delay/Tooltips").GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = ()=>
transform.Find("Delay/Tooltips").GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
{
transform.Find("Delay/Tooltips").gameObject.SetActive(false);
};
}
else if(delayTime > 0)
else if (delayTime > 0)
{
Debug.Log(delayTime);
delayTime -= Time.deltaTime;
}
closeTime -= Time.deltaTime;
if (closeTime < 0)
{
if (autoClose)
{
Debug.Log("关一次");
SetExpand(false);
}
}
}
}
@@ -229,8 +229,13 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect
{"ContactPhone",mPhone.GetComponent<InputField>() },
{"ContactAddress",mAddr.GetComponent<InputField>() },
};
#region 划船机功能:隐藏骑行相关的
if (App.IsRowerMode == true)
{
transform.Find("Panel/MainPanel/BW").gameObject.SetActive(false);
transform.Find("Panel/MainPanel/WD").gameObject.SetActive(false);
}
#endregion
}
async Task Login()
{
@@ -117,7 +117,7 @@ public class RowerHomeScript : PFUIPanel
}
protected override void Awake()
{
rowerType = new RowerType();
rowerType = new RowerType() { type=1,value=500};
spriteDict = new Dictionary<object, Sprite>()
{
{"Start",Resources.Load<Sprite>("Images/RowerNew/ICON_continue_44") },
@@ -215,7 +215,8 @@ public class RowerHomeScript : PFUIPanel
{
//UIManager.ShowRowerWelldone("33171855-66FC-4121-935C-0F4DA98E5BB2", Init);
//return;
//UIManager.ShowRowerWelldone("1915400E-A6E5-4FB7-B371-7240BEA20A54", Init);
//UIManager.ShowRowerWelldone("C0F81E83-120B-4A2C-AD0E-8BC1B8EB3E74", Init);
//return;
if (checkRowing()) return;
if (C2RowerData.IsEnabled == true && C2RowerData.rowerType != null) return;
@@ -225,13 +226,17 @@ public class RowerHomeScript : PFUIPanel
HandleSelectType();
},rowerType);
}, false);
btnStart = transform.Find("MainNav-mobile/Custom2").gameObject;
var c3 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_mode_44"), () =>
var c2 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/记录"), () =>
{
ReturnHome();
UIManager.ShowResultListPanel();
}, false);
btnStart = transform.Find("MainNav-mobile/Custom2").gameObject;
//var c3 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_mode_44"), () =>
//{
// ReturnHome();
//}, false);
//隐藏骑行
nav.SetButtonActive(new List<int> { 3, 7 }, null, c1, null, null, false);
nav.SetButtonActive(new List<int> { 3, 7 }, null, c1, null, c2, false);
newNav = nav;
#endif
UIManager.AddEvent(transform.Find("Stopped/Confirm/BtnSave").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
@@ -250,6 +255,8 @@ public class RowerHomeScript : PFUIPanel
RowerData.StartEvent -= StartFunc;
RowerData.StartEvent += StartFunc;
}
rowerType = new RowerType { type = 1, value = 500 };
HandleSelectType();
Init();
}
@@ -629,12 +636,10 @@ public class RowerHomeScript : PFUIPanel
private void ResChanged(object sender, EventArgs e)
{
print("收到阻力" + sender);
if ((Convert.ToSingle(sender) >= 50) && slider)
{
slider.GetComponent<PFUISlider>().SetValue((Convert.ToSingle(sender) - 50) / 300f);
}
}
@@ -119,6 +119,19 @@ public class ResultListController : PFUIPanel
#if UNITY_ANDROID || UNITY_IOS
GetList(2);
#endif
#region 划船机功能:隐藏骑行记录
#if UNITY_ANDROID || UNITY_IOS
btnRower.transform.localPosition = new Vector3(btnRower.transform.localPosition.x, btnRoute.transform.localPosition.y, btnRower.transform.localPosition.z);
btnRoute.gameObject.SetActive(false);
btnMatch.gameObject.SetActive(false);
transform.Find("ListPanel/Line").gameObject.SetActive(false);
transform.Find("ListPanel/Line2").gameObject.SetActive(false);
StartScroll(2);
//scrollContent.localPosition = new Vector3(674 * -2, scrollContent.localPosition.y, scrollContent.localPosition.z);//.DOLocalMoveX(674 * index * -1, 0.3f);
//btnRower.GetComponent<Text>().color = Utils.HexToColor("#ffffff");
#endif
#endregion
}
public void Load()
@@ -177,6 +190,7 @@ public class ResultListController : PFUIPanel
Load();
StartScroll(1);
}
}
Dictionary<int, bool> isEnd = new Dictionary<int, bool>
{
@@ -129,7 +129,13 @@ public class RouteItem : MonoBehaviour
{
UIManager.AddEvent(btnDetail.gameObject, EventTriggerType.PointerClick, b =>
{
//UIManager.ShowActivityPanel("http://192.168.0.101:3081/rower/record/27C0BE5C-3818-45D0-A2FD-681AC2ACFB64?UserId=16650");
#if UNITY_ANDROID || UNITY_IOS
UIManager.ShowActivityPanel($"{App.websiteDict[App.Host]}rower/record/{result.Id}?UserId={App.CurrentUser.Id}");
#else
Application.OpenURL($"{App.websiteDict[App.Host]}rower/record/{result.Id}?Token={App.CurrentUser.cookie}");
#endif
//Application.OpenURL($"{App.websiteDict[App.Host]}rower/record/{result.Id}?Token={App.CurrentUser.cookie}");
//UIManager.ShowRowerResult(result.Id);
});
}
@@ -40,18 +40,22 @@ public class RowerWelldone : PFUIPanel
UIManager.AddEvent(transform.Find("Container/BtnView").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
CloseModal();
#if UNITY_ANDROID || UNITY_IOS
UIManager.ShowActivityPanel($"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}");
#else
Application.OpenURL($"{App.websiteDict[App.Host]}rower/record/{id}?Token={App.CurrentUser.cookie}");
#endif
});
UIManager.AddEvent(transform.Find("Container/Share/Wx").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
if (data == null) return;
App.weChatController.ShareWebpageToWX(0, $"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}", $"PowerFun {data.info.TypeStr} Rowing", $"By {App.CurrentUser.Nickname}",null);
App.weChatController.ShareWebpageToWX(0, $"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}", $"我在{data.info.TypeStr}的划船比赛中获得第{data.info.MyRankLeft}名!赶紧来一起划船吧!", $"By {App.CurrentUser.Nickname}", null);
});
UIManager.AddEvent(transform.Find("Container/Share/WxMoment").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
if (data == null) return;
App.weChatController.ShareWebpageToWX(1, $"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}", $"PowerFun {data.info.TypeStr} Rowing", $"By {App.CurrentUser.Nickname}", null);
App.weChatController.ShareWebpageToWX(1, $"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}", $"我在{data.info.TypeStr}的划船比赛中获得第{data.info.MyRankLeft}名!赶紧来一起划船吧!", $"By {App.CurrentUser.Nickname}", null);
});
UIManager.AddEvent(transform.Find("Container/Share/Fb").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
@@ -117,7 +121,7 @@ public class RowerWelldone : PFUIPanel
{
var item = data.ranks[i];
var game = Instantiate<GameObject>(Rank);
game.transform.Find("Content/Rank").GetComponent<Text>().text = (i + 1).ToString("00");
game.transform.Find("Content/Rank").GetComponent<Text>().text = item.rankNum.ToString("00");
game.transform.Find("Content/NickName").GetComponent<Text>().text = item.NickName;
Utils.DisplayImageTempDict(game.transform.Find("Content/Avatar").GetComponent<RawImage>(), item.WxHeadImg, caches);
game.transform.Find("Content/Time").GetComponent<Text>().text = data.info.Type == 1 ? TimeSpan.FromSeconds(item.Ticks).ToString(@"hh\:mm\:ss") : item.TotalDistance.ToString("#0M");