调整样式

This commit is contained in:
suntao committed 2021-04-19 14:36:08 +08:00
1 parent 19766db051
commit f065bf4bbb
43 files changed
+2290 -3097

No files matched your search

+29 -9
View File
@@ -8,7 +8,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class Item : MonoBehaviour, IPointerClickHandler
public class Item : PFUIPanel //, IPointerClickHandler
{
private Text text;
@@ -49,7 +49,8 @@ public class Item : MonoBehaviour, IPointerClickHandler
}
}
public Action onClick;
private void Awake()
private Transform hot;
protected override void Awake()
{
text = this.transform.Find("name").GetComponent<Text>();
km = this.transform.Find("km").GetComponent<Text>();
@@ -63,6 +64,11 @@ public class Item : MonoBehaviour, IPointerClickHandler
var rect = ((RectTransform)transform).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.5f, 0));
this.GetComponent<Image>().material = material;
hot = this.transform.Find("Hot");
SetRounded(hot, 17);
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerClick, OnPointerClick);
}
public void Selected(bool value)
@@ -74,28 +80,42 @@ public class Item : MonoBehaviour, IPointerClickHandler
this.GetComponent<UIGradient>().color2 = Utils.HexToColor("F93086");
this.GetComponent<Image>().color = Color.white;
this.transform.Find("km").GetComponent<Text>().color = Color.white;
this.transform.Find("count").GetComponent<Text>().color = Color.white;
km.color = Color.white;
count.color = Color.white;
this.transform.Find("DistanceIcon").GetComponent<Image>().color = Color.white;
this.transform.Find("BikeIcon").GetComponent<Image>().color = Color.white;
hot.GetComponent<UIGradient>().color1 = Color.white;
hot.GetComponent<UIGradient>().color2 = Color.white;
hot.Find("PFUIText").GetComponent<Text>().color = Utils.HexToColor("F93086");
}
else
{
this.GetComponent<UIGradient>().enabled = false;
this.GetComponent<Image>().color = Utils.HexToColor("353543");
this.transform.Find("km").GetComponent<Text>().color = Utils.HexToColor("5C5C6E");
this.transform.Find("count").GetComponent<Text>().color = Utils.HexToColor("F93086");
km.color = Utils.HexToColor("5C5C6E");
count.color = Utils.HexToColor("F93086");
this.transform.Find("DistanceIcon").GetComponent<Image>().color = Utils.HexToColor("5C5C6E");
this.transform.Find("BikeIcon").GetComponent<Image>().color = Utils.HexToColor("F93086");
hot.GetComponent<UIGradient>().color1 = Utils.HexToColor("FF7485");
hot.GetComponent<UIGradient>().color2 = Utils.HexToColor("F93086");
hot.Find("PFUIText").GetComponent<Text>().color = Color.white;
}
}
public void SetModel(NearRouteModel model)
{
this.Text = model.Name;
this.Distance = model.Distance + "KM";
this.Distance = model.Distance.ToString("0.0") + "KM";
this.Count = model.TheHeat.ToString();
}
// Start is called before the first frame update
void Start()
protected override void Start()
{
}
@@ -106,7 +126,7 @@ public class Item : MonoBehaviour, IPointerClickHandler
}
public void OnPointerClick(PointerEventData eventData)
public void OnPointerClick(BaseEventData eventData)
{
if(onClick != null)
{
+17 -6
View File
@@ -9,6 +9,7 @@ using UnityEngine.SceneManagement;
using UnityEngine.UI;
using System;
using System.Linq;
using Assets.Scripts;
public class Tips : MonoBehaviour
{
@@ -30,6 +31,7 @@ public class Tips : MonoBehaviour
private List<CountryModel> countryList;
private GameObject level;
private GameObject m3DIcon;
private RawImage altitudeGraph;
private void Awake()
{
var materialSource = Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial");
@@ -63,6 +65,8 @@ public class Tips : MonoBehaviour
level.GetComponent<Image>().material = material1;
m3DIcon = this.transform.Find("3DIcon").gameObject;
altitudeGraph = this.transform.Find("AltitudeGraph").GetComponent<RawImage>();
}
// Start is called before the first frame update
@@ -81,7 +85,7 @@ public class Tips : MonoBehaviour
{
if (this.isActiveAndEnabled)
{
if(_model.Id == model.Id)
if(_model != null && _model.Id == model.Id)
{
//this.gameObject.SetActive(false);
return;
@@ -94,10 +98,10 @@ public class Tips : MonoBehaviour
Name.text = _model.Name;
Count.text = _model.TheHeat.ToString();
Distance.text = _model.Distance.ToString("#.0")+"KM";
TotalClimb.text = _model.TotalClimb.ToString();
Distance.text = _model.Distance.ToString("0.0")+"KM";
TotalClimb.text = _model.TotalClimb.ToString("0") +"FT";
averageGrade.text = _model.AverageGrade.ToString() + "%";
averageGrade.text = _model.AverageGrade.ToString("0.0") + "%";
//var country = countryList.SingleOrDefault(r => r.abbreviation.Equals(_model.CountryCode, StringComparison.InvariantCultureIgnoreCase));
//if(country )
@@ -110,7 +114,12 @@ public class Tips : MonoBehaviour
level.transform.Find("Text").GetComponent<Text>().text = _model.Hard;
m3DIcon.SetActive(_model.Enable3D);
//altitudeGraph
Utils.DisplayImage(StartCoroutine, altitudeGraph, _model.AltitudeGraph);
//Utils.DisplayImage(StartCoroutine, altitudeGraph, "http://192.168.0.97:5082/Map/AltitudeGraph?id=1215");
}
@@ -137,9 +146,11 @@ public class Tips : MonoBehaviour
}
this.transform.localPosition = localPosition;
this.transform.localScale = new Vector2(2, 2);
this.SetModel(model);
//tips.Show();
this.gameObject.SetActive(true);
this.SetModel(model);
}
public void Hide()
{
@@ -42,15 +42,14 @@ 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));
panel.GetComponent<Image>().material = material;
//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));
base.SetRounded(panel.GetComponent<Image>().transform, 20f);
UIManager.AddEvent(closeBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
{
@@ -39,6 +39,7 @@ public class BigMapController : PFUIPanel
begin = Resources.Load("UI/Prefab/BigMap/Begin");
mapManager = this.transform.Find("Map").GetComponent<AbstractMap>();
mapManager.MaxZoom = 4;
mapManager.OnInitialized += MapManager_OnInitialized;
mapManager.OnUpdated += MapManager_OnUpdated;
@@ -57,7 +58,7 @@ public class BigMapController : PFUIPanel
mapManager.Destroy();
UIManager.ShowMapListPanel();
//this.gameObject.SetActive(false);
DestroyImmediate(this.gameObject);
//DestroyImmediate(this.gameObject);
});
var panel = canvas.transform.Find("Panel");
@@ -91,7 +92,7 @@ public class BigMapController : PFUIPanel
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
{
UIManager.ShowEditUserPanel();
UIManager.ShowUserInfoPanel();
});
}
@@ -126,6 +127,8 @@ public class BigMapController : PFUIPanel
}
private void MapManager_OnUpdated()
{
Debug.Log("update");
foreach (var item in linesCache)
{
//if(item.Value.LineObject != null)
@@ -40,14 +40,19 @@ public class DeviceController : PFUIPanel
//UIManager.CloseModal();
this.Close();
}));
//UIManager.AddEvent(mReturnBtn.gameObject, EventTriggerType.PointerUp, (e) =>
//{
// Debug.Log("aaaaaaaaaaaaaa");
//});
var bg = this.transform.Find("Status").Find("Bg");
antStatus = bg.Find("Ant+").GetComponent<Image>();
ant0 = Resources.Load<Sprite>("Images/ANT+_0");
ant1 = Resources.Load<Sprite>("Images/ANT+_1");
ant1 = Resources.Load<Sprite>("Images/ANT+_2");
Debug.Log("device start");
base.SetRounded(bg, 64);
}
@@ -100,9 +100,10 @@ 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.Weight}kg/{App.CurrentUser.BicycleWeight}kg";
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = summary.Kcal;
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString();
userInfo.Find("ClimbContainer").Find("ClimbValue").GetComponent<Text>().text = summary.TotalClimb;
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = summary.Kcal +" 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;
//var user = ConfigHelper.CurrentUser;
//Ftp.text = summary.Ftp.ToString();
//Weight.text = user.Weight.ToString();
@@ -148,4 +149,9 @@ public class HomeController : PFUIPanel
{
}
public override void Show()
{
base.Show();
}
}
@@ -205,7 +205,7 @@ public class MapListController : PFUIPanel
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
{
UIManager.ShowEditUserPanel();
UIManager.ShowUserInfoPanel();
});
}
@@ -5,6 +5,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
@@ -23,8 +24,10 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
string titleColor = "#5c5c6e";
RouteResult data;
public void Initial(RouteResult result)
{
data = result;
left = transform.Find("Left");
row1 = left.Find("Main").Find("Row1");
row2 = left.Find("Main").Find("Row2");
@@ -61,17 +64,23 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
private void Delete()
{
throw new NotImplementedException();
//throw new NotImplementedException();
UIManager.ShowAlert("暂未实现");
}
private void GoReRide()
{
throw new NotImplementedException();
//throw new NotImplementedException();
//UIManager.ShowAlert("去骑行");
App.RouteIdParam = data.RouteId;
SceneManager.LoadScene("Ride");
}
private void GoContinue()
{
throw new NotImplementedException();
//throw new NotImplementedException();
UIManager.ShowAlert("暂未实现");
}
public void OnPointerExit(PointerEventData eventData)