赛事loading页面状态实时变化和一些微调
This commit is contained in:
1 parent
ea79b6cfc5
commit
0eb399be9a
16 files changed
+4074
-2881
No files matched your search
@@ -11,7 +11,7 @@ using Assets.Scripts.Devices;
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static string Host = "http://192.168.0.101:5085/";
|
||||
public static string Host = "http://192.168.0.102:5082/";
|
||||
|
||||
public static string AppVersion = Application.version;
|
||||
|
||||
|
||||
@@ -63,7 +63,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
GetReadyTitle.gameObject.SetActive(false);
|
||||
GetReady.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
var applyCount = (int)(competition.StartApplyTime.ToLocalTime() - UIManager.Now.GetDateTime()).TotalSeconds;
|
||||
if (count == 0 || applyCount == 0)
|
||||
{
|
||||
UpdateCompetition();
|
||||
}
|
||||
//1.报名按钮
|
||||
Apply.SetActive(_canJoin);
|
||||
//2.观看按钮
|
||||
@@ -141,7 +145,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//比赛开始时间
|
||||
StartTime.text = competition.StartTime.ToLongTimeString();
|
||||
//比赛状态
|
||||
CompetitionStatus.text = GetENStatus(competition.StatusVlaue.ToString());
|
||||
CompetitionStatus.text = competition.StatusVlaue.ToString();
|
||||
//参赛选手
|
||||
Contestant.text = competition.UserList.Count.ToString() + "Players";
|
||||
ShowPlayers(competition.UserList);
|
||||
@@ -191,17 +195,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
}
|
||||
private string GetENStatus(string status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case "已结束": return "DONE";
|
||||
case "未开始": return "APPLIED";
|
||||
case "报名中": return "APPLLYING";
|
||||
case "比赛中": return "RACING";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#region 事件
|
||||
|
||||
//查看赛事详情
|
||||
@@ -221,6 +214,24 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
Application.OpenURL(App.CurrentUser.WebHost + $"#/Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}");
|
||||
}
|
||||
|
||||
private void UpdateCompetition()
|
||||
{
|
||||
MapCompetitionApi s = ConfigHelper.mapCompetitionApi;
|
||||
var result = s.GetById(cyclingController.competitionId);
|
||||
if (result.result == false || result.data == null)
|
||||
{
|
||||
Utils.showToast(gameObject, "error when get competition information");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
competition = result.data;
|
||||
_canStart = competition.CanStart;
|
||||
_canJoin = competition.CanJoin;
|
||||
_canCancelApply = competition.applyed;
|
||||
}
|
||||
}
|
||||
protected void ApplyRace(BaseEventData baseEvent)
|
||||
{
|
||||
UIManager.ShowConfirm("Apply", "Are your want to Apply this race?", async () =>
|
||||
@@ -229,22 +240,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var rrr = s.ApplyMapCompetition(cyclingController.competitionId);
|
||||
if (rrr.result)
|
||||
{
|
||||
var result = s.GetById(cyclingController.competitionId);
|
||||
if (result.result == false || result.data == null)
|
||||
{
|
||||
Utils.showToast(gameObject, "error when get competition information");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
competition = result.data;
|
||||
_canStart = competition.CanStart;
|
||||
_canJoin = competition.CanJoin;
|
||||
_canCancelApply = competition.applyed;
|
||||
|
||||
UIManager.UpdateJoinCompetition();
|
||||
Utils.showToast(gameObject, "success", 2, 1);
|
||||
}
|
||||
UpdateCompetition();
|
||||
UIManager.UpdateJoinCompetition();
|
||||
Utils.showToast(gameObject, "success", 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -268,22 +266,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var data = api.CancelMapCompetition(cyclingController.competition.Id);
|
||||
if (data.result)
|
||||
{
|
||||
var result = api.GetById(cyclingController.competitionId);
|
||||
if (result.result == false || result.data == null)
|
||||
{
|
||||
Utils.showToast(gameObject, "error when get competition information");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
competition = result.data;
|
||||
_canStart = competition.CanStart;
|
||||
_canJoin = competition.CanJoin;
|
||||
_canCancelApply = competition.applyed;
|
||||
|
||||
UIManager.UpdateJoinCompetition();
|
||||
Utils.showToast(gameObject, "success", 2, 1);
|
||||
}
|
||||
UpdateCompetition();
|
||||
UIManager.UpdateJoinCompetition();
|
||||
Utils.showToast(gameObject, "success", 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,6 +23,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
reviewPanel.SetActive(false);
|
||||
//隐藏单人骑行时间
|
||||
var spilitLineH2 = transform.Find("Panel/ComputerPanel/SpilitLineH2").gameObject;
|
||||
var raceViewBtn = transform.Find("Panel/RaceViewButton").gameObject;
|
||||
raceViewBtn.SetActive(true);
|
||||
viewButton.gameObject.SetActive(false);
|
||||
UIManager.AddEvent(raceViewBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeView);
|
||||
|
||||
spilitLineH2.SetActive(false);
|
||||
timerTxt.gameObject.SetActive(false);
|
||||
timerTxtTitle.gameObject.SetActive(false);
|
||||
@@ -55,7 +60,6 @@ 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"));
|
||||
title = countDownPanel.transform.Find("Title").GetComponent<Text>();
|
||||
timer = countDownPanel.transform.Find("Timer").GetComponent<Text>();
|
||||
|
||||
@@ -61,11 +61,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
competitionRankingItem = rankingList.OrderByDescending(c => c.rank).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
competitionRankingItem.setHead(item.Head);
|
||||
competitionRankingItem.setTimer(item.TripTime);
|
||||
competitionRankingItem.SetRank(item.Index);
|
||||
competitionRankingItem.setName(item.Name);
|
||||
competitionRankingItem.setUserId(item.UserId);
|
||||
competitionRankingItem.setCountry(item.Country);
|
||||
var countryTexture = cyclingController.GetCountryImageByName(item.Country);
|
||||
competitionRankingItem.setCountry(countryTexture);
|
||||
competitionRankingItem.transform.SetSiblingIndex(item.Index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,12 +56,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
public void setCountry(string url)
|
||||
public void setCountry(Texture texture)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
Utils.DisplayImage(Country, url, true);
|
||||
}
|
||||
Country.texture = texture;
|
||||
}
|
||||
public void setName(string name)
|
||||
{
|
||||
|
||||
@@ -94,6 +94,10 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
{
|
||||
try
|
||||
{
|
||||
if (recorderData.Saved)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (recorderData.RiderDatas.Any())
|
||||
{
|
||||
var lastData = recorderData.RiderDatas.Last();
|
||||
|
||||
@@ -223,7 +223,8 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
TripTime = item.TripTime,
|
||||
Country = item.Country,
|
||||
Name = item.Name,
|
||||
UserId = item.UserId
|
||||
UserId = item.UserId,
|
||||
Head = item.WxHeadImg,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -238,7 +239,8 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
TripTime = "———",
|
||||
Country = item.CountryImg,
|
||||
Name = item.Name,
|
||||
UserId = item.UserId
|
||||
UserId = item.UserId,
|
||||
Head = item.Headimage,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,8 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
|
||||
public string Country { get; set; }
|
||||
|
||||
public string Head { get; set; }
|
||||
|
||||
public string TripTime { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
public List<MapRouteRanking> mapRouteRankingList { get; set; }
|
||||
private Vector2d coordiantes;//当前地图中心
|
||||
|
||||
public bool isStart;//当前游戏是否开始
|
||||
public bool isStart { get; set; }//当前游戏是否开始
|
||||
public CyclingModel cyclingModel { get; set; }//当前骑行模式
|
||||
public BaseCycling cyclingController { get; set; }
|
||||
private int routeId;
|
||||
@@ -684,7 +684,6 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
|
||||
string imageFileName = path +"/"+ Guid.NewGuid().ToString() + ".png";
|
||||
CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f), imageFileName);
|
||||
|
||||
cyclingController.recorderData.StartTime = startTime;
|
||||
cyclingController.recorderData.EndTime = UIManager.Now.GetDateTime();
|
||||
cyclingController.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
||||
|
||||
@@ -10,14 +10,10 @@ 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 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;
|
||||
|
||||
@@ -27,54 +23,37 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected override void Awake()
|
||||
{
|
||||
//Card
|
||||
Timer = this.transform.Find("Card/Timer").GetComponent<Text>();
|
||||
//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()
|
||||
{
|
||||
t -= Time.deltaTime;
|
||||
while (t <= 0)
|
||||
{
|
||||
if (ticks > 0)
|
||||
{
|
||||
ticks--;
|
||||
Timer.text = Helper.FormatTicks(ticks);
|
||||
}
|
||||
t = 1f;
|
||||
}
|
||||
//t -= Time.deltaTime;
|
||||
//while (t <= 0)
|
||||
//{
|
||||
// if (ticks > 0)
|
||||
// {
|
||||
// ticks--;
|
||||
// Timer.text = Helper.FormatTicks(ticks);
|
||||
// }
|
||||
// t = 1f;
|
||||
//}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//切换到当前用户视角
|
||||
|
||||
+38
-11
@@ -61,12 +61,12 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
private SettingContoller mSettingContoller;
|
||||
public SettingContoller SettingModal
|
||||
public SettingContoller SettingModal
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
return this.GetPanelInstance("SettingModal", ref this.mSettingContoller);
|
||||
}
|
||||
}
|
||||
}
|
||||
private FeedbackController mfeedbackController;
|
||||
public FeedbackController FeedbackModal
|
||||
@@ -92,7 +92,7 @@ public class UIManager : MonoBehaviour
|
||||
return this.GetPanelInstance("DownloadModal", ref this.mDownloadModal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private MapListController mMapListController;
|
||||
public MapListController MapListPanel
|
||||
{
|
||||
@@ -120,6 +120,15 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private RaceAlertController mRaceAlertBandPanel;
|
||||
public RaceAlertController RaceAlertBandPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetPanelInstance("RaceAlertBandPanel", ref this.mRaceAlertBandPanel);
|
||||
}
|
||||
}
|
||||
|
||||
private EditUserController mEditUserController;
|
||||
public EditUserController EditUserPanel
|
||||
{
|
||||
@@ -139,7 +148,7 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
public static void ShowRaceHomePanel(bool fromRaceList = false)
|
||||
{
|
||||
if (fromRaceList)
|
||||
if (fromRaceList)
|
||||
{
|
||||
UIManager.PopStack();
|
||||
}
|
||||
@@ -194,7 +203,7 @@ public class UIManager : MonoBehaviour
|
||||
var settingsJson = PlayerPrefs.GetString("Settings");
|
||||
settings = JsonConvert.DeserializeObject<Settings>(settingsJson);
|
||||
if (settings == null) settings = new Settings();
|
||||
|
||||
|
||||
userInfoIndex = PlayerPrefs.GetInt("UserInfoIndex");
|
||||
collectDict = new Dictionary<bool, Sprite> {
|
||||
{ false,Resources.Load<Sprite>("Images/p-4灰")},
|
||||
@@ -202,8 +211,8 @@ public class UIManager : MonoBehaviour
|
||||
};
|
||||
var a = Resources.Load<TextAsset>("UI/simpleCountry");
|
||||
var clist = JsonConvert.DeserializeObject<List<CountryInfo>>(a.text);
|
||||
|
||||
if(_now == null)
|
||||
|
||||
if (_now == null)
|
||||
{
|
||||
Debug.Log(123);
|
||||
InitNow();
|
||||
@@ -213,11 +222,24 @@ public class UIManager : MonoBehaviour
|
||||
//比赛即将开始消息提醒
|
||||
private void CompetitonStartHandler(CompetitonStartMessageEvent e)
|
||||
{
|
||||
ShowRaceAlertPanel();
|
||||
if (mRaceAlertPanel != null)
|
||||
if (e.SceneName.Equals("Ride"))
|
||||
{
|
||||
mRaceAlertPanel.Set(e.StartTime.ToLocalTime(), Now.GetDateTime(), e.title, e.SceneName, e.competitionId, e.routeId);
|
||||
ShowRaceAlertPanel();
|
||||
if (mRaceAlertPanel != null)
|
||||
{
|
||||
mRaceAlertPanel.Set(e.StartTime.ToLocalTime(), Now.GetDateTime(), e.title, e.SceneName, e.competitionId, e.routeId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowRaceAlertBanelPanel();
|
||||
if (mRaceAlertBandPanel != null)
|
||||
{
|
||||
mRaceAlertBandPanel.Set(e.StartTime.ToLocalTime(), Now.GetDateTime(), e.title, e.SceneName, e.competitionId, e.routeId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -458,6 +480,11 @@ public class UIManager : MonoBehaviour
|
||||
UIManager.Show(UIManager.Instance.RaceAlertPanel, null, true);
|
||||
}
|
||||
|
||||
public static void ShowRaceAlertBanelPanel()
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.RaceAlertBandPanel, null, true);
|
||||
}
|
||||
|
||||
//LoadingPf loading;
|
||||
public static void ShowLoadingDialogBox()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user