赛事消息通知面板和界面微调
This commit is contained in:
1 parent
7d0128d912
commit
17f2b1cedd
9 files changed
+893
-52
No files matched your search
@@ -72,7 +72,7 @@ namespace Assets.Scripts.Apis
|
||||
user.LastUpdateBicycleWeightTime = ret.data.LastUpdateBicycleWeightTime;
|
||||
user.Height = ret.data.Height;
|
||||
//todo: check local database, insert new user
|
||||
|
||||
user.WebHost = ret.data.WebHost;
|
||||
//PubCommData.CurrentUser = user;
|
||||
user.cookie = cookies[0].Value;
|
||||
return new JsonResult<UserResultModel>() { result = true, data = user };
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -21,6 +20,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
private Text StartTime { get; set; }
|
||||
private Text Contestant { get; set; }
|
||||
private Text CompetitionStatus { get; set; }
|
||||
private Text GetReady { get; set; }
|
||||
private Text GetReadyTitle { get; set; }
|
||||
private Transform PlayersPanel {get;set;}
|
||||
private GameObject LeftBack { get; set; }
|
||||
private GameObject MiddleBack { get; set; }
|
||||
@@ -42,6 +43,28 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
base.Start();
|
||||
}
|
||||
MapCompetition competition { get; set; }
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
#region 倒计时状态
|
||||
if (competition != null)
|
||||
{
|
||||
var count = (int)(competition.StartTime.ToLocalTime() - UIManager.Now.GetDateTime()).TotalSeconds;
|
||||
if (count > 0)
|
||||
{
|
||||
GetReady.text = Helper.FormatTicks(count);
|
||||
GetReadyTitle.gameObject.SetActive(true);
|
||||
GetReady.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetReadyTitle.gameObject.SetActive(false);
|
||||
GetReady.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
protected override void ShowLoading()
|
||||
{
|
||||
loadingPanel = panel.transform.Find("LoadingPanel").gameObject;
|
||||
@@ -67,6 +90,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
MiddleBack = panel.transform.Find("MiddleBack").gameObject;
|
||||
CompetitionStatus = panel.transform.Find("CompetitionStatus").GetComponent<Text>();
|
||||
ReadMore = panel.transform.Find("ReadMore").gameObject;
|
||||
GetReady = panel.transform.Find("GetReady").GetComponent<Text>();
|
||||
GetReadyTitle = panel.transform.Find("GetReadyTitle").GetComponent<Text>();
|
||||
|
||||
UIManager.AddEvent(ReadMore, EventTriggerType.PointerClick, ReadCompetitionPreview);
|
||||
UIManager.AddEvent(Watch, EventTriggerType.PointerClick, StartWatch);
|
||||
@@ -78,7 +103,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected override void InitGameObjectData()
|
||||
{
|
||||
var route = cyclingController.mapRoute;
|
||||
var competition = cyclingController.competition;
|
||||
competition = cyclingController.competition;
|
||||
//赛事状态按钮控制
|
||||
_canJoin = competition.CanJoin;
|
||||
_canStart = competition.CanStart;
|
||||
@@ -119,16 +144,17 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
mapDescText.text = route.Dec;
|
||||
//主办方logo
|
||||
Utils.DisplayImage(SponsorLogoImage, competition.SponsorCoverage, true);
|
||||
|
||||
//赛事详情
|
||||
if (!string.IsNullOrEmpty(competition.ShortPreview))
|
||||
{
|
||||
LeftBack.SetActive(false);
|
||||
MiddleBack.SetActive(false);
|
||||
Utils.DisplayImage(CompetitionDesc, competition.ShortPreview, true);
|
||||
var canvasGroup = CompetitionDesc.GetComponent<CanvasGroup>();
|
||||
canvasGroup.DOFade(1, 1);
|
||||
}
|
||||
else
|
||||
//if (!string.IsNullOrEmpty(competition.ShortPreview))
|
||||
//{
|
||||
// LeftBack.SetActive(false);
|
||||
// MiddleBack.SetActive(false);
|
||||
// Utils.DisplayImage(CompetitionDesc, competition.ShortPreview, true);
|
||||
// var canvasGroup = CompetitionDesc.GetComponent<CanvasGroup>();
|
||||
// canvasGroup.DOFade(1, 1);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
//异步请求mapbox画出当前路书路线图
|
||||
DrawMapRouteAsync(route.Id, 1);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
ShowLoading();
|
||||
}
|
||||
|
||||
void Update()
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (canvasGroup == null)
|
||||
{
|
||||
|
||||
@@ -71,17 +71,19 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public class CompetitonStartMessageEvent : GameEvent
|
||||
{
|
||||
public string title;//赛事标题
|
||||
public string SceneName;//场景名称
|
||||
public int competitionId;//赛事id
|
||||
public int routeId;//路书id
|
||||
public DateTime StartTime;//赛事开始时间
|
||||
|
||||
|
||||
public CompetitonStartMessageEvent(string Title, int Id, int RouteId, DateTime StartTime)
|
||||
public CompetitonStartMessageEvent(string Title, int Id, int RouteId, DateTime StartTime,string SceneName)
|
||||
{
|
||||
this.title = Title;
|
||||
this.competitionId = Id;
|
||||
this.routeId = RouteId;
|
||||
this.StartTime = StartTime;
|
||||
this.SceneName = SceneName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Assets.Scripts;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
@@ -9,11 +10,15 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public class RaceAlertController : PFUIPanel
|
||||
{
|
||||
public Text Content { get; set; }
|
||||
public Text BandContent { get; set; }
|
||||
public Text Timer { get; set; }
|
||||
|
||||
public GameObject GoBtn { get; set; }
|
||||
public GameObject Card { get; set; }
|
||||
public GameObject Band { get; set; }
|
||||
public GameObject BandGoBtn { get; set; }
|
||||
public GameObject StayBtn { get; set; }
|
||||
|
||||
public GameObject BandStayBtn { get; set; }
|
||||
|
||||
public int ticks = 0;
|
||||
|
||||
public int CompetitionId { get; set; }
|
||||
@@ -21,13 +26,25 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
//Card
|
||||
Timer = this.transform.Find("Card/Timer").GetComponent<Text>();
|
||||
Content = this.transform.Find("Card/Content").GetComponent<Text>();
|
||||
GoBtn = this.transform.Find("Card/Go").gameObject;
|
||||
StayBtn = this.transform.Find("Card/Stay").gameObject;
|
||||
Card = this.transform.Find("Card").gameObject;
|
||||
|
||||
//band
|
||||
BandContent = this.transform.Find("Band/Content").GetComponent<Text>();
|
||||
BandGoBtn = this.transform.Find("Band/Go").gameObject;
|
||||
BandStayBtn = this.transform.Find("Band/Stay").gameObject;
|
||||
Band = this.transform.Find("Band").gameObject;
|
||||
|
||||
UIManager.AddEvent(GoBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Go);
|
||||
UIManager.AddEvent(StayBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Stay);
|
||||
|
||||
UIManager.AddEvent(BandGoBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Go);
|
||||
UIManager.AddEvent(BandStayBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Stay);
|
||||
|
||||
}
|
||||
float t = 1f;
|
||||
private void Update()
|
||||
@@ -44,6 +61,22 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(DateTime startTime, DateTime now,string title, string sceneName, int competitionId,int routeId)
|
||||
{
|
||||
ticks = (int)(startTime - now).TotalSeconds;
|
||||
|
||||
var content = $"Your <color='#F93086'>{title}</color> race about to start";
|
||||
Content.text = content;
|
||||
BandContent.text = content;
|
||||
|
||||
CompetitionId = competitionId;
|
||||
RouteId = routeId;
|
||||
|
||||
var ride = sceneName.Equals("Ride");
|
||||
Card.SetActive(ride);
|
||||
Band.SetActive(!ride);
|
||||
}
|
||||
|
||||
//切换到当前用户视角
|
||||
public void Go(BaseEventData baseEventData)
|
||||
{
|
||||
|
||||
@@ -216,10 +216,7 @@ public class UIManager : MonoBehaviour
|
||||
ShowRaceAlertPanel();
|
||||
if (mRaceAlertPanel != null)
|
||||
{
|
||||
mRaceAlertPanel.ticks = (int)(e.StartTime.ToLocalTime() - Now.GetDateTime()).TotalSeconds;
|
||||
mRaceAlertPanel.Content.text = $"Your {e.title} race about to start";
|
||||
mRaceAlertPanel.CompetitionId = e.competitionId;
|
||||
mRaceAlertPanel.RouteId = e.routeId;
|
||||
mRaceAlertPanel.Set(e.StartTime.ToLocalTime(), Now.GetDateTime(), e.title, e.SceneName, e.competitionId, e.routeId);
|
||||
}
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
@@ -261,7 +258,7 @@ public class UIManager : MonoBehaviour
|
||||
var notify = App.CompetitionIdList.Contains(item.Id);
|
||||
if (onStart && !notify)
|
||||
{
|
||||
EventQueueSystem.QueueEvent(new CompetitonStartMessageEvent(item.Title, item.Id, item.RouteId, item.StartTime.ToLocalTime()));
|
||||
EventQueueSystem.QueueEvent(new CompetitonStartMessageEvent(item.Title, item.Id, item.RouteId, item.StartTime.ToLocalTime(), sceneName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user