赛事界面&骑行界面调整

This commit is contained in:
lishuo committed 2021-09-03 13:06:26 +08:00
1 parent 3fb8aee922
commit 7af935118e
50 files changed
+20950 -426

No files matched your search

+2 -2
View File
@@ -54,7 +54,7 @@ namespace Assets.Scripts.Apis
// var res = http.GetAsFile(ConfigHelper.Host + url, fileName);
// return res;
//});
//return result;
//return result;
//using (var httpResponseMessage = await httpClient.SendAsync(CreateRequest(url, System.Net.Http.HttpMethod.Get), HttpCompletionOption.ResponseContentRead))
@@ -109,7 +109,7 @@ namespace Assets.Scripts.Apis
#if UNITY_ANDROID
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
#elif UNITY_IOS
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("UnityiOS", ConfigHelper.AppVersion));
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
#else
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
#endif
@@ -34,7 +34,11 @@ namespace Assets.Scenes.Ride.Scripts
{
cyclingController = controller;
//渲染比赛界面
#if UNITY_IOS || UNITY_ANDROID
panel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CompetitonPanel"), transform);
#else
panel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CompetitonPanel"), transform);
#endif
panel.transform.SetAsFirstSibling();
PFUIPanel mainPanel = panel.GetComponent<PFUIPanel>();
PFUIPanel modelPanel = transform.Find("ModalPanel").GetComponent<PFUIPanel>();
@@ -51,7 +55,7 @@ namespace Assets.Scenes.Ride.Scripts
protected override void Update()
{
base.Update();
#region 倒计时状态
#region 倒计时状态
if (competition != null)
{
var count = (int)(competition.StartTime.ToLocalTime() - UIManager.Now.GetDateTime()).TotalSeconds;
@@ -96,7 +100,7 @@ namespace Assets.Scenes.Ride.Scripts
Watch.GetComponent<Button>().enabled = process>=100;
Watch.GetComponent<Button>().interactable = process >= 100;
}
#endregion
#endregion
}
protected override void ShowLoading()
{
@@ -137,8 +141,13 @@ namespace Assets.Scenes.Ride.Scripts
GetReady = panel.transform.Find("GetReady").GetComponent<Text>();
GetReadyTitle = panel.transform.Find("GetReadyTitle").GetComponent<Text>();
MapId = panel.transform.Find("MapId").GetComponent<Text>();
#if UNITY_IOS || UNITY_ANDROID
Watcher = Resources.Load<GameObject>("UI/Prefab/Match/Mobile/Watcher");
MoreHead = Resources.Load<GameObject>("UI/Prefab/Match/Mobile/MoreHead");
#else
Watcher = Resources.Load<GameObject>("UI/Prefab/Match/Watcher");
MoreHead = Resources.Load<GameObject>("UI/Prefab/Match/MoreHead");
#endif
Watch.GetComponent<Button>().enabled = false;
Watch.GetComponent<Button>().interactable = false;
@@ -163,7 +172,7 @@ namespace Assets.Scenes.Ride.Scripts
_raceStart = competition.Status == 3;
_canWatch = competition.CanWatch;
_canEnter = competition.CanEnter;
#region 赛事基本信息
#region 赛事基本信息
//赛事名称
CompetitionTitle.text = GetMaxString(competition.Title,40);
//线路名称
@@ -210,7 +219,7 @@ namespace Assets.Scenes.Ride.Scripts
DrawMapRouteAsync(route.Id, 1);
}
AddProcess(20);
#endregion
#endregion
StartCoroutine(HiddenLoading());
}
@@ -235,7 +244,7 @@ namespace Assets.Scenes.Ride.Scripts
}
}
}
#region 事件
#region 事件
//查看赛事详情
protected void ReadCompetitionPreview(BaseEventData baseEvent)
@@ -359,6 +368,6 @@ namespace Assets.Scenes.Ride.Scripts
}
base.Cancel(baseEvent);
}
#endregion
#endregion
}
}
@@ -24,6 +24,7 @@ namespace Assets.Scenes.Ride.Scripts
protected override void Awake()
{
//base.Awake();
pageSize = 4;
scroll = transform.Find("List").gameObject;
if (scroll != null)
{
@@ -33,8 +34,13 @@ namespace Assets.Scenes.Ride.Scripts
cyclingController = FindObjectOfType<CyclingController>();
playerController = FindObjectOfType<PlayerController>();
currentPlayer = cyclingController.currentPlayer;
#if UNITY_IOS || UNITY_ANDROID
nearByItem = Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CompetitionRankingItem");
nearByMajorItem = Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CompetitionRankingMajorItem");
#else
nearByItem = Resources.Load<GameObject>("UI/Prefab/Match/CompetitionRankingItem");
nearByMajorItem = Resources.Load<GameObject>("UI/Prefab/Match/CompetitionRankingMajorItem");
#endif
Title = transform.Find("Title").GetComponent<Text>();
OnlineUserNum = transform.Find("Head/OnlineUserNum").GetComponent<Text>();
PreBtn = transform.Find("Pre").gameObject;//上一页
@@ -69,6 +75,7 @@ namespace Assets.Scenes.Ride.Scripts
//当前参赛总人数
var totalCount = rankingList.Count();
OnlineUserNum.text = " "+totalCount.ToString();
LayoutRebuilder.ForceRebuildLayoutImmediate(OnlineUserNum.rectTransform);
//当前用户排名
var currentIndex = rankingList.Where(c => c.UserId == cyclingController.currentPlayer.UserId).FirstOrDefault()?.Index ?? 0;
totalPages = (pageSize>0?totalCount / pageSize:0) + (totalCount % pageSize> 0? 1:0);
@@ -182,7 +182,11 @@ namespace Assets.Scenes.Ride.Scripts
//没有就创建
if (finalRankingItemScript == null)
{
#if UNITY_IOS || UNITY_ANDROID
var finalRankingItem = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/FinalRankingItem"), parent);
#else
var finalRankingItem = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/FinalRankingItem"), parent);
#endif
finalRankingItemScript = finalRankingItem.GetComponent<FinalRankingItemScript>();
}
@@ -23,9 +23,15 @@ namespace Assets.Scenes.Ride.Scripts
base.Start();
reviewPanel.SetActive(false);
//隐藏单人骑行时间
var spilitLineH2 = transform.Find("Panel/ComputerPanel/SpilitLineH2").gameObject;
raceViewBtn = transform.Find("Panel/RaceViewButton").gameObject;
var spilitLineH2 = uipanel.transform.Find("ComputerPanel/SpilitLineH2").gameObject;
raceViewBtn = uipanel.transform.Find("RaceViewButton").gameObject;
#if UNITY_IOS || UNITY_ANDROID
viewButton.enabled = mainController.isWatch;
viewButton.interactable = mainController.isWatch;
#else
viewButton.gameObject.SetActive(false);
#endif
UIManager.AddEvent(raceViewBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeView);
spilitLineH2.SetActive(false);
@@ -60,12 +66,23 @@ namespace Assets.Scenes.Ride.Scripts
public override void StartRide()
{
competitionModel = mainController.cyclingController as CompetitionModel;
countDownPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CountDownPanel"), transform.Find("Panel"));
#if UNITY_IOS || UNITY_ANDROID
countDownPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CountDownPanel"), uipanel.transform);
title = countDownPanel.transform.Find("Title").GetComponent<Text>();
timer = countDownPanel.transform.Find("Timer").GetComponent<Text>();
competitionRankingList = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CompetitionRankingPanel"), transform.Find("Panel"));
topRankPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/TopRankPanel"), transform.Find("Panel"));
watchPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/WatcherPanel"), transform.Find("Panel"));
competitionRankingList = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CompetitionRankingPanel"), uipanel.transform);
topRankPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/TopRankPanel"), uipanel.transform);
watchPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/WatcherPanel"), uipanel.transform);
#else
countDownPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CountDownPanel"), uipanel.transform);
title = countDownPanel.transform.Find("Title").GetComponent<Text>();
timer = countDownPanel.transform.Find("Timer").GetComponent<Text>();
competitionRankingList = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CompetitionRankingPanel"), uipanel.transform);
topRankPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/TopRankPanel"), uipanel.transform);
watchPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/WatcherPanel"), uipanel.transform);
#endif
}
private void CountDown()
@@ -78,7 +95,7 @@ namespace Assets.Scenes.Ride.Scripts
if (competitionModel == null)
return;
#region 赛事状态改变时间
#region 赛事状态改变时间
canStart = competitionModel.CanStart();
//比赛开始
if (count <= 0 && canStart)
@@ -103,7 +120,7 @@ namespace Assets.Scenes.Ride.Scripts
//显示观众
var watchList = mainController.GetWatcherList();
watchPanel.SetActive(watchList.Count > 0);
#endregion
#endregion
}
@@ -139,11 +156,19 @@ namespace Assets.Scenes.Ride.Scripts
{
if (competitionRankingList == null)
{
competitionRankingList = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CompetitionRankingPanel"), transform.Find("Panel"));
#if UNITY_IOS || UNITY_ANDROID
competitionRankingList = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CompetitionRankingPanel"), uipanel.transform);
#else
competitionRankingList = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CompetitionRankingPanel"), uipanel.transform);
#endif
}
if (topRankPanel == null)
{
topRankPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/TopRankPanel"), transform.Find("Panel"));
#if UNITY_IOS || UNITY_ANDROID
topRankPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/TopRankPanel"), uipanel.transform);
#else
topRankPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/TopRankPanel"), uipanel.transform);
#endif
}
}
GameObject competitionResultPanel;
@@ -153,7 +178,11 @@ namespace Assets.Scenes.Ride.Scripts
{
if (competitionResultPanel == null)
{
competitionResultPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CompetitionResultPanel"), transform.Find("Panel"));
#if UNITY_IOS || UNITY_ANDROID
competitionResultPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CompetitionResultPanel"), uipanel.transform);
#else
competitionResultPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/CompetitionResultPanel"), uipanel.transform);
#endif
}
}
@@ -24,8 +24,13 @@ namespace Assets.Scenes.Ride.Scripts
cyclingController = FindObjectOfType<CyclingController>();
playerController = FindObjectOfType<PlayerController>();
currentPlayer = cyclingController.currentPlayer;
#if UNITY_IOS || UNITY_ANDROID
nearByItem = Resources.Load<GameObject>("UI/Prefab/Match/Mobile/TopRankingItem");
nearByMajorItem = Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CompetitionRankingMajorItem");
#else
nearByItem = Resources.Load<GameObject>("UI/Prefab/Match/TopRankingItem");
nearByMajorItem = Resources.Load<GameObject>("UI/Prefab/Match/CompetitionRankingMajorItem");
#endif
}
protected override void CreateList()
@@ -21,7 +21,11 @@ namespace Assets.Scenes.Ride.Scripts
content = transform.Find("List/Viewport/Content");
head = transform.Find("Head").gameObject;
watchNum = transform.Find("Head/OnlineUserNum").GetComponent<Text>();
#if UNITY_IOS || UNITY_ANDROID
watcher = Resources.Load<GameObject>("UI/Prefab/Match/Mobile/Watcher");
#else
watcher = Resources.Load<GameObject>("UI/Prefab/Match/Watcher");
#endif
}
private float t = 1f;
@@ -251,7 +251,7 @@ namespace Assets.Scenes.Ride.Scripts
private Vector3 m = new Vector3(0.1f, 0.1f, 0.1f);
private Vector3 CameraVector = Vector3.zero;
GameObject uipanel { get; set; }
public GameObject uipanel { get; set; }
public void InitData()
{
playerController = FindObjectOfType<PlayerController>();
@@ -493,7 +493,7 @@ namespace Assets.Scenes.Ride.Scripts
}
//进入简约模式
protected int isSimple = 1;
protected bool clearLock = true;
public bool clearLock = true;
public virtual void ClearPanel(BaseEventData baseEventData)
{
if (clearLock)
@@ -172,12 +172,15 @@ public class CyclingController : DeviceServiceMonoBase
private void Update()
{
//CamControl();
var mouse = Input.GetMouseButton(0);
if (mouse && clearLock)
if (competitionId == 0 && singleUIManager != null)
{
clearLock = false;
activeSeconds = 0;
singleUIManager?.ClearPanel(null);
var mouse = Input.GetMouseButton(0);
if (mouse && clearLock && singleUIManager.clearLock)
{
clearLock = false;
activeSeconds = 0;
singleUIManager?.ClearPanel(null);
}
}
timer -= Time.deltaTime;
@@ -195,8 +198,11 @@ public class CyclingController : DeviceServiceMonoBase
}
if (activeSeconds >= App.autoClearTimes && !clearLock)
{
clearLock = true;
singleUIManager?.ClearPanel(null);
if (competitionId == 0)
{
clearLock = true;
singleUIManager?.ClearPanel(null);
}
}
timer += 1.0f;
}
@@ -28,10 +28,15 @@ namespace Assets.Scenes.Ride.Scripts
currentlatlong = mainController.GetCenterCoordinate();
_playerController = FindObjectOfType<PlayerController>();
//创建UI
uiObject = transform.parent.Find("UI/Panel/ArrowList");
var uipanel = mainController.GetUIPanel();
uiObject = uipanel.transform.Find("ArrowList");
if (mainController.cyclingController.Mode == CyclingModel.Competition)
{
#if UNITY_IOS || UNITY_ANDROID
arrowImage = Instantiate(Resources.Load<Image>("UI/Prefab/Match/Mobile/CompetitionArrow"), uiObject);
#else
arrowImage = Instantiate(Resources.Load<Image>("UI/Prefab/Match/CompetitionArrow"), uiObject);
#endif
//比赛模式
if (!string.IsNullOrEmpty(headUrl))
{
@@ -57,9 +57,9 @@ namespace Assets.Scenes.Ride.Scripts
cadance = mainController.UpdateCadence();
weight = App.CurrentUser.Weight;
bicycleWeight = App.CurrentUser.BicycleWeight;
//#if UNITY_EDITOR
#if UNITY_EDITOR
power = 500;
//#endif
#endif
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
}
catch (Exception ex)