轨迹插件引入
This commit is contained in:
1 parent
89b5275efd
commit
195893a1b0
1023 files changed
+378944
-18404
No files matched your search
@@ -30,6 +30,7 @@ namespace Assets.Scripts.Scenes.Scripts
|
||||
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam, manager.roomId).OrderByDescending(c=>c.EndDistance);
|
||||
int index = 1;
|
||||
num.text = list.Count().ToString();
|
||||
var current = list.Where(c => c.Id == manager.currentPlayer.UserId).FirstOrDefault();
|
||||
foreach (var item in list)
|
||||
{
|
||||
GameObject prefabItem = item.IsSelf ? nearByMajorItem : nearByItem;
|
||||
@@ -47,7 +48,7 @@ namespace Assets.Scripts.Scenes.Scripts
|
||||
competitionRankingItem.setHead(item.HeadImage);
|
||||
var countryTexture = manager.GetCountryImageByName(item.Country);
|
||||
competitionRankingItem.setCountry(countryTexture);
|
||||
var near = Math.Round((item.EndDistance - manager.currentPlayer.TotalDistance) * 1000);
|
||||
var near = Math.Round((item.EndDistance - current.EndDistance)*1000,0);
|
||||
competitionRankingItem.setDistance(manager.currentPlayer.UserId == item.Id ? "0M" : near.ToString() + "M");
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
competitionRankingItem.transform.SetSiblingIndex(index);
|
||||
@@ -64,33 +65,7 @@ namespace Assets.Scripts.Scenes.Scripts
|
||||
while (timer < 0)
|
||||
{
|
||||
InitData();
|
||||
//if (manager.currentPlayer == null)
|
||||
|
||||
//var totalDitance = manager.GetMapData().TotalDistance;
|
||||
//var currentDistance = manager.currentPlayer.TotalDistance;
|
||||
////var currenList = GetComponentsInChildren<ListItem>(true);
|
||||
//var list = MapUDPService.GetOnlineUsers(App.RouteIdParam, manager.cyclingController.recorderData.RoomId);
|
||||
//var currentPlayerInfo = list.Where(c => c.Id.ToString() == manager.currentPlayer.UserId.ToString()).FirstOrDefault();
|
||||
//list = list.Where(c => c.Id != App.CurrentUser.Id).ToList();
|
||||
//var currentPlayer = FindObjectOfType<AbstractPlayer>();
|
||||
|
||||
//foreach (ListItem o in currenList)
|
||||
//{
|
||||
// if (currentPlayer.UserId.ToString() == o.Id)
|
||||
// continue;
|
||||
// var needUpdate = list.Where(c => c.Id.ToString() == o.Id).FirstOrDefault();
|
||||
// if (needUpdate != null && currentPlayerInfo != null)
|
||||
// {
|
||||
// var left = Math.Round((needUpdate.EndDistance - currentPlayerInfo.EndDistance) * 1000);
|
||||
// o.UpdateItem(needUpdate.Name, left.ToString() + "M", needUpdate.Id.ToString());
|
||||
// o.gameObject.SetActive(true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// o.gameObject.SetActive(false);
|
||||
// }
|
||||
//}
|
||||
timer += 1f;
|
||||
timer += 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
GameObject timerIcon { get; set; }
|
||||
|
||||
GameModel model { get; set; }
|
||||
Text gameTimerText { get; set; }
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
@@ -40,7 +41,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
UIManager.AddEvent(raceViewBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeView);
|
||||
|
||||
spilitLineH2.SetActive(false);
|
||||
//timerTxt.gameObject.SetActive(false);
|
||||
timerTxt.gameObject.SetActive(false);
|
||||
gameTimerText = uipanel.transform.Find("ComputerPanel/GameTimer").GetComponent<Text>();
|
||||
gameTimerText.gameObject.SetActive(true);
|
||||
//timerTxtTitle.gameObject.SetActive(false);
|
||||
//观察者模式隐藏坡度
|
||||
if (mainController.isWatch)
|
||||
@@ -68,11 +71,23 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public void StartRide(int seconds)
|
||||
{
|
||||
mainController.SetCyclingModel(CyclingModel.GameRoom);
|
||||
count = seconds;
|
||||
startPanel.SetActive(false);
|
||||
startBtn.gameObject.SetActive(false);
|
||||
countDownTxt.gameObject.SetActive(true);
|
||||
countDownTxt.text = count.ToString();
|
||||
//如果是重新连接的话就不需要倒计时
|
||||
var ss = mainController.cyclingController.recorderData.RiderDatas;
|
||||
if (ss.Count > 0)
|
||||
{
|
||||
count = 0;
|
||||
startUI(0);
|
||||
countDownTxt.gameObject.SetActive(true);
|
||||
countDownTxt.text = count.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
count = seconds;
|
||||
countDownTxt.gameObject.SetActive(true);
|
||||
countDownTxt.text = count.ToString();
|
||||
}
|
||||
}
|
||||
bool canStart = false;
|
||||
GameObject watchPanel { get; set; }
|
||||
@@ -112,26 +127,16 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (timeRemaining <= 0)//定时器
|
||||
{
|
||||
count--;
|
||||
if (count == 0)
|
||||
{
|
||||
mainController.SetStart();
|
||||
var canvasGroup = countDownTxt.transform.GetComponent<CanvasGroup>();
|
||||
canvasGroup.DOFade(0, 1).onComplete += () => {
|
||||
countDownTxt.gameObject.SetActive(false);
|
||||
canvasGroup.alpha = 1;
|
||||
};
|
||||
}
|
||||
if (count == 1 && mainController.cyclingModel == CyclingModel.Single)
|
||||
{
|
||||
reviewPanel.GetComponent<CanvasGroup>().DOFade(0, 1).onComplete += () => {
|
||||
reviewPanel.gameObject.SetActive(false);
|
||||
};
|
||||
}
|
||||
countDownTxt.transform.DOPunchScale(new Vector3(1.2f, 1.2f, 1.2f), 1, 1, 1);
|
||||
timeRemaining = 1.0f;
|
||||
startUI(count);
|
||||
timeRemaining += 1.0f;
|
||||
}
|
||||
}
|
||||
countDownTxt.text = count == 0 ? App.GetLocalString("GO!") : count.ToString();
|
||||
if (mainController.isStart)
|
||||
{
|
||||
var ticks = playerController.TotalTicks;
|
||||
gameTimerText.text = Helper.FormatTicks(ticks);
|
||||
}
|
||||
countDownTxt.text = count <= 0 ? App.GetLocalString("GO!") : count.ToString();
|
||||
model = mainController.cyclingController as GameModel;
|
||||
//第一名诞生开始倒计时,倒计时结束自动保存
|
||||
if (model != null && model.FirstEndTime.HasValue && !FirstCompleted && App.CurrentUser.Id != model.FirstUserId)
|
||||
@@ -152,6 +157,28 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
private void startUI(int num)
|
||||
{
|
||||
if (num <= 0)
|
||||
{
|
||||
mainController.SetStart();
|
||||
var canvasGroup = countDownTxt.transform.GetComponent<CanvasGroup>();
|
||||
canvasGroup.DOFade(0, 1).onComplete += () => {
|
||||
countDownTxt.gameObject.SetActive(false);
|
||||
canvasGroup.alpha = 1;
|
||||
};
|
||||
}
|
||||
if (num == 1 && mainController.cyclingModel == CyclingModel.Single)
|
||||
{
|
||||
reviewPanel.GetComponent<CanvasGroup>().DOFade(0, 1).onComplete += () => {
|
||||
reviewPanel.gameObject.SetActive(false);
|
||||
};
|
||||
}
|
||||
countDownTxt.transform.DOPunchScale(new Vector3(1.2f, 1.2f, 1.2f), 1, 1, 1);
|
||||
countDownTxt.text = num <= 0 ? App.GetLocalString("GO!") : num.ToString();
|
||||
model = mainController.cyclingController as GameModel;
|
||||
}
|
||||
|
||||
private bool FirstCompleted;
|
||||
|
||||
private bool Saved;
|
||||
|
||||
Reference in new issue
Block a user