完成大地图主要界面
This commit is contained in:
1 parent
5156473bb2
commit
d22eecd133
78 files changed
+8684
-6941
No files matched your search
@@ -0,0 +1,111 @@
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Tips : MonoBehaviour
|
||||
{
|
||||
public NearRouteModel Model
|
||||
{
|
||||
get
|
||||
{
|
||||
return _model;
|
||||
}
|
||||
}
|
||||
|
||||
private Text Name;
|
||||
private Text Count;
|
||||
private Text Distance;
|
||||
private Text TotalClimb;
|
||||
private PFUIButton pFUIButton;
|
||||
private void Awake()
|
||||
{
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
|
||||
var rect = ((RectTransform)transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, 40f, 0));
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
Name = this.transform.Find("Name").GetComponent<Text>();
|
||||
Count = this.transform.Find("Count").GetComponent<Text>();
|
||||
Distance = this.transform.Find("Distance").GetComponent<Text>();
|
||||
TotalClimb = this.transform.Find("TotalClimb").GetComponent<Text>();
|
||||
|
||||
pFUIButton = this.transform.Find("Ride").GetComponent<PFUIButton>();
|
||||
UIManager.AddEvent(pFUIButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) => {
|
||||
App.RouteIdParam = _model.Id;
|
||||
SceneManager.LoadScene("Ride");
|
||||
});
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
NearRouteModel _model;
|
||||
public void SetModel(NearRouteModel model)
|
||||
{
|
||||
if (this.isActiveAndEnabled)
|
||||
{
|
||||
if(_model.Id == model.Id)
|
||||
{
|
||||
//this.gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//this.gameObject.SetActive(true);
|
||||
_model = model;
|
||||
|
||||
Name.text = _model.Name;
|
||||
|
||||
Count.text = _model.TheHeat.ToString();
|
||||
Distance.text = _model.Distance.ToString("#.0")+"KM";
|
||||
TotalClimb.text = _model.TotalClimb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Show(Vector3 position, NearRouteModel model)
|
||||
{
|
||||
//if(position.y > position.z)
|
||||
//{
|
||||
// position.y = position.z;
|
||||
//}
|
||||
this.transform.position = position;
|
||||
|
||||
var localPosition = this.transform.localPosition;
|
||||
if (localPosition.y + 150 > localPosition.z)
|
||||
{
|
||||
localPosition.y = localPosition.z -150;
|
||||
}
|
||||
if(localPosition.x * -1f > localPosition.z)
|
||||
{
|
||||
localPosition.x = localPosition.z * -1f;
|
||||
}
|
||||
else if(localPosition.x > localPosition.z *2)
|
||||
{
|
||||
localPosition.x = localPosition.z * 2;
|
||||
}
|
||||
this.transform.localPosition = localPosition;
|
||||
this.transform.localScale = new Vector2(2, 2);
|
||||
this.SetModel(model);
|
||||
//tips.Show();
|
||||
this.gameObject.SetActive(true);
|
||||
}
|
||||
public void Hide()
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user