细节调整

This commit is contained in:
suntao committed 2021-04-23 09:22:12 +08:00
1 parent dd08f916eb
commit 4347a8eeba
48 files changed
+1855 -400

No files matched your search

+1 -1
View File
@@ -111,7 +111,7 @@ public class Item : PFUIPanel //, IPointerClickHandler
this.Text = model.Name;
this.Distance = model.Distance.ToString("0.0") + "KM";
this.Count = model.TheHeat.ToString();
hot.gameObject.SetActive(model.IsFire);
}
// Start is called before the first frame update
@@ -29,6 +29,8 @@ public class ConnectDeviceModal : PFUIPanel
private VerticalLayoutGroup content;
private PfUIButton connectBtn;
private Dictionary<ushort, DeviceItem> deviceList;
private Text noDevice;
private RectTransform searchIconRect;
protected override void Awake()
{
@@ -42,13 +44,12 @@ public class ConnectDeviceModal : PFUIPanel
var panel = container.Find("Panel");
content = panel.Find("Scroll View").Find("Viewport").Find("Content").GetComponent<VerticalLayoutGroup>();
//Material material = null;
//if (material == null)
//{
// material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
//}
//var rect = ((RectTransform)panel.transform).rect;
//material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, 20f, 0));
noDevice = container.Find("NoDevice").GetComponent<Text>();
searchIconRect = container.Find("SearchIcon").GetComponent<RectTransform>();
_x = searchIconRect.localPosition.x;
_y = searchIconRect.localPosition.y;
base.SetRounded(panel.GetComponent<Image>().transform, 20f);
UIManager.AddEvent(closeBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
@@ -88,7 +89,6 @@ public class ConnectDeviceModal : PFUIPanel
protected override void Start()
{
SearchDevice();
}
@@ -101,6 +101,8 @@ public class ConnectDeviceModal : PFUIPanel
SearchDevice();
timer = 1.0f;
}
Move();
}
private void SearchDevice()
@@ -144,32 +146,19 @@ public class ConnectDeviceModal : PFUIPanel
gameObject.transform.SetParent(content.transform);
var deviceItemObj = gameObject.GetComponent<DeviceItem>();
deviceItemObj.DeviceInfo = device;
UIManager.AddEvent(deviceItemObj.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
{
////deviceItemObj.Select();
//if(deviceItemObj.DeviceInfo.Sensor == SensorType)
//{
// deviceItemObj.DeviceInfo.Connect();
//}
deviceItemObj.Set(true);
foreach (var item in deviceList)
{
if (item.Key != deviceItemObj.DeviceInfo.DeviceNumber)
{
item.Value.Set(false);
//if (item.Value.DeviceInfo.Sensor == SensorType)
//{
// item.Value.DeviceInfo.Disconnect();
//}
}
}
//Close();
}));
//UIManager.AddEvent(deviceItemObj.gameObject, EventTriggerType.Deselect, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
//{
// //Debug.Log("de select");
@@ -190,6 +179,7 @@ public class ConnectDeviceModal : PFUIPanel
firstDevice.Set(true);
//connectBtn.text.text = "DISCOUNECT";
noDevice.text = firstDevice.DeviceInfo.Name;
}
}
}
@@ -200,4 +190,29 @@ public class ConnectDeviceModal : PFUIPanel
base.Close();
DestroyImmediate(this.gameObject);
}
float time = 0;
float _x = 0;
float _y = 0;
void Move()
{
var hudu = (2 * Mathf.PI / 360) * 1 * time;
var x = _x + Mathf.Sin(hudu) * 8f;
var y = _y + Mathf.Cos(hudu) * 8f;
var rect = searchIconRect.localPosition;
//rect.x = x;
//rect.y = y;
rect.x = x;
rect.y = y;
searchIconRect.localPosition = rect;
time += 1.8f;
//Debug.Log(x + ", " + y);
//yield return null;
}
}
+95 -74
View File
@@ -10,6 +10,7 @@ using UnityEngine.Events;
using Assets.Scripts.Devices.Ant.Interfaces;
using Assets.Scripts.UI.UIEffect;
using Assets.Scripts;
using DG.Tweening;
public class DeviceView : MonoBehaviour
{
@@ -36,6 +37,7 @@ public class DeviceView : MonoBehaviour
private Text title;
private Text noDevice;
private Text powerValue;
private Text powerUnit;
//private Text cadenceValue;
//private Text speedValue;
//private Text heartRateValue;
@@ -80,9 +82,7 @@ public class DeviceView : MonoBehaviour
gradient.color1 = Utils.HexToColor("353543");
gradient.color2 = Utils.HexToColor("23232D");
}
}
}
var img2 = connectionPanel.GetComponent<Image>();
if(img2 != null)
@@ -98,7 +98,7 @@ public class DeviceView : MonoBehaviour
}
logo = this.transform.Find("Logo").GetComponent<Image>();
InitLogo();
mDisconnectButton = connectionPanel.transform.Find("DisconnectBtn").gameObject;
var powerValueObj = connectionPanel.transform.Find("PowerValue");
@@ -106,21 +106,14 @@ public class DeviceView : MonoBehaviour
{
powerValue = powerValueObj.gameObject.GetComponent<Text>();
}
//var cadenceValueObj = connectionPanel.transform.Find("CadenceValue");
//if (cadenceValueObj != null) {
// cadenceValue = cadenceValueObj.gameObject.GetComponent<Text>();
//}
//var speedValueObj = connectionPanel.transform.Find("SpeedValue");
//if (speedValueObj != null)
//{
// speedValue = speedValueObj.gameObject.GetComponent<Text>();
//}
//var heartRateValueObj = connectionPanel.transform.Find("HeartRateValue");
//if(heartRateValueObj != null)
//{
// heartRateValue = heartRateValueObj.gameObject.GetComponent<Text>();
//}
var powerUnitObj = connectionPanel.transform.Find("PowerUnit");
if(powerUnitObj != null)
{
powerUnit = powerUnitObj.gameObject.GetComponent<Text>();
}
InitLogo();
connectionPanel.SetActive(false);
@@ -159,26 +152,34 @@ public class DeviceView : MonoBehaviour
sprite0 = Resources.Load<Sprite>("Images/Devices/Power_0");
sprite1 = Resources.Load<Sprite>("Images/Devices/Power_1");
sprite3 = Resources.Load<Sprite>("Images/Devices/Power_3");
powerUnit.text = "W";
}
else if (SensorType == SensorType.SpeedCadence)
{
sprite0 = Resources.Load<Sprite>("Images/Devices/Speed_0");
sprite1 = Resources.Load<Sprite>("Images/Devices/Speed_1");
sprite3 = Resources.Load<Sprite>("Images/Devices/Speed_3");
powerUnit.text = "KPH";
}
else if (SensorType == SensorType.Cadence)
{
sprite0 = Resources.Load<Sprite>("Images/Devices/Cadence_0");
sprite1 = Resources.Load<Sprite>("Images/Devices/Cadence_1");
sprite3 = Resources.Load<Sprite>("Images/Devices/Cadence_3");
powerUnit.text = "RPM";
}
else if (SensorType == SensorType.HeartRate)
{
sprite0 = Resources.Load<Sprite>("Images/Devices/Heart Rate_0");
sprite1 = Resources.Load<Sprite>("Images/Devices/Heart Rate_1");
sprite3 = Resources.Load<Sprite>("Images/Devices/Heart Rate_3");
powerUnit.text = "BPM";
}
else
else if(SensorType == SensorType.Trainer)
{
sprite0 = Resources.Load<Sprite>("Images/Devices/Trainer_0");
sprite1 = Resources.Load<Sprite>("Images/Devices/Trainer_1");
@@ -220,33 +221,8 @@ public class DeviceView : MonoBehaviour
noDevice.text = "NO DEVICE";
searchState.text = "Searching...";
switch (SensorType)
{
case SensorType.None:
break;
case SensorType.Cadence:
title.text = "Cadence Sensor";
break;
case SensorType.HeartRate:
title.text = "Heart Rate Monitor";
break;
case SensorType.Power:
title.text = "Power Meter";
break;
case SensorType.Speed:
break;
case SensorType.SpeedCadence:
title.text = "Speed Meter";
break;
case SensorType.Trainer:
title.text = "Smart Trainer";
break;
case SensorType.VirtualPower:
break;
default:
break;
}
title.text = GetTitle();
var hasDevice = AntConnector.Instance().discoveredDevices.Any(d => d.Sensor == SensorType);
if (hasDevice)
{
@@ -273,45 +249,90 @@ public class DeviceView : MonoBehaviour
else if (connectedDevice.State == DeviceState.Connected)
{
unconnectionPanel.SetActive(false);
connectionPanel.SetActive(true);
if (connectionPanel.activeInHierarchy == false)
{
var connectionCanvasGroup = connectionPanel.GetComponent<CanvasGroup>();
connectionCanvasGroup.alpha = 0;
connectionPanel.SetActive(true);
connectionCanvasGroup.DOFade(1f, .3f);
}
logo.sprite = sprite3;
title.text = connectedDevice.Name;
noDevice.text = connectedDevice.DeviceNumber.ToString();
noDevice.color = Color.white;
switch (SensorType)
if (powerValue != null)
{
case SensorType.None:
break;
case SensorType.Cadence:
//cadenceValue.text = (connectedDevice as ICadenceDevice).Cadence.ToString();
powerValue.text = (connectedDevice as ICadenceDevice).Cadence.ToString();
break;
case SensorType.HeartRate:
powerValue.text = (connectedDevice as IHeartRateDevice).HeartRate.ToString();
break;
case SensorType.Power:
powerValue.text = (connectedDevice as IPowerDevice).Power.ToString();
break;
case SensorType.Speed:
break;
case SensorType.SpeedCadence:
powerValue.text = (connectedDevice as ISpeedDevice).Speed.ToString();
break;
case SensorType.Trainer:
//powerValue.text = (connectedDevice as IPowerDevice).Power.ToString();
//cadenceValue.GetComponent<Text>().text = (connectedDevice as ICadenceDevice).Cadence.ToString();
//speedValue.GetComponent<Text>().text = (connectedDevice as ISpeedDevice).Speed.ToString();
break;
case SensorType.VirtualPower:
break;
default:
break;
powerValue.text = GetValue(connectedDevice);
}
}
}
string GetTitle()
{
switch (SensorType)
{
case SensorType.None:
break;
case SensorType.Cadence:
return "Cadence Sensor";
break;
case SensorType.HeartRate:
return "Heart Rate Monitor";
break;
case SensorType.Power:
return "Power Meter";
break;
case SensorType.Speed:
break;
case SensorType.SpeedCadence:
return "Speed Meter";
break;
case SensorType.Trainer:
return "Smart Trainer";
break;
case SensorType.VirtualPower:
break;
default:
break;
}
return "";
}
string GetValue(AbstractAntDevice connectedDevice)
{
switch (SensorType)
{
case SensorType.None:
break;
case SensorType.Cadence:
//cadenceValue.text = (connectedDevice as ICadenceDevice).Cadence.ToString();
return (connectedDevice as ICadenceDevice).Cadence.ToString();
case SensorType.HeartRate:
return (connectedDevice as IHeartRateDevice).HeartRate.ToString();
case SensorType.Power:
return (connectedDevice as IPowerDevice).Power.ToString();
case SensorType.Speed:
break;
case SensorType.SpeedCadence:
return (connectedDevice as ISpeedDevice).Speed.ToString();
case SensorType.Trainer:
//powerValue.text = (connectedDevice as IPowerDevice).Power.ToString();
//cadenceValue.GetComponent<Text>().text = (connectedDevice as ICadenceDevice).Cadence.ToString();
//speedValue.GetComponent<Text>().text = (connectedDevice as ISpeedDevice).Speed.ToString();
break;
case SensorType.VirtualPower:
break;
default:
break;
}
return "";
}
AbstractAntDevice GetCurrentDevice()
{
return AntConnector.Instance().discoveredDevices.FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType);
@@ -20,6 +20,14 @@ public class PropNames
}
public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
{
float width;
float height;
void Awake()
{
width = this.GetComponent<RectTransform>().rect.width;
height = this.GetComponent<RectTransform>().rect.height;
}
// Start is called before the first frame update
//[SerializeField] Text text;
//[SerializeField] GameObject panel;
@@ -166,4 +174,69 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
UIManager.ShowAlert(r.errMsg);
}
}
public void Show(Vector3 position, NearRouteModel model)
{
//if(position.y > position.z)
//{
// position.y = position.z;
//}
this.Move(position);
this.gameObject.SetActive(true);
//this.SetModel(model);
Initial(new MapRoute
{
Id = model.Id,
Name = model.Name,
Hard = model.Hard,
CoverImage = model.CoverImage,
Enable3D = model.Enable3D,
TheHeat = model.TheHeat,
TotalClimb = model.TotalClimb,
AverageGrade = model.AverageGrade,
CountryCode = model.CountryCode,
AltitudeGraph = model.AltitudeGraph,
Distance = model.Distance
});
}
public void Move(Vector3 position)
{
this.transform.position = position;
var localPosition = this.transform.localPosition;
Debug.Log(localPosition.y);
//localPosition.y = localPosition.y + (287 * 2);
//localPosition.x = localPosition.x - 280;
localPosition.y = localPosition.y + (width * 2);
localPosition.x = localPosition.x - height;
//if (localPosition.y > 128)
//{
// localPosition.y = 128;
//}
//if (localPosition.x < -465)
//{
// localPosition.x = -465f;
//}
//if (localPosition.x > 1080)
//{
// localPosition.x = 1080;
//}
this.transform.localPosition = localPosition;
this.transform.localScale = new Vector2(2, 2);
Debug.Log($"{ this.transform.localPosition.y }, { this.transform.localPosition.y }");
}
public void Hide()
{
DestroyImmediate(this.gameObject);
}
}
@@ -31,14 +31,14 @@ public class BigMapController : PFUIPanel
Sprite end;
private Dictionary<int, LineItem> linesCache = new Dictionary<int, LineItem>();
UnityEngine.Object tipsObject;
private Tips _tips;
private Tips tips
private MapItem _tips;
private MapItem tips
{
get
{
if (_tips == null)
{
_tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
_tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<MapItem>();
}
return _tips;
}
@@ -63,7 +63,7 @@ public class BigMapController : PFUIPanel
mapManager.MaxZoom = 4;
mapManager.OnInitialized += MapManager_OnInitialized;
mapManager.OnUpdated += MapManager_OnUpdated;
//// mapManager.OnTileFinished += MapManager_OnTileFinished;
//mapManager.SetZoom(13);
//mapManager.SetCenterLatitudeLongitude(new Mapbox.Utils.Vector2d(32.051203, 118.771572));
@@ -74,7 +74,7 @@ public class BigMapController : PFUIPanel
canvas.GetComponent<Canvas>().worldCamera = Camera.main;
var goList = canvas.transform.Find("SwitchMode");
SetRounded(goList, 64);
UIManager.AddEvent(goList.gameObject, EventTriggerType.PointerClick, (e) =>
UIManager.AddEvent(goList.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
{
mapManager.Destroy();
UIManager.ShowMapListPanel();
@@ -92,11 +92,13 @@ public class BigMapController : PFUIPanel
var searchBtn = input.Find("Search").gameObject;
UIManager.AddEvent(searchBtn, EventTriggerType.PointerClick, Search);
tipsObject = Resources.Load("UI/Prefab/BigMap/Tips");
tipsObject = Resources.Load("UI/Prefab/MapList/MapItem");
//tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
//tips.Hide();
BindHeadImage();
}
/// <summary>
/// 绑定头像
@@ -276,7 +278,7 @@ public class BigMapController : PFUIPanel
lineRender.material = new Material(Shader.Find("Sprites/Default"));
line.LineObject = direct;
lineRender.startColor = lineRender.endColor = Utils.HexToColor("F93086");
lineRender.startColor = lineRender.endColor = Color.white; //Utils.HexToColor("F93086");
//设置宽度
lineRender.startWidth = 1.2f;
@@ -307,10 +309,10 @@ public class BigMapController : PFUIPanel
line.Item = iii;
iii.onClick = () =>
{
if(tips != null)
if(_tips != null)
{
tips.Hide();
tips = null;
_tips.Hide();
_tips = null;
}
if (line.Selected)
{
@@ -411,6 +413,21 @@ public class BigMapController : PFUIPanel
{
//Debug.Log(Input.mousePosition.x + "," + Input.mousePosition.y + "," + Input.mousePosition.z);
//timer += Time.deltaTime;
//鼠标点击空白处,清除选择的路线
if (Input.GetMouseButtonDown(0) && EventSystem.current.IsPointerOverGameObject() == false)
{
var line = linesCache.Select(d=>d.Value).FirstOrDefault(l => l.Selected);
if(line != null)
{
line.Selected = false;
if (_tips != null)
{
_tips.Hide();
_tips = null;
}
}
}
}
public override void Show()
@@ -427,7 +444,7 @@ public class BigMapController : PFUIPanel
//base.Close();
DestroyImmediate(this.gameObject);
}
}
class LineItem
{
@@ -454,11 +471,11 @@ public class BigMapController : PFUIPanel
var lineRender = LineObject.GetComponent<LineRenderer>();
if (value)
{
lineRender.startColor = lineRender.endColor = Color.white;
lineRender.startColor = lineRender.endColor = Utils.HexToColor("F93086");
}
else
{
lineRender.startColor = lineRender.endColor = Utils.HexToColor("F93086");
lineRender.startColor = lineRender.endColor = Color.white;
}
}
}
@@ -16,10 +16,41 @@ public class DeviceController : PFUIPanel
private Image antStatus;
private Sprite ant0;
private Sprite ant1;
private Sprite circuloCarga;
private Sprite circuloCompleto;
RectTransform circulo;
private bool _available = false;
private bool Available
{
get
{
return _available;
}
set
{
if (value == _available)
return;
_available = value;
if (_available)
{
antStatus.sprite = ant1;
//circulo.gameObject.SetActive(false);
DOTween.Kill(circulo, false);
circulo.GetComponent<Image>().sprite = circuloCompleto;
}
else
{
antStatus.sprite = ant0;
//circulo.gameObject.SetActive(true);
circulo.GetComponent<Image>().sprite = circuloCarga;
circulo.DOLocalRotate(new Vector3(0, 0, 360), 1f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
}
}
}
protected override void Awake()
{
base.Awake();
AntConnector.Instance();
Debug.Log("device awake");
}
@@ -49,9 +80,14 @@ public class DeviceController : PFUIPanel
var bg = this.transform.Find("Status").Find("Bg");
antStatus = bg.Find("Ant+").GetComponent<Image>();
circulo = bg.Find("Image").GetComponent<RectTransform>();
//circulo.DORotate(new Vector3(0, 0, 360), 1.5f, RotateMode.Fast).SetLoops(-1);
circulo.DOLocalRotate(new Vector3(0, 0, 360), 1f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
ant0 = Resources.Load<Sprite>("Images/ANT+_0");
ant1 = Resources.Load<Sprite>("Images/ANT+_2");
circuloCarga = Resources.Load<Sprite>("Images/icon-circulo-carga");
circuloCompleto = Resources.Load<Sprite>("Images/icon-circulo-completo");
base.SetRounded(bg, 64);
}
@@ -63,27 +99,14 @@ public class DeviceController : PFUIPanel
timer -= Time.deltaTime;
if (timer <= 0)
{
if (AntConnector.Instance().IsAvailable)
{
antStatus.sprite = ant1;
}
else
{
antStatus.sprite = ant0;
}
//this.toggle.isOn = AntConnector.Instance().IsAvailable;
//foreach (var item in AntConnector.Instance().discoveredDevices)
Available = AntConnector.Instance().IsAvailable;
//if (AntConnector.Instance().IsAvailable)
//{
// if (!devices.ContainsKey(item.DeviceNumber))
// {
// var dev1 = Instantiate(device);
// dev1.transform.SetParent(this.grid.transform);
// var s1 = dev1.GetComponent<Assets.Scripts.UI.Devicea>();
// s1.Device = item;
// devices.Add(item.DeviceNumber, dev1);
// }
// antStatus.sprite = ant1;
//}
//else
//{
// antStatus.sprite = ant0;
//}
timer = 1.0f;
@@ -99,8 +122,8 @@ public class DeviceController : PFUIPanel
cg.DOFade(1f, 0.3f);
}
private void OnApplicationQuit()
protected override void OnDisable()
{
AntConnector.Instance().Dispose();
}
}
@@ -35,20 +35,8 @@ public class HomeController : PFUIPanel
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
mainNav.ShowExit();
//var parent = Utils.FindUpParent(gameObject.transform);
//if (parent.Find("ToastContainer") == null)
//{
// var toast = Instantiate(Resources.Load<GameObject>("UI/Prefab/ToastContainer"));
// toast.name = "ToastContainer";
// toast.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
// toast.transform.parent = parent;
//}
//if (More != null)
//{
// More.onClick.AddListener(MoreFunc);
//}
BtnRide.onClick.AddListener(GoRide);
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerClick, GoRide);
var avatar = userInfo.Find("Avatar").GetComponent<RawImage>();
var rect = ((RectTransform)avatar.transform).rect;
@@ -58,41 +46,25 @@ public class HomeController : PFUIPanel
{
UIManager.ShowUserInfoPanel();
});
userInfo.Find("BtnMore").GetComponent<PfUIButton>().SetEnabled(false);
UIManager.AddEvent(userInfo.Find("BtnMore").gameObject, EventTriggerType.PointerClick, x =>
{
UIManager.ShowAlert("test");
UIManager.ShowUserInfoPanel();
//UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", null);
});
GetSummary();
}
}
private async Task Login()
{
var result = await new UserApi().Login("13115011550", "laozhong", "");
App.CurrentUser = result.data;
}
private void GoRide()
private void GoRide(BaseEventData e)
{
UIManager.ShowMapListPanel();
//SceneManager.LoadScene("3-MapList");
//DOTween.To()
//this.transform.DOLocalMove(new Vector2(1000, 0), 2.0f).SetEase(Ease.InOutExpo).OnComplete(() =>
//{
//Loom.QueueOnMainThread(() =>
//{
// Debug.Log("ddddddddddddddddddddddddddd");
//});
//});
}
void MoreFunc()
{
//Utils.showToast(gameObject, "更多信息", 1);
//DOTween.ToAlpha(() => )
//DOTween.ToAlpha(() => )
}
void SetCurrentUser(SummaryResultModel summary)
@@ -101,25 +73,29 @@ public class HomeController : PFUIPanel
userInfo.Find("GroupTop").Find("FtpContainer").Find("FtpValue").GetComponent<Text>().text = App.CurrentUser.FTP.ToString();
userInfo.Find("GroupTop").Find("WeightContainer").Find("WeightValue").GetComponent<Text>().text = App.CurrentUser.Weight.ToString();
userInfo.Find("GroupTop").Find("WKGContainer").Find("WKGValue").GetComponent<Text>().text = $"{ (App.CurrentUser.FTP/ App.CurrentUser.Weight).ToString("0.0") }";
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = summary.Kcal +" KCAL";
userInfo.Find("IDText").GetComponent<Text>().text = "ID:" + App.CurrentUser.Id.ToString("000000");
if (!string.IsNullOrWhiteSpace(App.CurrentUser.Unionid))
{
userInfo.Find("Wx").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/Wechat_person_1");
}
if (App.CurrentUser.Sex == 2)
{
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
}
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = double.Parse(summary.Kcal).ToString("0") +" KCAL";
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString("0") +" KM";
userInfo.Find("ClimbContainer").Find("ClimbValue").GetComponent<Text>().text = summary.TotalClimb +" M";
userInfo.Find("IDText").GetComponent<Text>().text = "ID:"+App.CurrentUser.Id.ToString("000000");
//var user = ConfigHelper.CurrentUser;
//Ftp.text = summary.Ftp.ToString();
//Weight.text = user.Weight.ToString();
//WKG.text = $"{user.Weight}KG/{user.BicycleWeight}KG";
//NickName.text = user.Nickname;
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
userInfo.Find("GroupTop").Find("FtpContainer").Find("FtpTime").GetComponent<Text>().text = App.CurrentUser.LastUpdateFtpTime.ToString("yyyy.MM.dd");
userInfo.Find("GroupTop").Find("WeightContainer").Find("WeightTime").GetComponent<Text>().text = App.CurrentUser.LastUpdateWeightTime.ToString("yyyy.MM.dd");
}
async void GetSummary()
void GetSummary()
{
if (App.CurrentUser == null)
{
await Login();
}
var res = ConfigHelper.userApi.GetSummary();
if (res.result)
{
@@ -50,7 +50,7 @@ public class MapListController : PFUIPanel
//ApiBase.SetCookie("15A37DF28842CBA8E4E550BFA24186C8222D392F3EE18D9E95A49CC32796D2E3F6E40385C6A114942546EE1DD793DF34880DE48090B91AD2460EB887B59664BB3965F3371DDA1F1401EC7F27C5A1084566E47069F12CB6BBC0BC7A84ADC5582B");
btnMapMode = this.transform.Find("SwitchMode").gameObject;
SetRounded(btnMapMode.transform, 64);
UIManager.AddEvent(btnMapMode, EventTriggerType.PointerClick, (e) =>
UIManager.AddEvent(btnMapMode.transform.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
{
UIManager.ShowBigMapPanel();
});
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class UserInfoController : PFUIPanel
{
@@ -17,7 +18,7 @@ public class UserInfoController : PFUIPanel
Button exitBtn = this.transform.Find("InfoPanel").Find("Button").GetComponent<Button>();
UIManager.AddEvent(exitBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
UIManager.AddEvent(exitBtn.gameObject, EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowHomePanel();
});
@@ -26,13 +27,13 @@ public class UserInfoController : PFUIPanel
// UIManager.ShowHomePanel();
//});
UIManager.AddEvent(transform.Find("InfoPanel").Find("SwitchAccountButton").gameObject,
UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
EventTriggerType.PointerClick, (b) =>
{
SceneManager.LoadScene("1-Login");
});
infoPanel = transform.Find("InfoPanel").Find("P");
Button editBtn = infoPanel.Find("EditButton").GetComponent<Button>();
UIManager.AddEvent(editBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
UIManager.AddEvent(editBtn.gameObject, EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowEditUserPanel();
});
@@ -64,7 +65,7 @@ public class UserInfoController : PFUIPanel
= UIManager.Instance.loginRegOptions.GetCountryImageByName(user.Country);
infoPanel.Find("Status").Find("Wx").gameObject.SetActive(
!string.IsNullOrEmpty(user.Unionid));
infoPanel.Find("IdText").GetComponent<Text>().text = $"ID:{user.Id}";
infoPanel.Find("IdText").GetComponent<Text>().text = $"ID:{user.Id.ToString("000000")}";
infoPanel.Find("NameText").GetComponent<Text>().text = $"{user.Nickname}";
infoPanel.Find("EmailText").GetComponent<Text>().text = $"{user.Phone}";