调整样式
This commit is contained in:
1 parent
19766db051
commit
f065bf4bbb
43 files changed
+2290
-3097
No files matched your search
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user