调整样式

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)
{