完成大地图主要界面
This commit is contained in:
1 parent
5156473bb2
commit
d22eecd133
78 files changed
+8684
-6941
No files matched your search
@@ -0,0 +1,117 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.UIEffect;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Item : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
private Text text;
|
||||
|
||||
private string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return text.text;
|
||||
}
|
||||
set
|
||||
{
|
||||
text.text = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Text km;
|
||||
private string Distance
|
||||
{
|
||||
get
|
||||
{
|
||||
return km.text;
|
||||
}
|
||||
set
|
||||
{
|
||||
km.text = value;
|
||||
}
|
||||
}
|
||||
private Text count;
|
||||
private string Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return count.text;
|
||||
}
|
||||
set
|
||||
{
|
||||
count.text = value;
|
||||
}
|
||||
}
|
||||
public Action onClick;
|
||||
private void Awake()
|
||||
{
|
||||
text = this.transform.Find("name").GetComponent<Text>();
|
||||
km = this.transform.Find("km").GetComponent<Text>();
|
||||
count = this.transform.Find("count").GetComponent<Text>();
|
||||
|
||||
Material material = null;
|
||||
if (material == null)
|
||||
{
|
||||
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
public void Selected(bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
this.GetComponent<UIGradient>().enabled = true;
|
||||
this.GetComponent<UIGradient>().color1 = Utils.HexToColor("FF7485");
|
||||
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;
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetModel(NearRouteModel model)
|
||||
{
|
||||
this.Text = model.Name;
|
||||
this.Distance = model.Distance + "KM";
|
||||
this.Count = model.TheHeat.ToString();
|
||||
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if(onClick != null)
|
||||
{
|
||||
onClick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user