对战初步完成

This commit is contained in:
lishuo committed 2022-05-10 19:24:07 +08:00
1 parent b0c0890ca3
commit 509c309252
55 files changed
+7079 -6748

No files matched your search

@@ -214,7 +214,7 @@ namespace Assets.Scripts.Scenes.VideoRide
distance = 0;
}
//一旦有功率就开始骑行、否则暂停
if (!manager.IsQuit() && manager.CurrentPlayer.UserId == UserId && !manager.IsQuit())
if (!manager.IsQuit() && manager.CurrentPlayer.UserId == UserId && !manager.IsQuit() && manager.cyclingModel == Assets.Scenes.Ride.Scripts.Model.CyclingModel.Single)
{
if (power > 0)
{
@@ -65,6 +65,8 @@ namespace Assets.Scripts.Scenes.VideoRide
//移动当前线上其他人头像
private void MoveOnlinePlayerHead()
{
if (manager.cyclingController == null)
return;
var players = manager.cyclingController.riders;
var headList = FindObjectsOfType<HeadScript>();
var videoPlayer = manager.CurrentPlayer;
@@ -108,8 +108,8 @@ namespace Assets.Scripts.Scenes.VideoRide
};
}
endDistance = 0;
//倒计时5s开始
SetCyclingModel(CyclingModel.Single);
////倒计时5s开始
//SetCyclingModel(CyclingModel.Single);
videoLoading = FindObjectOfType<VideoLoading>();
@@ -121,13 +121,15 @@ namespace Assets.Scripts.Scenes.VideoRide
}
VideoLoading videoLoading { get; set; }
// Update is called once per frame
float timer = 0.5f;
float timer = 0f;
void Update()
{
timer -= Time.deltaTime;
while (timer <= 0)
{
cyclingController?.Run(null);
if (cyclingController == null)
return;
cyclingController.Run(null);
var onlineRiders = cyclingController.riders;
try
{
@@ -137,7 +139,7 @@ namespace Assets.Scripts.Scenes.VideoRide
{
Debug.Log(e.Message);
}
timer += 0.5f;
timer += 1f;
}
}
MapRouteRankingList rankingList;
@@ -335,6 +337,9 @@ namespace Assets.Scripts.Scenes.VideoRide
case CyclingModel.Single:
cyclingController = new SingleModel(route, selectParamModel);
break;
case CyclingModel.GameRoom:
cyclingController = new GameModel(route, selectParamModel);
break;
}
}
//模拟登录
@@ -478,6 +483,7 @@ namespace Assets.Scripts.Scenes.VideoRide
cyclingController.recorderData.ManufacturerName = ManufacturerName;
cyclingController.recorderData.DeviceNumber = DeviceNumber;
cyclingController.recorderData.LastFrame = GetCurrentFrame();
cyclingController.recorderData.RoomId = App.gameRoomDetail?.RoomId;//房间ID
RankingId = cyclingController.recorderData.SaveWithLocalRecordAysnc(cyclingModel, selectParamModel, imageFileName, recordId, path);
}
@@ -211,11 +211,26 @@ namespace Assets.Scripts.Scenes.VideoRide
var ui = manager.GetCanvasTransform();
canvasGroup.DOFade(0, 1).onComplete += () => {
gameObject.SetActive(false);
manager.SetCyclingModel(Assets.Scenes.Ride.Scripts.Model.CyclingModel.Single);
manager.SetCurrentMode(VideoGameManager.ARMode.RIDE);
ui.Find("Panel").gameObject.SetActive(true);
};
}
public void StartRide(int seconds)
{
var ui = manager.GetCanvasTransform();
canvasGroup.DOFade(0, 0).onComplete += () => {
gameObject.SetActive(false);
manager.SetCyclingModel(Assets.Scenes.Ride.Scripts.Model.CyclingModel.GameRoom);
manager.SetCurrentMode(VideoGameManager.ARMode.RIDE);
ui.Find("Panel").gameObject.SetActive(true);
};
UIManager.ShowGameRoomCountDownPanel(seconds,()=> {
manager.StartGame();
});
}
protected void Download(BaseEventData baseEvent)
{
StartCoroutine(Utils.DownloadVideo(route.FileName, route.Url