伴侣骑行
This commit is contained in:
1 parent
34cde86a28
commit
7744eec847
42 files changed
+18737
-13497
No files matched your search
@@ -0,0 +1,55 @@
|
||||
using Assets.Scripts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
public class ReviewItemScript : MonoBehaviour
|
||||
{
|
||||
private RawImage Head;
|
||||
private Text Name;
|
||||
private Text Distance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Head = transform.Find("Head").GetComponent<RawImage>();
|
||||
Name = transform.Find("Name").GetComponent<Text>();
|
||||
Distance = transform.Find("Distance").GetComponent<Text>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
public void SetName(string name)
|
||||
{
|
||||
Name.text = name;
|
||||
}
|
||||
|
||||
public void SetHead(string url)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine,Head,url);
|
||||
var rect = ((RectTransform)Head.transform).rect;
|
||||
Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
Head.material = material;
|
||||
}
|
||||
|
||||
public void SetDistance(double distance)
|
||||
{
|
||||
_distance = distance;
|
||||
var prefix = distance > 0 ? "+" : "";
|
||||
Distance.text = prefix + distance.ToString() + "M";
|
||||
}
|
||||
private double _distance;
|
||||
public double GetDistance()
|
||||
{
|
||||
return _distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user