结果列表页,用户页

This commit is contained in:
CaiYanPeng 2021-08-26 09:29:35 +08:00
parent 89e3a04fe9
commit e1a85eeb5e
14 changed files with 7393 additions and 4408 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1bbbc47522699884ea44f18654a7579f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cb5bd02e1318732499f09483cd47ae72
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ namespace Assets.Scripts.Apis
httpClient = new System.Net.Http.HttpClient(httpClientHandler);
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
HandleHeaders(httpClient.DefaultRequestHeaders);
}
protected async Task<bool> GetAsFileSync(string url, string fileName)
@ -97,12 +97,24 @@ namespace Assets.Scripts.Apis
var client = new HttpClient(httpClientHandler);
client.DefaultRequestHeaders.Add("Language", "en");
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
HandleHeaders(client.DefaultRequestHeaders);
var result = await client.GetByteArrayAsync(_url).ConfigureAwait(false);
return result;
}
private static void HandleHeaders(HttpRequestHeaders defaultRequestHeaders)
{
#if UNITY_ANDROID
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
#elif UNITY_IOS
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("UnityiOS", ConfigHelper.AppVersion));
#else
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
#endif
}
protected async Task<byte[]> GetUrlAsync(string url)
{
var httpResponseMessage = await httpClient.GetAsync(url, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false);

View File

@ -248,15 +248,7 @@ public class EditUserController : PFUIPanel
}
private void Switch(BaseEventData arg0)
{
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
UIManager.CloseConfirm();
},2);
UIManager.SwitchAccount();
}
// Update is called once per frame

View File

@ -29,15 +29,7 @@ public class UserInfoController : PFUIPanel
UIManager.AddEvent(transform.Find("InfoPanel").Find("SwitchAccountButton").gameObject,
EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
UIManager.CloseConfirm();
},2);
UIManager.SwitchAccount();
});
infoPanel = transform.Find("InfoPanel").Find("P");
@ -57,9 +49,10 @@ public class UserInfoController : PFUIPanel
#if UNITY_ANDROID || UNITY_IOS
editBtn.gameObject.SetActive(true);
var recordBtn = infoPanel.Find("RecordButton");
UIManager.AddEvent(recordBtn.gameObject, EventTriggerType.PointerEnter, (b) =>
UIManager.AddEvent(recordBtn.gameObject, EventTriggerType.PointerClick, (b) =>
{
Debug.Log("去看記錄");
Debug.Log(62);
UIManager.ShowResultListPanel();
});
#else
UIManager.AddEvent(transform.Find("InfoPanel").gameObject, EventTriggerType.PointerEnter, (b) =>

View File

@ -9,7 +9,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ResultListController : MonoBehaviour
public class ResultListController : PFUIPanel
{
[SerializeField]Transform routeResult;
Transform localRouteItem;
@ -296,6 +296,7 @@ public class ResultListController : MonoBehaviour
var value = index * scrollValue;
if (scroll != null && startScroll)
{
#if (UNITY_ANDROID || UNITY_IOS)
if (scroll.horizontalNormalizedPosition >= value)
{
scroll.horizontalNormalizedPosition -= (scrollValue / 20);
@ -316,9 +317,33 @@ public class ResultListController : MonoBehaviour
startScroll = false;
}
}
#else
//if (scroll.verticalNormalizedPosition <= 1)
//{
// scroll.verticalNormalizedPosition =0;
// Debug.Log($"{scroll.verticalNormalizedPosition},{scrollValue/20}");
// if (scroll.verticalNormalizedPosition <= 0)
// {
// Debug.Log(index);
// scroll.verticalNormalizedPosition = 0;
// startScroll = false;
// }
//}
//else
//{
// scroll.verticalNormalizedPosition += (scrollValue / 20);
// Debug.Log($"反向:{scroll.verticalNormalizedPosition},{scrollValue / 20}");
// if (scroll.verticalNormalizedPosition >= 1)
// {
// Debug.Log(index);
// scroll.verticalNormalizedPosition = 1;
// startScroll = false;
// }
//}
#endif
}
}
#endregion
#endregion
//float scrollIndex = 0;
//bool startScroll = false;
//ScrollRect scroll;

View File

@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ResultListPanelController : PFUIPanel
{
// Start is called before the first frame update
void Start()
{
UIManager.AddEvent(transform.Find("LTPanel/Button").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowPrePanel();
});
UIManager.AddEvent(transform.Find("LTPanel/SwitchAccountButton").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.SwitchAccount();
});
}
public override void Show()
{
base.Show();
transform.Find("RideResultList").GetComponent<ResultListController>().Load();
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 693a8dfbfae474849b06c5d0080136f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -215,7 +215,6 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
else
{
Debug.Log(216);
btnDetail.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
btnDetail.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
}

View File

@ -14,6 +14,7 @@ using System.Linq;
using Newtonsoft.Json.Linq;
using System;
using Assets.Scenes.Ride.Scripts;
using UnityEngine.SceneManagement;
public class UIManager : MonoBehaviour
{
@ -137,6 +138,21 @@ public class UIManager : MonoBehaviour
return this.GetPanelInstance("EditUserPanel", ref this.mEditUserController);
}
}
#if UNITY_ANDROID || UNITY_IOS
private ResultListPanelController mResultListController;
public ResultListPanelController ResultListPanel
{
get
{
return this.GetPanelInstance("ResultListPanel", ref this.mResultListController);
}
}
public static void ShowResultListPanel()
{
Debug.Log(UIManager.Instance.MainPanel);
UIManager.Show(UIManager.Instance.ResultListPanel, UIManager.Instance.MainPanel);
}
#endif
/*比赛首页*/
private RaceHomeScript mRaceHomeScript;
public RaceHomeScript RaceHomePanel
@ -824,5 +840,16 @@ public class UIManager : MonoBehaviour
{
UIManager.Instance = null;
}
public static void SwitchAccount()
{
ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
CloseConfirm();
}, 2);
}
}