细节调整
This commit is contained in:
1 parent
038720e7bd
commit
e04ae0b085
24 files changed
+2012
-262
No files matched your search
@@ -1,10 +1,14 @@
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using Assets.Scripts.UI.Prefab.Login;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public class Tips : MonoBehaviour
|
||||
{
|
||||
@@ -20,10 +24,16 @@ public class Tips : MonoBehaviour
|
||||
private Text Count;
|
||||
private Text Distance;
|
||||
private Text TotalClimb;
|
||||
private PFUIButton pFUIButton;
|
||||
private PfUIButton pFUIButton;
|
||||
private RawImage countryIcon;
|
||||
private Text averageGrade;
|
||||
private List<CountryModel> countryList;
|
||||
private GameObject level;
|
||||
private GameObject m3DIcon;
|
||||
private void Awake()
|
||||
{
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
var materialSource = Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial");
|
||||
var material = Instantiate(materialSource);
|
||||
|
||||
var rect = ((RectTransform)transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, 40f, 0));
|
||||
@@ -34,11 +44,25 @@ public class Tips : MonoBehaviour
|
||||
Distance = this.transform.Find("Distance").GetComponent<Text>();
|
||||
TotalClimb = this.transform.Find("TotalClimb").GetComponent<Text>();
|
||||
|
||||
pFUIButton = this.transform.Find("Ride").GetComponent<PFUIButton>();
|
||||
pFUIButton = this.transform.Find("Ride").GetComponent<PfUIButton>();
|
||||
UIManager.AddEvent(pFUIButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) => {
|
||||
App.RouteIdParam = _model.Id;
|
||||
SceneManager.LoadScene("Ride");
|
||||
});
|
||||
|
||||
averageGrade = this.transform.Find("AverageGrade").GetComponent<Text>();
|
||||
countryIcon = this.transform.Find("CountryIco").GetComponent<RawImage>();
|
||||
|
||||
var countryJson = Resources.Load<TextAsset>("UI/flags-mini").text;
|
||||
countryList = JsonConvert.DeserializeObject<List<CountryModel>>(countryJson);
|
||||
|
||||
level = this.transform.Find("Level").gameObject;
|
||||
var material1 = Instantiate(materialSource);
|
||||
var rect1 = ((RectTransform)level.transform).rect;
|
||||
material1.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect1.width, rect1.height, rect1.height, 0));
|
||||
level.GetComponent<Image>().material = material1;
|
||||
|
||||
m3DIcon = this.transform.Find("3DIcon").gameObject;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -63,17 +87,30 @@ public class Tips : MonoBehaviour
|
||||
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();
|
||||
|
||||
averageGrade.text = _model.AverageGrade.ToString() + "%";
|
||||
|
||||
//var country = countryList.SingleOrDefault(r => r.abbreviation.Equals(_model.CountryCode, StringComparison.InvariantCultureIgnoreCase));
|
||||
//if(country )
|
||||
var country = Resources.Load<Sprite>($"UI/flags-mini/{ _model.CountryCode.ToLower() }");
|
||||
if(country != null)
|
||||
{
|
||||
//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();
|
||||
countryIcon.texture = country.texture;
|
||||
}
|
||||
|
||||
level.transform.Find("Text").GetComponent<Text>().text = _model.Hard;
|
||||
|
||||
m3DIcon.SetActive(_model.Enable3D);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user