加淡入淡出效果。重设字体。加退出导航。

This commit is contained in:
suntao committed 2021-04-19 18:16:56 +08:00
1 parent 51c6fd7236
commit 2d20edf57a
28 files changed
+606 -373

No files matched your search

+2 -2
View File
@@ -40,7 +40,7 @@ namespace Assets.Scripts.Apis
httpClientHandler.Proxy = WebRequest.DefaultWebProxy;
httpClientHandler.CookieContainer = _cookieCollection;
httpClientHandler.UseCookies = true;
httpClientHandler.CookieContainer.Add(new Uri(ConfigHelper.Host), new Cookie("PowerFun.AUTH", "E1F130A03C0C2F01DF465A17AAA4740E9C44FC5F7C5077AF5A09B5ED29F0CF4FABE44329111C0BDBC6D97A28E7C7C188250265B37D2E6A849D7F0CAC606490648F17DC7FB9C8778BE7217991EBB6304BD543CFEE55084E54CCD634B49F26A751","/"));
//httpClientHandler.CookieContainer.Add(new Uri(ConfigHelper.Host), new Cookie("PowerFun.AUTH", "E1F130A03C0C2F01DF465A17AAA4740E9C44FC5F7C5077AF5A09B5ED29F0CF4FABE44329111C0BDBC6D97A28E7C7C188250265B37D2E6A849D7F0CAC606490648F17DC7FB9C8778BE7217991EBB6304BD543CFEE55084E54CCD634B49F26A751","/"));
httpClient = new System.Net.Http.HttpClient(httpClientHandler);
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
@@ -446,7 +446,7 @@ namespace Assets.Scripts.Apis
//}
request.UserAgent = httpClient.DefaultRequestHeaders.UserAgent.ToString();
request.Accept = "application/json";
request.Headers.Add("Language", "Zh-cn");
request.Headers.Add("Language", "en");
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
request.CookieContainer = new CookieContainer();
foreach (Cookie item in cookies)
+2 -1
View File
@@ -10,8 +10,9 @@ public class MainController : MonoBehaviour
private Text Version;
private void Awake()
{
Version = this.transform.Find("Version").GetComponent<Text>();
Version = this.transform.Find("GameObject").Find("Version").GetComponent<Text>();
Version.text = "Version:"+App.AppVersion;
}
// Start is called before the first frame update
+27 -5
View File
@@ -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)
{
+18 -3
View File
@@ -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);
}
}
+3 -2
View File
@@ -339,7 +339,7 @@ public class UIManager : MonoBehaviour
var obj = Resources.Load("UI/Prefab/Panel/BigMapPanel");
//var root = UIManager.Instance.MainPanel.transform.parent.parent;
var bigMap = (GameObject)Instantiate(obj, UIManager.Instance.Root.transform);
bigMap.GetComponent<BigMapController>().Show();
//prePanel = bigMap.GetComponent<PFUIPanel>();
}
@@ -355,7 +355,7 @@ public class UIManager : MonoBehaviour
pointerEvent.eventID = eventTriggerType;
pointerEvent.callback.AddListener(call);
et.triggers.Add(pointerEvent);
if(eventTriggerType == EventTriggerType.PointerClick)
{
//设置光标
@@ -373,6 +373,7 @@ public class UIManager : MonoBehaviour
});
UIManager.AddEvent(gameObject, EventTriggerType.PointerExit, (e) => {
if (!gameObject.activeInHierarchy) return;
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
});
}