调整样式
This commit is contained in:
1 parent
19766db051
commit
f065bf4bbb
43 files changed
+2290
-3097
No files matched your search
@@ -41,7 +41,7 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log(e.ToString());
|
||||
Debug.LogError(e.ToString());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,5 +33,9 @@ namespace Assets.Scripts.Apis.Models
|
||||
public bool IsFavorite { get; set; }
|
||||
|
||||
public bool Enable3D { get; set; }
|
||||
/// <summary>
|
||||
/// 海拔线
|
||||
/// </summary>
|
||||
public string AltitudeGraph { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace Assets.Scripts.Apis.Models
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string RankingsId { get; set; }
|
||||
public List<string> RankingsId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static string Host = "http://192.168.0.101:5082/";
|
||||
public static string Host = "http://192.168.0.97:5082/";
|
||||
|
||||
public static string AppVersion = "1.0.0";
|
||||
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MainController : MonoBehaviour
|
||||
{
|
||||
[SerializeField]GameObject root;
|
||||
private Text Version;
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
Version = this.transform.Find("Version").GetComponent<Text>();
|
||||
Version.text = "Version:"+App.AppVersion;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Assets.Scripts.UI.Control
|
||||
outline.enabled = false;
|
||||
}
|
||||
|
||||
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>(this.OnSelect));
|
||||
//UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>(this.OnSelect));
|
||||
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>(this.OnSelect));
|
||||
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>(this.OnDeselect));
|
||||
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerEnter, new UnityAction<BaseEventData>((e) =>
|
||||
|
||||
@@ -4,10 +4,16 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public class PfText : PFUIComponentBase
|
||||
[RequireComponent(typeof(Text))]
|
||||
public class PFUIText : PFUIComponentBase
|
||||
{
|
||||
protected void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Assets.Scripts;
|
||||
|
||||
public class Tips : MonoBehaviour
|
||||
{
|
||||
@@ -30,6 +31,7 @@ public class Tips : MonoBehaviour
|
||||
private List<CountryModel> countryList;
|
||||
private GameObject level;
|
||||
private GameObject m3DIcon;
|
||||
private RawImage altitudeGraph;
|
||||
private void Awake()
|
||||
{
|
||||
var materialSource = Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial");
|
||||
@@ -63,6 +65,8 @@ public class Tips : MonoBehaviour
|
||||
level.GetComponent<Image>().material = material1;
|
||||
|
||||
m3DIcon = this.transform.Find("3DIcon").gameObject;
|
||||
|
||||
altitudeGraph = this.transform.Find("AltitudeGraph").GetComponent<RawImage>();
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -81,7 +85,7 @@ public class Tips : MonoBehaviour
|
||||
{
|
||||
if (this.isActiveAndEnabled)
|
||||
{
|
||||
if(_model.Id == model.Id)
|
||||
if(_model != null && _model.Id == model.Id)
|
||||
{
|
||||
//this.gameObject.SetActive(false);
|
||||
return;
|
||||
@@ -94,10 +98,10 @@ public class Tips : MonoBehaviour
|
||||
Name.text = _model.Name;
|
||||
|
||||
Count.text = _model.TheHeat.ToString();
|
||||
Distance.text = _model.Distance.ToString("#.0")+"KM";
|
||||
TotalClimb.text = _model.TotalClimb.ToString();
|
||||
Distance.text = _model.Distance.ToString("0.0")+"KM";
|
||||
TotalClimb.text = _model.TotalClimb.ToString("0") +"FT";
|
||||
|
||||
averageGrade.text = _model.AverageGrade.ToString() + "%";
|
||||
averageGrade.text = _model.AverageGrade.ToString("0.0") + "%";
|
||||
|
||||
//var country = countryList.SingleOrDefault(r => r.abbreviation.Equals(_model.CountryCode, StringComparison.InvariantCultureIgnoreCase));
|
||||
//if(country )
|
||||
@@ -110,7 +114,12 @@ public class Tips : MonoBehaviour
|
||||
level.transform.Find("Text").GetComponent<Text>().text = _model.Hard;
|
||||
|
||||
m3DIcon.SetActive(_model.Enable3D);
|
||||
|
||||
|
||||
|
||||
//altitudeGraph
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, altitudeGraph, _model.AltitudeGraph);
|
||||
//Utils.DisplayImage(StartCoroutine, altitudeGraph, "http://192.168.0.97:5082/Map/AltitudeGraph?id=1215");
|
||||
}
|
||||
|
||||
|
||||
@@ -137,9 +146,11 @@ public class Tips : MonoBehaviour
|
||||
}
|
||||
this.transform.localPosition = localPosition;
|
||||
this.transform.localScale = new Vector2(2, 2);
|
||||
this.SetModel(model);
|
||||
|
||||
//tips.Show();
|
||||
this.gameObject.SetActive(true);
|
||||
|
||||
this.SetModel(model);
|
||||
}
|
||||
public void Hide()
|
||||
{
|
||||
|
||||
@@ -42,15 +42,14 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
var panel = container.Find("Panel");
|
||||
content = panel.Find("Scroll View").Find("Viewport").Find("Content").GetComponent<VerticalLayoutGroup>();
|
||||
|
||||
Material material = null;
|
||||
if (material == null)
|
||||
{
|
||||
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
}
|
||||
var rect = ((RectTransform)panel.transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, 20f, 0));
|
||||
panel.GetComponent<Image>().material = material;
|
||||
|
||||
//Material material = null;
|
||||
//if (material == null)
|
||||
//{
|
||||
// material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
//}
|
||||
//var rect = ((RectTransform)panel.transform).rect;
|
||||
//material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, 20f, 0));
|
||||
base.SetRounded(panel.GetComponent<Image>().transform, 20f);
|
||||
|
||||
UIManager.AddEvent(closeBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ public class BigMapController : PFUIPanel
|
||||
begin = Resources.Load("UI/Prefab/BigMap/Begin");
|
||||
|
||||
mapManager = this.transform.Find("Map").GetComponent<AbstractMap>();
|
||||
mapManager.MaxZoom = 4;
|
||||
mapManager.OnInitialized += MapManager_OnInitialized;
|
||||
mapManager.OnUpdated += MapManager_OnUpdated;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class BigMapController : PFUIPanel
|
||||
mapManager.Destroy();
|
||||
UIManager.ShowMapListPanel();
|
||||
//this.gameObject.SetActive(false);
|
||||
DestroyImmediate(this.gameObject);
|
||||
//DestroyImmediate(this.gameObject);
|
||||
});
|
||||
|
||||
var panel = canvas.transform.Find("Panel");
|
||||
@@ -91,7 +92,7 @@ public class BigMapController : PFUIPanel
|
||||
|
||||
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
UIManager.ShowEditUserPanel();
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -126,6 +127,8 @@ public class BigMapController : PFUIPanel
|
||||
}
|
||||
private void MapManager_OnUpdated()
|
||||
{
|
||||
Debug.Log("update");
|
||||
|
||||
foreach (var item in linesCache)
|
||||
{
|
||||
//if(item.Value.LineObject != null)
|
||||
|
||||
@@ -40,14 +40,19 @@ public class DeviceController : PFUIPanel
|
||||
//UIManager.CloseModal();
|
||||
this.Close();
|
||||
}));
|
||||
//UIManager.AddEvent(mReturnBtn.gameObject, EventTriggerType.PointerUp, (e) =>
|
||||
//{
|
||||
// Debug.Log("aaaaaaaaaaaaaa");
|
||||
//});
|
||||
|
||||
var bg = this.transform.Find("Status").Find("Bg");
|
||||
antStatus = bg.Find("Ant+").GetComponent<Image>();
|
||||
|
||||
ant0 = Resources.Load<Sprite>("Images/ANT+_0");
|
||||
ant1 = Resources.Load<Sprite>("Images/ANT+_1");
|
||||
ant1 = Resources.Load<Sprite>("Images/ANT+_2");
|
||||
|
||||
Debug.Log("device start");
|
||||
|
||||
base.SetRounded(bg, 64);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,9 +100,10 @@ public class HomeController : PFUIPanel
|
||||
userInfo.Find("GroupTop").Find("FtpContainer").Find("FtpValue").GetComponent<Text>().text = App.CurrentUser.FTP.ToString();
|
||||
userInfo.Find("GroupTop").Find("WeightContainer").Find("WeightValue").GetComponent<Text>().text = App.CurrentUser.Weight.ToString();
|
||||
userInfo.Find("GroupTop").Find("WKGContainer").Find("WKGValue").GetComponent<Text>().text = $"{App.CurrentUser.Weight}kg/{App.CurrentUser.BicycleWeight}kg";
|
||||
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = summary.Kcal;
|
||||
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString();
|
||||
userInfo.Find("ClimbContainer").Find("ClimbValue").GetComponent<Text>().text = summary.TotalClimb;
|
||||
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = summary.Kcal +" KCAL";
|
||||
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString("0") +" KM";
|
||||
userInfo.Find("ClimbContainer").Find("ClimbValue").GetComponent<Text>().text = summary.TotalClimb +" M";
|
||||
userInfo.Find("IDText").GetComponent<Text>().text = "ID:"+App.CurrentUser.Id;
|
||||
//var user = ConfigHelper.CurrentUser;
|
||||
//Ftp.text = summary.Ftp.ToString();
|
||||
//Weight.text = user.Weight.ToString();
|
||||
@@ -148,4 +149,9 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public class MapListController : PFUIPanel
|
||||
|
||||
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
UIManager.ShowEditUserPanel();
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
@@ -23,8 +24,10 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
|
||||
}
|
||||
string titleColor = "#5c5c6e";
|
||||
RouteResult data;
|
||||
public void Initial(RouteResult result)
|
||||
{
|
||||
data = result;
|
||||
left = transform.Find("Left");
|
||||
row1 = left.Find("Main").Find("Row1");
|
||||
row2 = left.Find("Main").Find("Row2");
|
||||
@@ -61,17 +64,23 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
|
||||
private void Delete()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//throw new NotImplementedException();
|
||||
UIManager.ShowAlert("暂未实现");
|
||||
}
|
||||
|
||||
private void GoReRide()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//throw new NotImplementedException();
|
||||
//UIManager.ShowAlert("去骑行");
|
||||
|
||||
App.RouteIdParam = data.RouteId;
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
|
||||
private void GoContinue()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//throw new NotImplementedException();
|
||||
UIManager.ShowAlert("暂未实现");
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
|
||||
@@ -343,6 +343,7 @@ public class UIManager : MonoBehaviour
|
||||
//prePanel = bigMap.GetComponent<PFUIPanel>();
|
||||
}
|
||||
|
||||
static Texture2D cursor;
|
||||
public static void AddEvent(GameObject gameObject, EventTriggerType eventTriggerType, UnityAction<BaseEventData> call)
|
||||
{
|
||||
EventTrigger et = gameObject.GetComponent<EventTrigger>();
|
||||
@@ -354,6 +355,27 @@ public class UIManager : MonoBehaviour
|
||||
pointerEvent.eventID = eventTriggerType;
|
||||
pointerEvent.callback.AddListener(call);
|
||||
et.triggers.Add(pointerEvent);
|
||||
|
||||
if(eventTriggerType == EventTriggerType.PointerClick)
|
||||
{
|
||||
//设置光标
|
||||
if (cursor == null)
|
||||
{
|
||||
cursor = Resources.Load<Texture2D>("Images/PointerButtonHover");
|
||||
}
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e)=>{
|
||||
if (!gameObject.activeInHierarchy) return;
|
||||
Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
|
||||
});
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) => {
|
||||
if (!gameObject.activeInHierarchy) return;
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
});
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerExit, (e) => {
|
||||
if (!gameObject.activeInHierarchy) return;
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void Close(MonoBehaviour obj)
|
||||
|
||||
Reference in new issue
Block a user