Merge branch 'dev_cyp' into dev_ar_cyp

# Conflicts:
#	Assets/Resources/UI/Font/HanWangZonYi.ttf.meta
#	Assets/Resources/UI/language.json
#	Assets/Scenes/Login.unity
#	Assets/Scripts/Apis/Models/MapRoute.cs
#	Assets/Scripts/App.cs
#	Assets/Scripts/ConfigHelper.cs
#	Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs
#	Assets/Scripts/UIManager.cs
#	Assets/Scripts/Utils/Utils.cs
This commit is contained in:
lishuo committed 2022-06-02 11:30:37 +08:00
commit e513eeac5c
301 files changed
+49814 -11770

No files matched your search

+38 -23
View File
@@ -30,13 +30,17 @@ namespace Assets.Scripts.UI.Control
}
string placeHolderText;
public Action CustomSelect = null, CustomDeSelect = null,CustomEnter = null;
public void OnSelect(BaseEventData eventData)
{
if (this.gameObject.activeInHierarchy == false)
{
return;
}
if (CustomSelect != null)
{
CustomSelect.Invoke();
}
isSelected = true;
//throw new NotImplementedException();
this.mInnerInputField.OnSelect(eventData);
@@ -63,7 +67,10 @@ namespace Assets.Scripts.UI.Control
{
return;
}
if (CustomDeSelect != null)
{
CustomDeSelect.Invoke();
}
isSelected = false;
this.mInnerInputField.OnDeselect(eventData);
transform.Find("Placeholder").GetComponent<Text>().text = App.GetLocalString(placeHolderText);
@@ -72,7 +79,33 @@ namespace Assets.Scripts.UI.Control
//image.sprite = png1;
outline.enabled = false;
}
void OnEnter(BaseEventData eventData)
{
if (isSelected)
{
return;
}
if (CustomEnter != null)
{
CustomEnter.Invoke();
}
outline.enabled = true;
ColorUtility.TryParseHtmlString("#6E6E7D", out Color color);
outline.effectColor = color;
}
private void OnExit(BaseEventData eventData)
{
if (isSelected)
{
return;
}
if (CustomDeSelect != null)
{
CustomDeSelect.Invoke();
}
//outline = this.gameObject.AddComponent<Outline>();
outline.enabled = false;
}
void Awake()
{
Material material = null;
@@ -95,26 +128,8 @@ namespace Assets.Scripts.UI.Control
//UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>(this.OnSelect));
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>(this.OnSelect));
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>(this.OnDeselect));
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerEnter, new UnityAction<BaseEventData>((e) =>
{
if (isSelected)
{
return;
}
outline.enabled = true;
ColorUtility.TryParseHtmlString("#6E6E7D", out Color color);
outline.effectColor = color;
}));
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerExit, new UnityAction<BaseEventData>(e =>
{
if (isSelected)
{
return;
}
//outline = this.gameObject.AddComponent<Outline>();
outline.enabled = false;
}));
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerEnter, new UnityAction<BaseEventData>(this.OnEnter));
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerExit, new UnityAction<BaseEventData>(OnExit));
placeHolderText = transform.Find("Placeholder").GetComponent<Text>().text;
}
+70 -3
View File
@@ -1,22 +1,89 @@
using System.Collections;
using Assets.Scripts;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class PFUISlider : MonoBehaviour
{
private Text text;
private Slider slider;
public System.Func<float, float> valueHandler = (a) => a * 100;
private List<Color> colorGradientList;
private void Awake()
{
text = transform.Find("Text").GetComponent<Text>();
slider = transform.GetComponent<Slider>();
text.text = $"{(slider.value * 100).ToString("#0")}%";
//text.text = $"{(slider.value * 100).ToString("#0")}";
//slider.onValueChanged.AddListener((f) =>
//{
// text.text = $"{valueHandler(f).ToString("#0")}";
//});
colorGradientList = SetColorGradient(new List<Color>
{
Utils.HexToColorHtml("#ffffff"),
Utils.HexToColorHtml("#27DFE3"),
Utils.HexToColorHtml("#27E363"),
Utils.HexToColorHtml("#E3D427"),
Utils.HexToColorHtml("#E33B27"),
},
new List<int>
{
50,50,100,100
});
}
public bool runCallback = false;
public void SetValueChanged(System.Action<float> a)
{
slider = transform.GetComponent<Slider>();
slider.onValueChanged.RemoveAllListeners();
slider.onValueChanged.AddListener((f) =>
{
text.text = $"{(f * 100).ToString("#0")}%";
var step = 1f / (colorGradientList.Count-1);
var index = (int)Math.Round(f / step, 0);
slider.targetGraphic.color = colorGradientList[index];
text.text = $"{valueHandler(f).ToString("#0")}";
a.Invoke(f);
});
}
public void SetValue(float a)
{
slider.value = a;
}
public List<Color> SetColorGradient(List<Color> list, int divideCount)
{
var res = new List<Color>();
for (int i = 0; i < list.Count - 1; i++)
{
Color c = list[i], nc = list[i + 1];
var diff = new Tuple<float, float, float>((nc.r - c.r) / divideCount, (nc.g - c.g) / divideCount, (nc.b - c.b) / divideCount);
for (int j = 0; j < divideCount; j++)
{
res.Add(new Color(c.r + diff.Item1 * j, c.g + diff.Item2 * j, c.b + diff.Item3 * j));
}
}
return res;
}
public List<Color> SetColorGradient(List<Color> list, List<int> divideList)
{
if (list.Count != divideList.Count+1) return null;
var res = new List<Color>();
for (int i = 0; i < list.Count - 1; i++)
{
Color c = list[i], nc = list[i + 1];
var divideCount = divideList[i];
var diff = new Tuple<float, float, float>((nc.r - c.r) / divideCount, (nc.g - c.g) / divideCount, (nc.b - c.b) / divideCount);
for (int j = 0; j < divideCount; j++)
{
res.Add(new Color(c.r + diff.Item1 * j, c.g + diff.Item2 * j, c.b + diff.Item3 * j));
}
}
return res;
}
// Start is called before the first frame update
void Start()
{
+1 -1
View File
@@ -34,7 +34,7 @@ namespace Assets.Scripts.UI.Control
private Text text;
//private Texture2D cursor;
private Outline outline;
private Button mButton;
public Button mButton { get;set; }
private Sequence se = null;
private Sequence a;
private TweenerCore<float, float, FloatOptions> b;
@@ -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();
}
@@ -76,6 +81,7 @@ public class ActivityController : PFUIPanel
{
if (action == null)
{
//webView.UserAgent = "tes "+ App.GetLocalLanguage();
webView.LoadURL(url, true);
}
else
@@ -88,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);
@@ -112,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;
}
@@ -123,30 +130,57 @@ public class ActivityController : PFUIPanel
Application.OpenURL(System.Net.WebUtility.UrlDecode(url));
}
private void Share(int type,int id)
private void Share(int type, int id)
{
string url = $"http://pfweb.juze.pro/Activity/LightUpChina/Share?userId={App.CurrentUser.Id}";
if (type < 2)
{
if (App.weChatController.IsWeChatAppInstalled())
{
App.weChatController.ShareWebpageToWX(type, url, "点亮中国活动", "by " + App.CurrentUser.Nickname, null);
App.weChatController.ShareWebpageToWX(type, url, App.GetLocalString("Light up China Share"), "by " + App.CurrentUser.Nickname, null);
}
}
else if (type == 2)
{
UnityEngine.GUIUtility.systemCopyBuffer = url;
RunJavaScript("window.postMessage(\"webview;复制成功\")");
RunJavaScript($"window.postMessage(\"webview;{App.GetLocalString("Copy Success")}\")");
}
else
{
Facebook.Unity.FB.ShareLink(contentURL: new Uri(url),
contentTitle: "点亮中国活动",
contentTitle: App.GetLocalString("Light up China Share"),
contentDescription: "By " + App.CurrentUser.Nickname,
photoURL: new Uri(App.CurrentUser.WxHeadImg));
}
}
/// <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;
@@ -161,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)
@@ -14,7 +14,7 @@ using Assets.Scripts.Devices;
public class ConnectDeviceModal : PFUIPanel
{
private float timer = 1.0f;
private float timer = 0f;
private SensorType mSensorType = SensorType.None;
public SensorType SensorType {
get {
@@ -22,7 +22,6 @@ public class ConnectDeviceModal : PFUIPanel
}
set
{
//Debug.Log(value);
mSensorType = value;
var deviceInfoStr = Utils.deviceDict[value.ToString()];
if (deviceInfoStr != null)
@@ -30,7 +29,7 @@ public class ConnectDeviceModal : PFUIPanel
var deviceInfo = deviceInfoStr.Split('|');
if (deviceInfo.Length == 2)
{
Title.text = deviceInfo[0];
Title.text = App.GetLocalString(deviceInfo[0]);
Logo.sprite = Resources.Load<Sprite>(deviceInfo[1]);
}
}
@@ -60,7 +59,7 @@ public class ConnectDeviceModal : PFUIPanel
content = panel.Find("Scroll View").Find("Viewport").Find("Content").GetComponent<VerticalLayoutGroup>();
noDevice = container.Find("NoDevice").GetComponent<Text>();
noDevice.text = App.GetLocalString("NO DEVICE");
searchIconRect = container.Find("SearchIcon").GetComponent<RectTransform>();
_x = searchIconRect.localPosition.x;
_y = searchIconRect.localPosition.y;
@@ -148,7 +147,7 @@ public class ConnectDeviceModal : PFUIPanel
if(timer <= 0)
{
SearchDevice();
timer = 1.0f;
timer += 1.0f;
}
Move();
@@ -203,27 +202,6 @@ public class ConnectDeviceModal : PFUIPanel
UIManager.AddEvent(deviceItemObj.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
{
deviceItemObj.Set(true);
var trainer = SensorType == SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
var nontrainer = deviceItemObj.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
if (trainer || nontrainer)
{
connectBtnText.text = App.GetLocalString("DISCONNECT");
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
}
else
{
connectBtnText.text = App.GetLocalString("CONNECT");
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
}
foreach (var item in deviceList)
{
if (item.Key != deviceItemObj.DeviceInfo.Id)
{
item.Value.Set(false);
}
}
}));
//UIManager.AddEvent(deviceItemObj.gameObject, EventTriggerType.Deselect, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
@@ -244,21 +222,14 @@ public class ConnectDeviceModal : PFUIPanel
if (firstDevice != null)
{
firstDevice.Set(true);
var trainer = SensorType == SensorType.Trainer && firstDevice.DeviceInfo.State == DeviceState.Connected;
var nontrainer = firstDevice.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && firstDevice.DeviceInfo.State == DeviceState.Connected;
if(trainer || nontrainer)
}
else
{
var defaultDevice = deviceList.FirstOrDefault();
if (defaultDevice.Value != null)
{
connectBtnText.text = App.GetLocalString("DISCONNECT");
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
defaultDevice.Value.Set(true);
}
else
{
connectBtnText.text = App.GetLocalString("CONNECT");
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
}
//connectBtn.text.text = "DISCOUNECT";
noDevice.text = firstDevice.DeviceInfo.Name;
}
//DeviceItem firstDevice;
//var devicesTemp = deviceList.Select(d => d.Value).Where(d => d.DeviceInfo.State == DeviceState.Connected);
@@ -267,8 +238,45 @@ public class ConnectDeviceModal : PFUIPanel
// firstDevice = devicesTemp.FirstOrDefault(d=>d)
//}
}
//如果没有可连接的设备按钮只读
connectBtn.mButton.enabled = deviceList.Count > 0;
connectBtn.mButton.interactable = deviceList.Count > 0;
}
}
//选中需要连接的设备
public void SelectDevice(DeviceItem deviceItemObj)
{
var trainer = SensorType == SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
var nontrainer = deviceItemObj.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
if (trainer || nontrainer)
{
connectBtnText.text = App.GetLocalString("DISCONNECT");
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
}
else
{
connectBtnText.text = App.GetLocalString("CONNECT");
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
}
foreach (var item in deviceList)
{
if (item.Key != deviceItemObj.DeviceInfo.Id)
{
item.Value.Set(false);
}
}
noDevice.text = deviceItemObj.DeviceInfo.Name + "-"+ deviceItemObj.DeviceInfo.DeviceNumber;
if (deviceItemObj.DeviceInfo.State == DeviceState.Connected)
{
noDevice.color = Color.white;
}
else
{
noDevice.color = Utils.HexToColor("5C5C6E");
}
}
public override void Show()
{
@@ -153,6 +153,8 @@ public class DeviceItem : Selectable, IEventSystemHandler, IPointerClickHandler
if (this.isOn)
{
SetSelectedStyle();
var manager = FindObjectOfType<ConnectDeviceModal>();
manager.SelectDevice(this);
}
else
{
@@ -70,7 +70,7 @@ public class DeviceView : MonoBehaviour
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
mPairButton.SetActive(false);
//mPairButton.SetActive(false);
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
#if UNITY_IOS || UNITY_ANDROID
unconnectionButton = unconnectionPanel.GetComponent<Button>();
@@ -137,7 +137,10 @@ public class DeviceView : MonoBehaviour
connectButtonClick();
}));
#endif
UIManager.AddEvent(mSearchButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{
connectButtonClick();
}));
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{
connectButtonClick();
@@ -276,7 +279,7 @@ public class DeviceView : MonoBehaviour
connectionPanel.SetActive(false);
logo.sprite = sprite0;
noDevice.text = App.GetLocalString("NO DEVICE");
searchState.text = App.GetLocalString("Searching...");
var hasDevice = false;
@@ -286,6 +289,7 @@ public class DeviceView : MonoBehaviour
else {
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
}
noDevice.text = hasDevice? App.GetLocalString("CHOOSE DEVICE") : App.GetLocalString("NO DEVICE");
//Debug.Log(hasDevice);
if (hasDevice)
{
@@ -303,7 +307,7 @@ public class DeviceView : MonoBehaviour
#if !(UNITY_IOS || UNITY_ANDROID)
mSearchButton.SetActive(true);
#endif
mPairButton.SetActive(false);
//mPairButton.SetActive(false);
}
}
else if(connectedDevice.State == DeviceState.Connecting)
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1fa036e3dd69a3a4686ffb7a3bfb530a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MailDetailController : PFUIPanel
{
// Start is called before the first frame update
ScrollRect scroll;
protected override void Awake()
{
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, async b =>
{
CloseSelf();
});
UIManager.AddEvent(transform.Find("Container/BtnDelete").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowConfirm(App.GetLocalString("Delete"), App.GetLocalString("Are you sure you want to delete this email?"), async () =>
{
if (mail != null)
{
await ConfigHelper.mailApi.Delete(mail.Id);
Utils.showToast(null, "Success", type: 1);
UIManager.CloseConfirm();
CloseSelf();
}
});
});
scroll = transform.Find("Container/Content/Scroll View").GetComponent<ScrollRect>();
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
MailModel mail;
public async void Initial(MailModel item)
{
this.mail = item;
await ConfigHelper.mailApi.MarkRead(item.Id);
transform.Find("Container/Title").GetComponent<Text>().text = item.Title;
scroll.content.Find("Text").GetComponent<Text>().text = $"{item.Desc}\n\n{item.SendNickName}";
}
private async void CloseSelf()
{
Close();
await MailReceiver.Instance().GetMessage();
UIManager.Instance.MailListController.Show();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 74fe80f225b0aff448f240dde817f640
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,37 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MailItemController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void Initial(MailModel item)
{
var color = item.IsRead ? Utils.HexToColorHtml("#5C5C6E") : Utils.HexToColorHtml("#ffffff");
Text title = transform.Find("Content/Title").GetComponent<Text>(), time = transform.Find("Content/Time").GetComponent<Text>();
title.text = item.Title;
time.text = item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
title.color = color;
time.color = color;
transform.Find("Content/MailImage").GetComponent<Image>().color = color;
UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowMailDetailPanel(item);
});
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 896523cde19693d4ca337b93a7880c8a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,60 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MailListController : PFUIPanel
{
// Start is called before the first frame update
ScrollRect scroll;
GameObject mail;
protected override void Awake()
{
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Close();
});
scroll = transform.Find("Container/Content/Right/Scroll View").GetComponent<ScrollRect>();
#if UNITY_STANDALONE_WIN
mail = Resources.Load<GameObject>("UI/Prefab/Mail/MailItem");
#else
mail = Resources.Load<GameObject>("UI/Prefab/Mail/MailItem-mob");
#endif
}
public override void Show()
{
base.Show();
DisplayMails(App.CurrentUserMails);
}
private void DisplayMails(List<MailModel> list)
{
if (list == null) return;
scroll.content.DestroyChildren();
if (mail != null)
{
foreach (var item in list)
{
var obj = Instantiate(mail);
obj.GetComponent<MailItemController>().Initial(item);
//obj.SendMessage("Initial", );
obj.transform.SetParent(scroll.content.transform);
obj.transform.localScale = new Vector3(1, 1, 1);
}
}
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cdfbce372733cb8438be420f311cb56e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
using Assets.Scripts;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class MailReceiver : MonoBehaviour
{
// Start is called before the first frame update
private static MailReceiver _instance = null;
public static bool Exists()
{
return _instance != null;
}
public static MailReceiver Instance()
{
if (!Exists())
{
throw new Exception("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene.");
}
return _instance;
}
void Awake()
{
if (_instance == null)
{
_instance = this;
}
DontDestroyOnLoad(gameObject);
}
void Start()
{
}
float timer = 10f;
// Update is called once per frame
void Update()
{
timer -= Time.deltaTime;
if (timer < 0)
{
GetMessage();
timer += 10;
}
}
public async Task GetMessage()
{
var res = await ConfigHelper.mailApi.GetList(0, 100, 0);
if (res.result)
{
App.CurrentUserMails = res.data;
App.hasNotRead = res.data.Count(x => !x.IsRead) > 0;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 227da2d8b06aad34ca648aa8c2ab5f05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+14 -1
View File
@@ -3,6 +3,7 @@ using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@@ -81,7 +82,20 @@ public class MainNav : MonoBehaviour
{
UIManager.ShowFeedBackModal();
});
UIManager.AddEvent(transform.Find("Mail").gameObject, EventTriggerType.PointerClick, x =>
{
UIManager.ShowMailListPanel();
});
App.HasNotReadChanged -= ShowMailDot;
App.HasNotReadChanged += ShowMailDot;
}
private void ShowMailDot(object sender, EventArgs e)
{
if (transform)
{
transform.Find("Mail/Dot").gameObject.SetActive((bool)sender);
}
}
public void ShowRowerTab()
@@ -126,7 +140,6 @@ public class MainNav : MonoBehaviour
}
#endif
}
public void ShowExit()
{
if (exit)
+39 -3
View File
@@ -114,10 +114,21 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
if (!isModal)
{
transform.Find("CollectImg").GetComponent<Button>().onClick.RemoveAllListeners();
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect);
if (App.CurrentRouteType == "My Upload")
{
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(ApplyOpenRoute);
}
else
{
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect);
}
}
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
UIManager.Instance.collectDict[myMap.IsFavorite];
App.CurrentRouteType != "My Upload"?UIManager.Instance.collectDict[myMap.IsFavorite]: UIManager.Instance.uploadDict[myMap.IsEnabled];
if (App.CurrentRouteType == "My Upload")
{
transform.Find("CollectImg").Find("Image").GetComponent<RectTransform>().sizeDelta = new Vector2(25, 20f);
}
#if !(UNITY_ANDROID || UNITY_IOS)
transform.Find("CollectImg").gameObject.SetActive(false);
#endif
@@ -129,7 +140,8 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
SetActive4Button(false);
var isRecent = App.CurrentRouteType == "Recent Routes" && myMap.RecentRecord != null && myMap.RecentRecord.ContinueCyclingParam != null && !isModal;
var isRecent = myMap.RecentRecord != null && myMap.RecentRecord.ContinueCyclingParam != null && !isModal;
//var isRecent = App.CurrentRouteType == "Recent Routes" && myMap.RecentRecord != null && myMap.RecentRecord.ContinueCyclingParam != null && !isModal;
transform.Find("BtnContinue").gameObject.SetActive(isRecent);
transform.Find("BtnReride").gameObject.SetActive(isRecent);
transform.Find("MapHBImg").gameObject.SetActive(!isRecent);
@@ -165,6 +177,30 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
}
}
void ApplyOpenRoute()
{
if (!map.IsEnabled)
{
UIManager.ShowConfirm(App.GetLocalString("Request to make the route public"), App.GetLocalString("Do you want to make the route public?"), async () =>
{
var res = await ConfigHelper.mapApi.ApplyOpenRoute(map.Id);
if (res.result)
{
Utils.showToast(null, App.GetLocalString("Submitted, please wait for background review."), type: 1);
UIManager.CloseConfirm();
}
else
{
Utils.showToast(null, res.errMsg);
}
});
}
else
{
Utils.showToast(null, App.GetLocalString("Route is public."), type: 1);
}
}
private void Ride()
{
App.RouteIdParam = map.Id;
+115 -27
View File
@@ -16,10 +16,19 @@ public class NewMainNav : MonoBehaviour
{
public Sprite image;
public UnityAction action;
public bool isAlways;
public CustomButton(Sprite image, UnityAction action)
{
this.image = image;
this.action = action;
isAlways = true;
}
public CustomButton(Sprite image, UnityAction action,bool isAlways)
{
this.image = image;
this.action = action;
isAlways = false;
}
}
private GameObject exit;
@@ -28,23 +37,30 @@ public class NewMainNav : MonoBehaviour
float delayTime = 0;
private List<string> typeArray = new List<string>()
{
"Back","Exit","Home","Device","Delay","Setting","Support","Avatar","Custom","Custom2"
"Back","Exit","Home","Device","Delay","Setting","Support","Avatar","Custom","Custom2","Mail","Custom3"
};
private List<int> indexs = new List<int>();
private int? shrinkIndex = null;
private CustomButton custom = null,custom2 = null;
private CustomButton custom = null,custom2 = null, custom3 = null;
/// <summary>
///
/// </summary>
/// <param name="indexs">仅展开显示的按钮:1:"Exit",3:"Device",4:"Delay",5:"Setting",6:"Support",7:"Avatar"</param>
/// <param name="shrinkIndex">合上后仍显示的按钮:0:"Back",2:"Home",null:仅PF</param>
/// <param name="custom">自定义按钮 8:c1 9:c2</param>
public void SetButtonActive(List<int> indexs,int? shrinkIndex = null, CustomButton custom = null, CustomButton custom2 = null)
/// <param name="custom">自定义按钮 8:c1 9:c2 11:c3</param>
public void SetButtonActive(List<int> indexs,int? shrinkIndex = null, CustomButton custom = null, CustomButton custom2 = null,CustomButton custom3 = null,bool ShowMail = true)
{
this.indexs = indexs;
if (ShowMail)
{
//邮箱常驻(除划船机)
this.indexs.Add(10);
}
this.shrinkIndex = shrinkIndex;
this.custom = custom;
this.custom2 = custom2;
this.custom3 = custom3;
if (custom != null)
{
transform.Find("Custom").GetComponent<Button>().onClick.RemoveAllListeners();
@@ -59,23 +75,39 @@ public class NewMainNav : MonoBehaviour
transform.Find("Custom2").GetComponent<Image>().sprite = custom2.image;
indexs.Add(9);
}
if (custom3 != null)
{
transform.Find("Custom3").GetComponent<Button>().onClick.RemoveAllListeners();
transform.Find("Custom3").GetComponent<Button>().onClick.AddListener(custom3.action);
transform.Find("Custom3").GetComponent<Image>().sprite = custom3.image;
indexs.Add(11);
}
SetExpand(false);
}
/// <summary>
/// true:展开 false:关闭
/// </summary>
/// <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)
{
types = typeArray.Where((x, i) => indexs.Contains(i)).ToList();
}
string shrinkName = null;
if (shrinkIndex.HasValue && (shrinkIndex == 0 || shrinkIndex == 2))
if (shrinkIndex.HasValue && isShrinkIndex(shrinkIndex.Value))
{
shrinkName = typeArray[shrinkIndex.Value];
}
@@ -96,18 +128,27 @@ public class NewMainNav : MonoBehaviour
item.gameObject.SetActive(types.Contains(item.name));
}
}
else
else
{
item.gameObject.SetActive(item.name == "PF"|| item.name == shrinkName);
item.gameObject.SetActive(item.name == "PF" || item.name == shrinkName);
}
//自定义按钮出来
if (item.name == "Custom")
if (item.name == "Custom" || item.name == "Custom2" || item.name == "Custom3")
{
item.gameObject.SetActive(custom != null && types.Contains(item.name));
}
else if (item.name == "Custom2")
{
item.gameObject.SetActive(custom2 != null && types.Contains(item.name));
//自定义按钮出来
CustomButton c = null;
if (item.name == "Custom")
{
c = custom;
}
else if (item.name == "Custom2")
{
c = custom2;
}
else if (item.name == "Custom3")
{
c = custom3;
}
item.gameObject.SetActive(c != null && types.Contains(item.name) && (flag || !flag && c.isAlways));
}
}
}
@@ -115,7 +156,7 @@ public class NewMainNav : MonoBehaviour
public void ShowButton(string v)
{
var i = typeArray.FindIndex((x)=>x == v);
if (i == -1 || i == 0 || i == 2)
if (i == -1 || isShrinkIndex(i))
{
return;
}
@@ -125,7 +166,7 @@ public class NewMainNav : MonoBehaviour
public void HideButton(string v)
{
var i = typeArray.FindIndex((x) => x == v);
if (i == -1 || i == 0 || i == 2)
if (i == -1 || isShrinkIndex(i))
{
return;
}
@@ -140,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 =>
{
@@ -160,7 +208,15 @@ public class NewMainNav : MonoBehaviour
UIManager.AddEvent(device.gameObject, EventTriggerType.PointerClick, x =>
{
//Debug.Log("click device");
UIManager.ShowDevicePanel();
if (App.IsRowerMode.HasValue && App.IsRowerMode.Value)
{
if (UIManager.Instance.RowerHomeScript.checkRowing()) return;
UIManager.ShowRowerDevicePanel();
}
else
{
UIManager.ShowDevicePanel();
}
});
home = this.transform.Find("Home").gameObject;
@@ -212,8 +268,21 @@ public class NewMainNav : MonoBehaviour
{
UIManager.ShowFeedBackModal();
});
UIManager.AddEvent(transform.Find("Mail").gameObject, EventTriggerType.PointerClick, x =>
{
UIManager.ShowMailListPanel();
});
App.HasNotReadChanged -= ShowMailDot;
App.HasNotReadChanged += ShowMailDot;
}
private void ShowMailDot(object sender, EventArgs e)
{
if (transform)
{
transform.Find("Mail/Dot").gameObject.SetActive((bool)sender);
}
}
public void ShowRowerTab()
{
@@ -230,7 +299,10 @@ public class NewMainNav : MonoBehaviour
transform.Find("Home").gameObject.SetActive(false);
}
}
private bool isShrinkIndex(int ind)
{
return ind == 0 || ind == 2;
}
// Start is called before the first frame update
void Start()
{
@@ -238,19 +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)
{
Debug.Log(235);
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);
}
@@ -262,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()
{
@@ -43,7 +43,10 @@ public class HomeController : PFUIPanel
var BtnContainer = transform.Find("MainFuncContainer");
#if UNITY_ANDROID || UNITY_IOS
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 });
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 },null,new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_mode_44"), () =>
{
UIManager.ShowRowerSelector();
},false));
newNav = nav;
UIManager.AddEvent(transform.Find("TodayData/Datas/Distance").gameObject, EventTriggerType.PointerClick, b =>
{
File diff suppressed because it is too large. Load diff
@@ -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>
{
@@ -91,11 +91,32 @@ public class RouteItem : MonoBehaviour
{
Utils.DisplayImage(raw, result.Cover, true);
}
row1.Find("Time").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Rowing time")}:</color>{TimeSpan.FromSeconds(result.TotalTime).ToString()}";
row1.Find("Distance").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Distance")}:</color>{result.TotalDistance}M";
row1.Find("Time").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Rowing time")}:</color>{TimeSpan.FromSeconds(result.Ticks).ToString()}";
row1.Find("Distance").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("row distance")}:</color>{result.TotalDistance}M";
row2.Find("Device").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Rowing equipment")}:</color>{result.ManufacturerName}";
left.Find("Progress").gameObject.SetActive(false);
left.Find("Main/Name").GetComponent<Text>().text = $"{result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} Free Rowing";
string typeStr = "Free";
if (result.Type == 1)
{
typeStr = $"{result.TypeValue}M";
}
else if (result.Type == 2 && result.TypeValue.HasValue)
{
var ts = TimeSpan.FromSeconds(result.TypeValue.Value);
if (ts.TotalHours >= 1)
{
typeStr = ts.TotalHours.ToString("#0.0") + "h";
}
else if (ts.TotalMinutes >= 1)
{
typeStr = ts.TotalMinutes.ToString("#0.0") + "min";
}
else
{
typeStr = result.TypeValue.Value + "s";
}
}
left.Find("Main/Name").GetComponent<Text>().text = $"{result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} {typeStr} Rowing";
left.Find("Main/Time").GetComponent<Text>().text = $"{result.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} ~ {result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}";
var rect = left.Find("Main").GetComponent<RectTransform>();
rect.sizeDelta = new Vector2(399,rect.sizeDelta.y);
@@ -108,7 +129,14 @@ public class RouteItem : MonoBehaviour
{
UIManager.AddEvent(btnDetail.gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowRowerResult(result.Id);
//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);
});
}
btnReRide = right.Find("BtnRide");
@@ -119,7 +147,7 @@ public class RouteItem : MonoBehaviour
UIManager.ShowConfirm("Re-Rowing", "Rowing again?", () =>
{
UIManager.CloseConfirm();
UIManager.ShowRowerPanel();
UIManager.ShowRowerPanel(result);
});
});
}
@@ -50,12 +50,12 @@ public class RowerAnimation : PFUIPanel
for (int i = 0; i < 15; i++)
{
image.sprite = sprites[i];
yield return new WaitForSeconds(0.02f);
yield return new WaitForSeconds(0.02666f);
}
for (int i = 15; i < 30; i++)
{
image.sprite = sprites[i];
yield return new WaitForSeconds(0.04f);
yield return new WaitForSeconds(0.05333f);
}
}
@@ -0,0 +1,50 @@
using Assets.Scripts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RowerDevicePanel : PFUIPanel
{
protected override void Awake()
{
UIManager.AddEvent(transform.Find("Container/Tools/Back").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Close();
});
}
// Start is called before the first frame update
void Start()
{
}
public override void Show()
{
base.Show();
print("开启扫描");
#if UNITY_ANDROID || UNITY_IOS
App.MainDeviceAdapter.StartScan();
#if UNITY_ANDROID
Utils.CallAndroidMethod("OpenLocationService");
#endif
#endif
}
float timer = 1f;
// Update is called once per frame
void Update()
{
timer -= Time.deltaTime;
if (timer <= 0)
{
if (App.MainDeviceAdapter.GetState(Assets.Scripts.Devices.ConnectionInterface.BLE) == Assets.Scripts.Devices.DeviceAdapterState.On)
{
transform.Find("Container/Tools/BlueTooth").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/RowerNew/ICON_bluetooth_44_on");
}
else
{
transform.Find("Container/Tools/BlueTooth").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/RowerNew/ICON_bluetooth_44");
}
timer += 1f;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 169dd57411866874882869d55e047e57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -67,7 +67,7 @@ public class RowerDeviceView : MonoBehaviour
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
mPairButton.SetActive(false);
//mPairButton.SetActive(false);
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
@@ -124,21 +124,13 @@ public class RowerDeviceView : MonoBehaviour
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{
if (deviceModal == null)
{
#if UNITY_IOS || UNITY_ANDROID
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
#else
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
#endif
GameObject gameObject = (GameObject)Instantiate(obj);
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
}
deviceModal.SensorType = this.SensorType;
UIManager.Show(deviceModal, null, true);
connectButtonClick();
}));
UIManager.AddEvent(gameObject, EventTriggerType.PointerClick, b =>
{
if (!mPairButton.activeInHierarchy && !mDisconnectButton.activeInHierarchy) return;
connectButtonClick();
});
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
//var device = GetDevice();
//if(device != null && device.State == DeviceState.Connected)
@@ -156,9 +148,23 @@ public class RowerDeviceView : MonoBehaviour
deviceModal.SensorType = this.SensorType;
UIManager.Show(deviceModal, null, true);
}));
}
void connectButtonClick()
{
if (deviceModal == null)
{
#if UNITY_IOS || UNITY_ANDROID
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
#else
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
#endif
GameObject gameObject = (GameObject)Instantiate(obj);
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
}
deviceModal.SensorType = this.SensorType;
UIManager.Show(deviceModal, null, true);
}
void InitLogo()
{
if (SensorType == SensorType.Power)
@@ -244,8 +250,8 @@ public class RowerDeviceView : MonoBehaviour
connectionPanel.SetActive(false);
logo.sprite = sprite0;
noDevice.text = "NO DEVICE";
searchState.text = "Searching...";
noDevice.text = App.GetLocalString("NO DEVICE");
searchState.text = App.GetLocalString("Searching...");
var hasDevice = false;
if (SensorType == SensorType.SpeedCadence)
@@ -272,7 +278,7 @@ public class RowerDeviceView : MonoBehaviour
#if !(UNITY_IOS || UNITY_ANDROID)
mSearchButton.SetActive(true);
#endif
mPairButton.SetActive(false);
//mPairButton.SetActive(false);
}
}
else if(connectedDevice.State == DeviceState.Connecting)
@@ -6,8 +6,11 @@ using System.Collections.Generic;
public class RowerGraphChartFeed : MonoBehaviour
{
void Start ()
GraphChartBase graph { get; set; }
void Start ()
{
graph = GetComponent<GraphChartBase>();
//GraphChartBase graph = GetComponent<GraphChartBase>();
//if (graph != null)
//{
@@ -16,7 +19,7 @@ public class RowerGraphChartFeed : MonoBehaviour
// graph.DataSource.StartBatch();
// graph.DataSource.ClearCategory("Player 1");
// graph.DataSource.ClearAndMakeBezierCurve("Player 2");
// for (int i = 0; i <10000; i++)
// {
// graph.DataSource.AddPointToCategory("Player 1",i*5,Random.value*10f + 20f);
@@ -29,29 +32,39 @@ public class RowerGraphChartFeed : MonoBehaviour
// graph.DataSource.MakeCurveCategorySmooth("Player 2");
// graph.DataSource.EndBatch();
//}
// StartCoroutine(ClearAll());
// StartCoroutine(ClearAll());
}
public void SetData(List<DoubleVector2> list)
public void SetData(List<DoubleVector2> list,List<DoubleVector2> list2 = null)
{
GraphChartBase graph = GetComponent<GraphChartBase>();
if (graph != null)
{
graph.Scrollable = false;
//graph.HorizontalValueToStringMap[0.0] = "Zero"; // example of how to set custom axis strings
graph.DataSource.StartBatch();
//graph.DataSource.StartBatch();
graph.DataSource.ClearCategory("Player 1");
graph.DataSource.ClearCategory("Player 2");
graph.ClearCache();
for (int i = 0; i < list.Count; i++)
{
var item = list[i];
graph.DataSource.AddPointToCategory("Player 1", item.x, item.y);
graph.DataSource.AddPointToCategoryRealtime("Player 2", item.x, item.y);
//if (i == 0)
// graph.DataSource.SetCurveInitialPoint("Player 1", item.x, item.y);
//else
// graph.DataSource.AddLinearCurveToCategory("Player 1", new DoubleVector2(item.x, item.y));
}
if (list2 != null)
{
for (int i = 0; i < list2.Count; i++)
{
var item = list2[i];
graph.DataSource.AddPointToCategoryRealtime("Player 1", item.x, item.y);
}
}
//graph.DataSource.MakeCurveCategorySmooth("Player 1");
graph.DataSource.EndBatch();
//graph.DataSource.EndBatch();
}
}
IEnumerator ClearAll()
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee3b67ceb2893134a887a9e30922821e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,349 @@
using Assets.Scripts;
using Assets.Scripts.UI.Control;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class RowerTaskPanel : PFUIPanel
{
public class RowerType
{
/// <summary>
/// 1 里程 2 时间
/// </summary>
public int type { get; set; }
/// <summary>
/// 里程:m 时间:s
/// </summary>
public float value { get; set; }
}
Transform selector, distance, time;
public RowerType rowerType;
public Action<RowerType> callBack { get; set; }
protected override void Awake()
{
distance = transform.Find("Main/Distance");
time = transform.Find("Main/Time");
rowerType = new RowerType();
UIManager.AddEvent(transform.Find("Main/BtnGo").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Go();
});
UIManager.AddEvent(transform.Find("Main/BtnCancel").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Close();
});
UIManager.AddEvent(transform.Find("Main/BtnFreeMode").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
rowerType.type = 0;
rowerType.value = 0;
if (callBack != null)
{
callBack.Invoke(rowerType);
}
Close();
});
//var bg = transform.Find("Main/Time/Inputbg").gameObject;
//UIManager.AddEvent(bg, UnityEngine.EventSystems.EventTriggerType.PointerEnter, b =>
// {
// bg.GetComponent<Outline>().enabled = true;
// bg.GetComponent<Outline>().effectColor = Utils.HexToColorHtml("#353543");
// });
//UIManager.AddEvent(bg, UnityEngine.EventSystems.EventTriggerType.Select, b =>
//{
// bg.GetComponent<Outline>().enabled = true;
// bg.GetComponent<Outline>().effectColor = Utils.HexToColorHtml("#f93086");
//});
//UIManager.AddEvent(bg, UnityEngine.EventSystems.EventTriggerType.Deselect, b =>
//{
// bg.GetComponent<Outline>().enabled = false;
//});
formList = new List<object>
{
distance.Find("Btn500").GetComponent<Button>(),
distance.Find("Btn1000").GetComponent<Button>(),
distance.Find("Btn2000").GetComponent<Button>(),
distance.Find("Btn5000").GetComponent<Button>(),
distance.Find("Btn10000").GetComponent<Button>(),
distance.Find("Customize").GetComponent<PFUIInputField>(),
time.Find("Btn30").GetComponent<Button>(),
time.Find("CustomizeMin").GetComponent<PFUIInputField>(),
time.Find("CustomizeS").GetComponent<PFUIInputField>(),
};
InitDistance();
}
public override void Show()
{
base.Show();
InitAll();
InitValue();
}
private void Go()
{
if (rowerType.type == 0 || rowerType.value == 0)
{
Utils.showToast(null, "Please select a course.", isOnly:true);
return;
}
if (rowerType.type == 1 && rowerType.value < 100)
{
Utils.showToast(null, "Minimum mileage is 100M.", isOnly: true);
return;
}
if (rowerType.type == 2 && rowerType.value < 20)
{
Utils.showToast(null, "Minimum time is 20s.", isOnly: true);
return;
}
if (callBack != null)
{
callBack.Invoke(rowerType);
}
Close();
}
List<object> formList = null;
private void InitDistance()
{
Func<Transform, float, float, float> calc = (t, a, b) => t.parent.name == "Distance" ? a : a * 60 + b;
AddListener(formList, (t, v) =>
{
if (t.parent.name == "Distance")
{
rowerType.type = 1;
if (float.TryParse(v, out float f))
{
rowerType.value = f;
}
else
{
rowerType.value = 0;
}
}
else
{
rowerType.type = 2;
rowerType.value = 0;
var min = time.Find("CustomizeMin").GetComponent<InputField>().text;
var s = time.Find("CustomizeS").GetComponent<InputField>().text;
if (float.TryParse(min, out float a))
{
rowerType.value += 60 * a;
}
if (float.TryParse(s, out float b))
{
if (b < 0 || b > 59)
{
Utils.showToast(null, "Please enter an integer between 0-59.");
time.Find("CustomizeS").GetComponent<InputField>().text = "";
return;
}
rowerType.value += b;
}
}
}, calc);
}
private void AddListener(IEnumerable<object> list, UnityAction<Transform,string> inputCustomAction, Func<Transform, float,float,float> calcButton = null)
{
var btns = list.Where(x => x is Button).Select(x => x as Button);
foreach (var item in list)
{
if (item is Button)
{
var btn = item as Button;
btn.onClick.RemoveAllListeners();
btn.onClick.AddListener(() =>
{
InitAll();
rowerType.type = btn.transform.parent.name == "Distance" ? 1 : 2;
if (calcButton == null)
{
rowerType.value = float.Parse(btn.name.Replace("Btn", ""));
}
else
{
rowerType.value = calcButton.Invoke(btn.transform ,float.Parse(btn.name.Replace("Btn", "")), 0);
}
ClickDistanceBtn(btn, btns);
});
}
else if (item is PFUIInputField)
{
var input = item as PFUIInputField;
input.CustomSelect = () =>
{
string ignoreName = null;
if (input.name == "CustomizeMin")
{
ignoreName = "CustomizeS";
}
else if (input.name == "CustomizeS")
{
ignoreName = "CustomizeMin";
}
InitAll(ignoreName);
ClickDistanceBtn(null, btns);
rowerType.type = input.transform.parent.name == "Distance" ? 1 : 2;
SetTextColor(input.gameObject, true);
SetBgColor(input,2);
};
input.CustomDeSelect = () =>
{
SetTextColor(input.gameObject, false);
SetBgColor(input, 3);
};
input.CustomEnter = () =>
{
SetBgColor(input, 1);
};
if (inputCustomAction != null)
{
input.GetComponent<InputField>().onEndEdit.RemoveAllListeners();
input.GetComponent<InputField>().onEndEdit.AddListener((v) => inputCustomAction(input.transform, v));
}
}
}
}
Dictionary<string, int> inputStatusDict = null;
private void SetBgColor(PFUIInputField input, int v)
{
if (inputStatusDict == null)
{
inputStatusDict = new Dictionary<string, int>
{
{"CustomizeMin",3 },{"CustomizeS",3 }
};
}
if (!inputStatusDict.ContainsKey(input.name)) return;
//只要有一个select,enter 常亮 两个都exit,deselect 关掉
inputStatusDict[input.name] = v;
var bg = transform.Find("Main/Time/Inputbg").gameObject;
if (inputStatusDict.Count(x=>x.Value == 1) > 0)
{
bg.GetComponent<Outline>().enabled = true;
bg.GetComponent<Outline>().effectColor = Utils.HexToColorHtml("#6E6E7D");
}
else if (inputStatusDict.Count(x => x.Value == 2) > 0)
{
bg.GetComponent<Outline>().enabled = true;
bg.GetComponent<Outline>().effectColor = Utils.HexToColorHtml("#f93086");
}
else if(inputStatusDict.Count(x => x.Value == 3) == 2)
{
bg.GetComponent<Outline>().enabled = false;
}
}
public readonly Dictionary<int, List<double>> stdList = new Dictionary<int, List<double>>
{
{ 1,new List<double>() { 500,1000,2000,5000,10000 }},
{ 2,new List<double>() { 1800 }}
};
private void InitAll(string igName = null)
{
foreach (var item in formList)
{
if (item is Button)
{
var btn = item as Button;
if (btn.name == igName) continue;
SetButtonColor(btn, false);
}
else
{
var i = item as PFUIInputField;
if (i.name == igName) continue;
i.Text = "";
}
}
}
private void InitValue()
{
foreach (var item in formList)
{
if (item is Button)
{
var btn = item as Button;
var flag = (rowerType.type == 1 && string.Equals(rowerType.value.ToString(), btn.name.Replace("Btn", ""))) ||
(rowerType.type == 2 && rowerType.value == 1800 && btn.name == "Btn30");
SetButtonColor(btn, flag);
}
else
{
var i = item as PFUIInputField;
i.Text = "";
if (stdList.ContainsKey(rowerType.type) && !stdList[rowerType.type].Contains(rowerType.value))
{
if (rowerType.type == 1 && i.name == "Customize")
{
i.Text = rowerType.value.ToString();
}
else if (rowerType.type == 2)
{
var ts = TimeSpan.FromSeconds(rowerType.value);
if (i.name == "CustomizeMin")
{
i.Text = ts.Minutes.ToString();
}
else if (i.name == "CustomizeS")
{
i.Text = ts.Seconds.ToString();
}
}
}
}
}
}
private void ClickDistanceBtn(Button btn, IEnumerable<Button> list)
{
foreach (var item in list)
{
SetButtonColor(item, false);
}
if (btn)
{
SetButtonColor(btn, true);
}
}
private void SetButtonColor(Button btn, bool flag)
{
SetTextColor(btn.gameObject, flag);
btn.gameObject.GetComponent<Image>().color = flag ? Utils.HexToColorHtml("#f93086") : Utils.HexToColorHtml("#23232d");
}
private void SetTextColor(GameObject btn, bool flag)
{
if (btn.transform.Find("t1"))
{
btn.transform.Find("t1").GetComponent<Text>().color = flag ? Utils.HexToColorHtml("#ffffff") : Utils.HexToColorHtml("#9E9EAD");
}
if (btn.transform.Find("t2"))
{
btn.transform.Find("t2").GetComponent<Text>().color = flag ? Utils.HexToColorHtml("#ffffff") : Utils.HexToColorHtml("#9E9EAD");
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 11dfa3e099daeb942b6e8e105572548c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,109 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
using Assets.Scripts;
//using ZenFulcrum.EmbeddedBrowser;
public class RowerTraceAnimated : MonoBehaviour
{
// Start is called before the first frame update
Vector3? v1, v2, v3;
void Start()
{
//print(v1.Value.ToString() + v2.Value.ToString() + v3.Value.ToString());
}
private void Awake()
{
if (!v1.HasValue) v1 = transform.localPosition;
if (!v2.HasValue) v2 = transform.Find("p1").localPosition;
if (!v3.HasValue) v3 = transform.Find("p2").localPosition;
}
/// <summary>
///
/// </summary>
/// <param name="time"></param>
/// <param name="callback"></param>
/// <param name="type"></param>
/// <returns></returns>
public Sequence startAnimation(float time, TweenCallback callback, int type = 0)
{
//if (sq != null && sq.IsPlaying())
//{
// return null;
//}
Transform c = transform, c1 = c.Find("p1"), c2 = c.Find("p2");
var rect = c.GetComponent<RectTransform>();
var dirOffset = 0f;
if (type == 1) dirOffset = -1f * rect.sizeDelta.y;
var offset = rect.sizeDelta.y / 2;
var sq = DOTween.Sequence();
sq.AppendCallback(() =>
{
c2.localPosition = v3.Value + new Vector3(0, dirOffset, 0);
c2.localRotation = Quaternion.Euler(new Vector3(type == 1 ? 270 : 90, 0, 0));
c2.GetComponent<Image>().color = Utils.HexToColorHtml("#353543FF");
callback();
//print(c.localPosition.ToString() + c.Find("p1").localPosition.ToString() + c.Find("p2").localPosition.ToString());
});
var sq1 = DOTween.Sequence();
sq1.Join(c2.GetComponent<Image>().DOFade(0, time));
sq1.Join(c.DORotate(new Vector3(type == 1 ? 90 : -90, 0, 0), time));
sq1.Join(c.DOLocalMoveY(v1.Value.y + (type == 0 ? -offset : offset), time));
sq1.Join(c.DOLocalMoveZ(v1.Value.z + offset, time));
//var sq2 = DOTween.Sequence();
//sq2.Append(c.DOLocalMoveZ(v1.Value.z + offset*0.14f, time * 0.5f));
//sq2.Append(c.DOLocalMoveZ(v1.Value.z + offset, time * 0.5f));
//sq1.Join(sq2);
sq.Append(sq1);
sq.AppendCallback(() =>
{
var tmp = c1;
c1 = c2;
c2 = tmp;
c1.name = "p1";
c2.name = "p2";
c.localPosition = v1.Value;
c1.localPosition = v2.Value;
c2.localPosition = v3.Value + new Vector3(0, dirOffset, 0);
c.localRotation = Quaternion.Euler(Vector3.zero);
c1.localRotation = Quaternion.Euler(Vector3.zero);
c2.localRotation = Quaternion.Euler(new Vector3(type == 1 ? 270 : 90, 0, 0));
});
sq.Play();
return sq;
}
// Update is called once per frame
void Update()
{
}
}
//var c = transform.Find("Container");
//int i = 1;
//UIManager.AddEvent(transform.Find("Button").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
// {
// var sq = DOTween.Sequence();
// i++;
// sq.AppendCallback(() =>
// {
// c.Find("p1").SetAsLastSibling();
// c.Find(i % 2 == 0 ? "p2" : "p3").SetAsLastSibling();
// });
// sq.Join(c.DORotate(new Vector3(90 * (i % 2 == 0 ? -1 : 1), 0, 0), 1));
// sq.Join(c.DOLocalMoveY(50 * (i % 2 == 0 ? -1 : 1), 1f));
// sq.Append(c.DOLocalMoveZ(0, 0.5f));
// sq.Append(c.DOLocalMoveZ(50, 0.5f));
// sq.Play();
// });
//int i = 1;
//UIManager.AddEvent(transform.Find("Button").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
//{
//});
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c7400b2488409db4cad823eb13d103b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+152 -24
View File
@@ -1,4 +1,6 @@
using Assets.Scripts.Apis.Models;
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using Facebook.Unity;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -7,45 +9,171 @@ using UnityEngine.UI;
public class RowerWelldone : PFUIPanel
{
[SerializeField]
GameObject AllRecord, Record,Rank;
Dictionary<string, Texture> caches;
Transform rankContent, gradeContent;
private Action initFunc;
public string id { get; private set; }
public override void Show()
{
base.Show();
Debug.Log("well done show");
}
// Start is called before the first frame update
protected override void Awake()
{
caches = new Dictionary<string, Texture>();
rankContent = transform.Find("Container/Left/Scroll View").GetComponent<ScrollRect>().content;
gradeContent = transform.Find("Container/Right/Scroll View").GetComponent<ScrollRect>().content;
}
void Start()
{
UIManager.AddEvent(transform.Find("BtnDefine").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
UIManager.AddEvent(transform.Find("Container/BtnDefine").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Close();
UIManager.ShowHomePanel();
UIManager.ShowUserInfoPanel();
CloseModal();
//UIManager.ShowHomePanel();
//UIManager.ShowUserInfoPanel();
});
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}", $"我在{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}", $"我在{data.info.TypeStr}的划船比赛中获得第{data.info.MyRankLeft}名!赶紧来一起划船吧!", $"By {App.CurrentUser.Nickname}", null);
});
UIManager.AddEvent(transform.Find("Container/Share/Fb").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
if (data == null) return;
FB.ShareLink(contentURL: new Uri($"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}"),
contentTitle: $"PowerFun {data.info.TypeStr} Rowing",
contentDescription: $"By {App.CurrentUser.Nickname}");
//App.weChatController.ShareWebpageToWX(1, , , , null);
});
}
// Update is called once per frame
void Update()
{
if (Input.touchCount > 0)
{
startTime = false;
transform.Find("Container/BtnDefine/Text").GetComponent<Text>().text = $"{App.GetLocalString("DEFINE")}";
}
if (startTime)
{
timer -= Time.deltaTime;
if (timer <= 0)
{
remainTime--;
if (remainTime == 0)
{
CloseModal();
return;
}
transform.Find("Container/BtnDefine/Text").GetComponent<Text>().text = $"{App.GetLocalString("DEFINE")}({remainTime.ToString("#0")})";
timer += 1f;
}
}
}
RowerRecordModel model;
public void Initial(RowerRecordModel model)
float timer = 1f, remainTime = 10f;
bool startTime = false;
RowerSegmentData data;
public async void Initial(string id,Action init)
{
Debug.Log("Initial");
if (model == null) return;
this.model = model;
transform.Find("Time/Value1").GetComponent<Text>().text = model.CreateTime.ToLocalTime().ToString("yyyy-MM-dd");
transform.Find("Time/Value2").GetComponent<Text>().text = model.CreateTime.ToLocalTime().ToString("HH:mm:ss");
transform.Find("RowingTime/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(model.TotalTime).ToString();
transform.Find("Distance/Value").GetComponent<Text>().text = $"{model.TotalDistance.ToString()}M";
var datas = transform.Find("Other/Datas");
datas.Find("AvgRate/Value").GetComponent<Text>().text = $"{model.AvgRate.ToString("#0")}";
datas.Find("MaxRate/Value").GetComponent<Text>().text = $"{model.MaxRate.ToString()}";
datas.Find("AvgPower/Value").GetComponent<Text>().text = $"{model.AvgPower.ToString("#0")}";
datas.Find("MaxPower/Value").GetComponent<Text>().text = $"{model.MaxPower.ToString()}";
datas.Find("MaxPace/Value").GetComponent<Text>().text = $"{TimeSpan.FromSeconds(model.MaxPace).ToString(@"mm\:ss")}";
datas.Find("AvgPace/Value").GetComponent<Text>().text = $"{TimeSpan.FromSeconds(model.AvgPace).ToString(@"mm\:ss")}";
datas.Find("Calories/Value").GetComponent<Text>().text = $"{(model.Kj ?? 0).ToString("#0")}";
datas.Find("StrokeCount/Value").GetComponent<Text>().text = $"{model.StrokeCount}";
if (string.IsNullOrEmpty(id)) return;
this.initFunc = init;
this.id = id;
var res = await ConfigHelper.rowerApi.GetSegmentDataAndRanking(id);
if (res.result)
{
this.data = res.data;
DisplayData(res.data, caches);
startTime = true;
remainTime = 30f;
timer = 1f;
transform.Find("Container/BtnDefine/Text").GetComponent<Text>().text = $"{App.GetLocalString("DEFINE")}({remainTime.ToString("#0")})";
}
}
private void DisplayData(RowerSegmentData data, Dictionary<string, Texture> caches)
{
rankContent.DestroyChildren();
gradeContent.DestroyChildren();
for (int i = 0; i < data.ranks.Count; i++)
{
var item = data.ranks[i];
var game = Instantiate<GameObject>(Rank);
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");
game.transform.SetParent(rankContent);
game.transform.localScale = Vector3.one;
game.SetActive(true);
if (new Guid(item.Id) == new Guid(id))
{
game.transform.Find("Content/Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#f93086");
game.transform.Find("Content/NickName").GetComponent<Text>().color = Utils.HexToColorHtml("#f93086");
game.transform.Find("Content/Time").GetComponent<Text>().color = Utils.HexToColorHtml("#f93086");
}
else
{
game.transform.Find("Content/Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
game.transform.Find("Content/NickName").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
game.transform.Find("Content/Time").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
}
}
for (int i = 0; i < data.segmentList.Count; i++)
{
var item = data.segmentList[i];
var game = i == 0 ? Instantiate<GameObject>(AllRecord) : Instantiate<GameObject>(Record);
var content = i != 0 ? game.transform.Find("Content") : game.transform;
content.Find("Index").GetComponent<Text>().text = i == 0 ? "ALL" : i.ToString("00");
content.Find("Time").GetComponent<Text>().text = TimeSpan.FromSeconds(item.Ticks).ToString();
content.Find("Distance").GetComponent<Text>().text = item.Distance.ToString("#0");
content.Find("500").GetComponent<Text>().text = TimeSpan.FromSeconds(item.Speed).ToString().Substring(3, 5);
content.Find("Power").GetComponent<Text>().text = item.Power.ToString("#0");
content.Find("HR").GetComponent<Text>().text = item.HeartRate.ToString("#0");
content.Find("Count").GetComponent<Text>().text = item.StrokeCount.ToString("#0");
content.Find("Carlories").GetComponent<Text>().text = item.Rate.ToString("#0");
//game.transform.Find("Content/Rank").GetComponent<Text>().text = (i + 1).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.Time).ToString() : item.TotalDistance.ToString("#0");
game.transform.SetParent(gradeContent);
game.transform.localScale = Vector3.one;
game.SetActive(true);
}
transform.Find("Container/Left/MyRank").GetComponent<Text>().text = data.info.MyRank;
transform.Find("Container/Right/Time").GetComponent<Text>().text = data.info.CreateTime;
}
public void CloseModal()
{
startTime = false;
if (initFunc != null)
{
initFunc.Invoke();
}
Close();
}
}