AR骑行beta
This commit is contained in:
1 parent
4d5bc8f080
commit
9b1bb3d9ba
45 files changed
+35055
-2401
No files matched your search
@@ -67,6 +67,14 @@ class GameRoomDownLoad : MonoBehaviour
|
||||
});
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(FileName) && Loom.DownLoadTaskList.ContainsKey(FileName))
|
||||
{
|
||||
processing(Loom.DownLoadTaskList[FileName]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Init(int Id,string fileName,string url, GameRoomListController gameRoomListController)
|
||||
{
|
||||
RoomId = Id;
|
||||
@@ -74,6 +82,12 @@ class GameRoomDownLoad : MonoBehaviour
|
||||
FileUrl = url;
|
||||
manager = gameRoomListController;
|
||||
}
|
||||
public void ComeIntoStep2(string fileName)
|
||||
{
|
||||
FileName = fileName;
|
||||
step2.SetActive(true);
|
||||
step3.SetActive(false);
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
@@ -86,6 +100,18 @@ class GameRoomDownLoad : MonoBehaviour
|
||||
Reset();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
private void processing(float p)
|
||||
{
|
||||
downloadSlider.value = p;
|
||||
if (Loom.DownLoadTaskList.ContainsKey(FileName))
|
||||
{
|
||||
Loom.DownLoadTaskList[FileName] = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
Loom.DownLoadTaskList.Add(FileName, p);
|
||||
}
|
||||
}
|
||||
|
||||
private void DownloadClick(BaseEventData baseEventData)
|
||||
{
|
||||
@@ -105,16 +131,8 @@ class GameRoomDownLoad : MonoBehaviour
|
||||
Loom.Current.StartCoroutine(Utils.DownloadVideo(fileName, url
|
||||
, (p, req) =>
|
||||
{
|
||||
downloadSlider.value = p;
|
||||
currentTask.UpdateProcess(p);
|
||||
if (Loom.DownLoadTaskList.ContainsKey(FileName))
|
||||
{
|
||||
Loom.DownLoadTaskList[FileName] = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
Loom.DownLoadTaskList.Add(FileName, p);
|
||||
}
|
||||
processing(p);
|
||||
}
|
||||
, (p) =>
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ class GameRoomDownloadTask : MonoBehaviour
|
||||
UIManager.AddEvent(btn, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
modal.SetActive(true);
|
||||
modal.GetComponent<GameRoomDownLoad>().ComeIntoStep2(FileName);
|
||||
transform.parent.parent.parent.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnter
|
||||
if (gameObject != null)
|
||||
{
|
||||
slider.value = process;
|
||||
ShowOutLine();
|
||||
Ride();
|
||||
transform.Find("DownLoadModal").gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnter
|
||||
var fileName = map.FileName;
|
||||
var path = PFConstants.VideoFolder;
|
||||
var filepath = path + "/" + fileName;
|
||||
//if ((map.EnableAR && !File.Exists(filepath) )|| !map.EnableAR)
|
||||
if ((map.EnableAR && File.Exists(filepath) )|| !map.EnableAR)
|
||||
{
|
||||
var list = FindObjectsOfType<GameRoomMapItem>();
|
||||
foreach (var item in list)
|
||||
|
||||
@@ -43,20 +43,19 @@ class GameRoomPlayerPanel : MonoBehaviour
|
||||
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if (App.gameRoomDetail.UserId != App.CurrentUser.Id)
|
||||
if (App.gameRoomDetail.UserId == UserId)
|
||||
return;
|
||||
kickModal.SetActive(true);
|
||||
});
|
||||
UIManager.AddEvent(cancelBtn, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if (App.gameRoomDetail.UserId != App.CurrentUser.Id)
|
||||
return;
|
||||
kickModal.SetActive(false);
|
||||
});
|
||||
UIManager.AddEvent(kickBtn, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if (App.gameRoomDetail.UserId != App.CurrentUser.Id)
|
||||
return;
|
||||
kickModal.SetActive(false);
|
||||
MapUDPService.SendGameRoomKick(App.gameRoomDetail.RoomId, UserId, App.CurrentUser.Id);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.UI.UIEffect;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
using Assets.Scripts.Scenes.VideoRide;
|
||||
using System;
|
||||
|
||||
public class GameRoomResult : MonoBehaviour
|
||||
{
|
||||
VideoGameManager manager;
|
||||
RawImage Head;
|
||||
Text Ranking;
|
||||
Text Timer;
|
||||
GameObject Mine { get; set; }
|
||||
GameObject TitleImage { get; set; }
|
||||
GameObject WatchTitle { get; set; }
|
||||
GameObject RankingPanel { get; set; }
|
||||
GameObject ShareButton { get; set; }
|
||||
GameObject ToolBarPanel { get; set; }
|
||||
GameObject WeChatButton { get; set; }
|
||||
GameObject WeChatGpButton { get; set; }
|
||||
RawImage TopHead { get; set; }
|
||||
RawImage SecondHead { get; set; }
|
||||
RawImage ThirdHead { get; set; }
|
||||
Image Top { get; set; }
|
||||
Sprite SpriteTop { get; set; }
|
||||
Sprite SpriteSecond { get; set; }
|
||||
Sprite SpriteThrid { get; set; }
|
||||
|
||||
Text RankingTitle { get; set; }
|
||||
Text TimerTitle { get; set; }
|
||||
Text CloseTime { get; set; }
|
||||
Text CloseTitle { get; set; }
|
||||
private void Awake()
|
||||
{
|
||||
manager = FindObjectOfType<VideoGameManager>();
|
||||
var closeBtn = transform.Find("Close").gameObject;
|
||||
Head = transform.Find("Mine/Head").GetComponent<RawImage>();
|
||||
Ranking = transform.Find("Mine/Ranking").GetComponent<Text>();
|
||||
RankingTitle = transform.Find("Mine/RankingTitle").GetComponent<Text>();
|
||||
TimerTitle = transform.Find("Mine/TimerTitle").GetComponent<Text>();
|
||||
Timer = transform.Find("Mine/Timer").GetComponent<Text>();
|
||||
Top = transform.Find("Mine/TOP").GetComponent<Image>();
|
||||
Mine = transform.Find("Mine").gameObject;
|
||||
RankingPanel = transform.Find("Ranking").gameObject;
|
||||
TopHead = transform.Find("Ranking/TopHead").GetComponent<RawImage>();
|
||||
SecondHead = transform.Find("Ranking/SecondHead").GetComponent<RawImage>();
|
||||
ThirdHead = transform.Find("Ranking/ThirdHead").GetComponent<RawImage>();
|
||||
TitleImage = transform.Find("TitleImage").gameObject;
|
||||
WatchTitle = transform.Find("WatchTitle").gameObject;
|
||||
CloseTitle = transform.Find("CloseTitle").GetComponent<Text>();
|
||||
CloseTime = transform.Find("CloseTime").GetComponent<Text>();
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
ShareButton = transform.Find("ShareButton").gameObject;
|
||||
ToolBarPanel = transform.Find("ToolBarPanel").gameObject;
|
||||
WeChatButton = transform.Find("ToolBarPanel/WeChatButton").gameObject;
|
||||
WeChatGpButton = transform.Find("ToolBarPanel/GoogleButton").gameObject;
|
||||
UIManager.AddEvent(WeChatButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShareWechat);
|
||||
UIManager.AddEvent(WeChatGpButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShareWechatGp);
|
||||
var fbButton = transform.Find("ToolBarPanel/FaceBookButton").gameObject;
|
||||
UIManager.AddEvent(fbButton, EventTriggerType.PointerClick, shareFb);
|
||||
#endif
|
||||
SpriteTop = Resources.Load<Sprite>("Images/Ride/Match/top-1");
|
||||
SpriteSecond = Resources.Load<Sprite>("Images/Ride/Match/top-2");
|
||||
SpriteThrid = Resources.Load<Sprite>("Images/Ride/Match/top-3");
|
||||
|
||||
UIManager.AddEvent(closeBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Close);
|
||||
}
|
||||
|
||||
|
||||
float time = 1;
|
||||
private void Update()
|
||||
{
|
||||
time -= Time.deltaTime;
|
||||
while (time < 0)
|
||||
{
|
||||
Refresh();
|
||||
time += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private Color RED = new Color(0.9764706f, 0.1882353f, 0.5254902f);
|
||||
private Color SHALLOW_RED = new Color(1f, 0.454902f, 0.5215687f);
|
||||
|
||||
private Color PURPLE = new Color(0.1568628f, 0.4431373f, 0.8745098f);
|
||||
private Color SHALLOW_PURPLE = new Color(0.3843137f, 0.7764706f, 1f);
|
||||
|
||||
private Color BLUE = new Color(0.4352941f, 0.3333333f, 0.9372549f);
|
||||
private Color SHALLOW_BLUE = new Color(0.772549f, 0.5529412f, 1f);
|
||||
|
||||
private Color WHITE = new Color(1f, 1f, 1f);
|
||||
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
if (manager.cyclingController is GameModel model)
|
||||
{
|
||||
if (model == null)
|
||||
return;
|
||||
var list = model.mapWorkoutRecordRankings;
|
||||
if (list == null) return;
|
||||
var parent = transform.Find("ScrollView/Viewport/Content");
|
||||
Mine.SetActive(true);
|
||||
RankingPanel.SetActive(false);
|
||||
TitleImage.SetActive(true);
|
||||
WatchTitle.SetActive(false);
|
||||
|
||||
if (model.FirstEndTime.HasValue)
|
||||
{
|
||||
var gap = model.FirstEndTime.Value - UIManager.Now.GetDateTime();
|
||||
var seconds = (int)Math.Floor(gap.TotalSeconds);
|
||||
CloseTime.text = Helper.FormatTicks(seconds);
|
||||
CloseTitle.gameObject.SetActive(true);
|
||||
CloseTime.gameObject.SetActive(true);
|
||||
}
|
||||
//当前用户排名
|
||||
var currentRanking = list.Where(c => c.UserId == manager.CurrentPlayer.UserId).FirstOrDefault();
|
||||
if (currentRanking != null)
|
||||
{
|
||||
Utils.DisplayImage(Head, currentRanking.WxHeadImg, true);
|
||||
Ranking.text = currentRanking.Rank.ToString().PadLeft(3, '0');
|
||||
Timer.text = currentRanking.TotalTime;
|
||||
var uigradient = Mine.transform.GetComponent<UIGradient>();
|
||||
if (currentRanking.Rank <= 3)
|
||||
{
|
||||
TimerTitle.color = WHITE;
|
||||
RankingTitle.color = WHITE;
|
||||
}
|
||||
if (currentRanking.Rank == 1)
|
||||
{
|
||||
uigradient.color1 = RED;
|
||||
uigradient.color2 = SHALLOW_RED;
|
||||
Top.sprite = SpriteTop;
|
||||
Top.gameObject.SetActive(true);
|
||||
}
|
||||
if (currentRanking.Rank == 2)
|
||||
{
|
||||
uigradient.color1 = PURPLE;
|
||||
uigradient.color2 = SHALLOW_PURPLE;
|
||||
Top.sprite = SpriteSecond;
|
||||
Top.gameObject.SetActive(true);
|
||||
}
|
||||
if (currentRanking.Rank == 3)
|
||||
{
|
||||
uigradient.color1 = BLUE;
|
||||
uigradient.color2 = SHALLOW_BLUE;
|
||||
Top.sprite = SpriteThrid;
|
||||
Top.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
//排名列表
|
||||
var rankingList = FindObjectsOfType<FinalRankingItemScript>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
var finalRankingItemScript = rankingList.Where(c => c.UserId == item.UserId).FirstOrDefault();
|
||||
//没有就创建
|
||||
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>();
|
||||
}
|
||||
//有就更新
|
||||
finalRankingItemScript.setGap(item.Gap);
|
||||
finalRankingItemScript.setSource(item.Source);
|
||||
finalRankingItemScript.setUserId(item.UserId, item.WxHeadImg);
|
||||
finalRankingItemScript.setRanking(item.Rank);
|
||||
finalRankingItemScript.setHeartRate(item.HeartRate);
|
||||
finalRankingItemScript.setName(item.NickName);
|
||||
finalRankingItemScript.setPower(item.Power);
|
||||
finalRankingItemScript.setRatio(item.WeightKG);
|
||||
finalRankingItemScript.setTimer(item.TotalTime);
|
||||
finalRankingItemScript.transform.SetSiblingIndex(item.Rank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Close(BaseEventData baseEventData)
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
this.Destroy();
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 873bd5947356d6f4d84526e63f9643fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user