加淡入淡出效果。重设字体。加退出导航。
This commit is contained in:
1 parent
51c6fd7236
commit
2d20edf57a
28 files changed
+606
-373
No files matched your search
@@ -6,6 +6,8 @@ using UnityEngine.UI;
|
||||
|
||||
public class MainNav : MonoBehaviour
|
||||
{
|
||||
private GameObject exit;
|
||||
private GameObject home;
|
||||
private void Awake()
|
||||
{
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
@@ -14,18 +16,32 @@ public class MainNav : MonoBehaviour
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
var wifi = this.transform.Find("Wifi");
|
||||
UIManager.AddEvent(wifi.gameObject, EventTriggerType.PointerClick, x =>
|
||||
var device = this.transform.Find("Device");
|
||||
UIManager.AddEvent(device.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
Debug.Log("click wifi");
|
||||
Debug.Log("click device");
|
||||
UIManager.ShowDevicePanel();
|
||||
});
|
||||
|
||||
var home = this.transform.Find("Home");
|
||||
UIManager.AddEvent(home.gameObject, EventTriggerType.PointerClick, x =>
|
||||
home = this.transform.Find("Home").gameObject;
|
||||
UIManager.AddEvent(home, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
|
||||
exit = this.transform.Find("Exit").gameObject;
|
||||
exit.SetActive(false);
|
||||
|
||||
|
||||
UIManager.AddEvent(exit, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
Application.Quit();
|
||||
});
|
||||
|
||||
UIManager.AddEvent(transform.Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowSettingModal();
|
||||
});
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -39,4 +55,10 @@ public class MainNav : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ShowExit()
|
||||
{
|
||||
exit.SetActive(true);
|
||||
home.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Mapbox.Examples;
|
||||
using DG.Tweening;
|
||||
|
||||
public class BigMapController : PFUIPanel
|
||||
{
|
||||
@@ -33,6 +34,10 @@ public class BigMapController : PFUIPanel
|
||||
int timer = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
var cg = this.transform.Find("Canvas").GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
|
||||
|
||||
mapApi = new MapApi();
|
||||
mapboxApi = new MapBoxApi();
|
||||
|
||||
@@ -384,13 +389,21 @@ public class BigMapController : PFUIPanel
|
||||
//timer += Time.deltaTime;
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.transform.Find("Canvas").GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
//base.Close();
|
||||
|
||||
DestroyImmediate(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
class LineItem
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using DG.Tweening;
|
||||
|
||||
public class DeviceController : PFUIPanel
|
||||
{
|
||||
@@ -89,6 +90,15 @@ public class DeviceController : PFUIPanel
|
||||
}
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
AntConnector.Instance().Dispose();
|
||||
|
||||
@@ -156,11 +156,10 @@ public class EditUserController : PFUIPanel
|
||||
}
|
||||
async Task LoadDataSync()
|
||||
{
|
||||
if (!App.FromLogin)
|
||||
{
|
||||
await Login();
|
||||
}
|
||||
|
||||
//if (!App.FromLogin)
|
||||
//{
|
||||
// await Login();
|
||||
//}
|
||||
|
||||
var currentUser = App.CurrentUser;
|
||||
if (currentUser == null) return;
|
||||
|
||||
@@ -25,10 +25,15 @@ public class HomeController : PFUIPanel
|
||||
//[SerializeField] Button More;
|
||||
[SerializeField] Button BtnRide;
|
||||
[SerializeField] Transform userInfo;
|
||||
|
||||
private MainNav mainNav;
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
|
||||
mainNav.ShowExit();
|
||||
//var parent = Utils.FindUpParent(gameObject.transform);
|
||||
//if (parent.Find("ToastContainer") == null)
|
||||
//{
|
||||
@@ -45,10 +50,8 @@ public class HomeController : PFUIPanel
|
||||
BtnRide.onClick.AddListener(GoRide);
|
||||
|
||||
var avatar = userInfo.Find("Avatar").GetComponent<RawImage>();
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
var rect = ((RectTransform)avatar.transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
avatar.material = material;
|
||||
var rect = ((RectTransform)avatar.transform).rect;
|
||||
SetRounded(avatar.transform, rect.height);
|
||||
|
||||
UIManager.AddEvent(avatar.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
@@ -59,10 +62,6 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowAlert("test");
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("MainNav").Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowSettingModal();
|
||||
});
|
||||
GetSummary();
|
||||
}
|
||||
|
||||
@@ -99,16 +98,17 @@ public class HomeController : PFUIPanel
|
||||
userInfo.Find("NickName").GetComponent<Text>().text = App.CurrentUser.Nickname;
|
||||
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("GroupTop").Find("WKGContainer").Find("WKGValue").GetComponent<Text>().text = $"{ (App.CurrentUser.FTP/ App.CurrentUser.Weight).ToString("0.0") }";
|
||||
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;
|
||||
userInfo.Find("IDText").GetComponent<Text>().text = "ID:"+App.CurrentUser.Id.ToString("000000");
|
||||
//var user = ConfigHelper.CurrentUser;
|
||||
//Ftp.text = summary.Ftp.ToString();
|
||||
//Weight.text = user.Weight.ToString();
|
||||
//WKG.text = $"{user.Weight}KG/{user.BicycleWeight}KG";
|
||||
//NickName.text = user.Nickname;
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
async void GetSummary()
|
||||
@@ -152,6 +152,11 @@ public class HomeController : PFUIPanel
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Prefab.MapList;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -197,10 +198,10 @@ public class MapListController : PFUIPanel
|
||||
var rect = ((RectTransform)headImage.transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
headImage.material = material;
|
||||
if (App.FromLogin)
|
||||
{
|
||||
//if (App.FromLogin)
|
||||
//{
|
||||
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
@@ -294,4 +295,13 @@ public class MapListController : PFUIPanel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, .3f);
|
||||
}
|
||||
}
|
||||
@@ -46,11 +46,11 @@ public class UserInfoController : PFUIPanel
|
||||
}
|
||||
async void Load()
|
||||
{
|
||||
if (!App.FromLogin)
|
||||
{
|
||||
var result = await userApi.Login("15651831367", "123456", "");
|
||||
App.CurrentUser = result.data;
|
||||
}
|
||||
//if (!App.FromLogin)
|
||||
//{
|
||||
// var result = await userApi.Login("15651831367", "123456", "");
|
||||
// App.CurrentUser = result.data;
|
||||
//}
|
||||
var r = userApi.GetSummary();
|
||||
if (r.result)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class SettingContoller : PFUIPanel
|
||||
{
|
||||
@@ -12,13 +14,17 @@ public class SettingContoller : PFUIPanel
|
||||
exit = transform.Find("Main").Find("Exit");
|
||||
if (exit != null)
|
||||
{
|
||||
exit.GetComponent<Button>().onClick.AddListener(()=>
|
||||
//exit.GetComponent<Button>().onClick.AddListener(()=>
|
||||
//{
|
||||
// Close();
|
||||
//});
|
||||
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
}
|
||||
}
|
||||
void Start()
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -28,4 +34,13 @@ public class SettingContoller : PFUIPanel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user