细节调整

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

@@ -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}";