赛事功能完善
创建比赛按钮;loading页面more按钮等
This commit is contained in:
1 parent
eed2d13624
commit
e76b5c443f
55 files changed
+7805
-3376
No files matched your search
@@ -103,7 +103,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
MapUDPService.Send(route.RouteInstance.Id, recorderData.BelongUserId,
|
||||
new double[] { lastData._Lat, lastData._Lon },
|
||||
recorderData.IsCompleted, false, recorderData.EndDistance,
|
||||
true, 1, lastData._Speed, false, preDistance, weightKg, competitionId: recorderData.Competitionid, recorderData.Saved);
|
||||
true, 1, lastData._Speed, false, preDistance, weightKg, competitionId: recorderData.Competitionid, recorderData.Saved, lastData._HeartRate, lastData._Power, lastData._Cadence, lastData.Ticks);
|
||||
}
|
||||
else if (recorderData.EndDistance > 0)//没有骑,但是有初始位置的情况
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CanStart())
|
||||
//if (CanStart())
|
||||
{
|
||||
var second = Math.Ceiling((Now - mapCompetition.StartTime.ToLocalTime()).TotalSeconds);
|
||||
|
||||
@@ -135,7 +135,11 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
WxHeadImg = item.HeadImage,
|
||||
Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]),
|
||||
EndDistance = item.EndDistance,
|
||||
PreDistance = item.PreDistance
|
||||
PreDistance = item.PreDistance,
|
||||
Power = item.Power,
|
||||
HeartRate = item.HeartRate,
|
||||
Cadence = item.Cadence,
|
||||
TotalTicks = item.TotalTicks,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -196,18 +200,58 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
CreateTime = createTime,
|
||||
TripTime = ranking?.TripTime ?? "",
|
||||
CompleteTime = ranking?.CompleteTime,
|
||||
Gap = ranking?.Gap ?? ""
|
||||
Gap = ranking?.Gap ?? "",
|
||||
Country = ranking.Country,
|
||||
WxHeadImg = ranking.WxHeadImg
|
||||
});
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 骑行实时排名&比赛结果列表 取前六名
|
||||
|
||||
List<CompetitionTopModel> CompetitionTopList = new List<CompetitionTopModel>();
|
||||
|
||||
var resultList =results.Take(6);
|
||||
var count = 6 - resultList.Count();
|
||||
//先取比赛结果
|
||||
foreach (var item in resultList)
|
||||
{
|
||||
CompetitionTopList.Add(new CompetitionTopModel
|
||||
{
|
||||
Index = item.Index,
|
||||
TripTime = item.TripTime,
|
||||
Country = item.Country,
|
||||
Name = item.Name,
|
||||
UserId = item.UserId
|
||||
});
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
var ss = sort.Where(c => !resultList.Select(p => p.UserId).Contains(c.UserId)).Take(count);
|
||||
foreach (var item in ss)
|
||||
{
|
||||
CompetitionTopList.Add(new CompetitionTopModel
|
||||
{
|
||||
Index = item.Index,
|
||||
TripTime = "———",
|
||||
Country = item.CountryImg,
|
||||
Name = item.Name,
|
||||
UserId = item.UserId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
competitionRankingModel = new CompetitionRankingModel
|
||||
{
|
||||
Sorts = sort,//骑行实时排名
|
||||
MyRanking = sort.FindIndex(n => n.UserId == currentPlayer.UserId) + 1,//切换人物显示对应人物的排名
|
||||
Total = sort.Count,//总人数
|
||||
Results = results//比赛结果列表
|
||||
Results = results,//比赛结果列表,
|
||||
TopList = CompetitionTopList,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -313,7 +357,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
/// <returns></returns>
|
||||
public (int, bool) EndCountDown()
|
||||
{
|
||||
if (CanStart() == false) return (0, false);
|
||||
//if (CanStart() == false) return (0, false);
|
||||
//if (recorderData.IsCompleted) return 0;
|
||||
var end1 = (int)Math.Floor((mapCompetition.EndTime.ToLocalTime() - Now).TotalSeconds);
|
||||
if (!FirstEndTime.HasValue)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string HeadUrl { get; set; }
|
||||
public string WxHeadImg { get; set; }
|
||||
|
||||
//public string Time { get; set; }
|
||||
|
||||
@@ -66,7 +66,9 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
/// 与冲线时间的差距
|
||||
/// </summary>
|
||||
public string Gap { get; set; }
|
||||
public string Country { get; set; }
|
||||
}
|
||||
|
||||
public class RankingDataModel
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
@@ -74,6 +76,18 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
public TargetData data { get; set; }
|
||||
}
|
||||
|
||||
public class CompetitionTopModel
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
public int Index { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Country { get; set; }
|
||||
|
||||
public string TripTime { get; set; }
|
||||
}
|
||||
|
||||
public class RankingSortData
|
||||
{
|
||||
public int Index { get; set; }
|
||||
@@ -114,6 +128,8 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
public int MyRanking { get; set; }
|
||||
|
||||
public List<CompetitionResultModel> Results { get; set; }
|
||||
|
||||
public List<CompetitionTopModel> TopList { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 骑行中 输出的数据模型
|
||||
@@ -311,6 +327,11 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
|
||||
public double Speed { get; set; }
|
||||
|
||||
public double Power { get; set; }
|
||||
public double? Heart { get; set; }
|
||||
public double? Cadence { get; set; }
|
||||
public int TotalTicks { get; set; }
|
||||
|
||||
public bool IsCompleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -367,6 +388,10 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
//public bool exit { get; set; }
|
||||
|
||||
public double Speed { get; set; }
|
||||
public double Power { get; set; }
|
||||
public double HeartRate { get; set; }
|
||||
public double Cadence { get; set; }
|
||||
public int TotoalTicks { get; set; }
|
||||
|
||||
public bool IsCompleted { get; set; }
|
||||
|
||||
@@ -403,7 +428,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
public static ReceiveMsgModel Parse(string str)
|
||||
{
|
||||
var list = str.Split(',');
|
||||
if (list.Length != 10)
|
||||
if (list.Length != 14)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -422,7 +447,11 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
EndDistance = Convert.ToDouble(list[6], CultureInfo.InvariantCulture),
|
||||
WeightKg = Convert.ToDouble(list[7], CultureInfo.InvariantCulture),
|
||||
Competitionid = Convert.ToInt32(list[8], CultureInfo.InvariantCulture),
|
||||
Saved = ToBoolean(list[9])
|
||||
Saved = ToBoolean(list[9]),
|
||||
Power = Convert.ToDouble(list[10], CultureInfo.InvariantCulture),
|
||||
HeartRate = Convert.ToDouble(list[11], CultureInfo.InvariantCulture),
|
||||
Cadence = Convert.ToDouble(list[12], CultureInfo.InvariantCulture),
|
||||
TotoalTicks = Convert.ToInt32(list[13], CultureInfo.InvariantCulture),
|
||||
};
|
||||
}
|
||||
catch
|
||||
@@ -511,6 +540,10 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
/// 速度(km/h)
|
||||
/// </summary>
|
||||
public double Speed { get; set; }
|
||||
public double Power { get; set; }
|
||||
public double HeartRate { get; set; }
|
||||
public double Cadence { get; set; }
|
||||
public int TotalTicks { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 圆形头像
|
||||
|
||||
@@ -16,6 +16,18 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
|
||||
public double Power { get; set; }
|
||||
public double HeartRate { get; set; }
|
||||
public double Cadence { get; set; }
|
||||
/// <summary>
|
||||
/// 骑行秒数
|
||||
/// </summary>
|
||||
public int TotalTicks { get; set; }
|
||||
/// <summary>
|
||||
/// 骑行毫秒数
|
||||
/// </summary>
|
||||
public int TotoalMillisecondTicks { get; set; }
|
||||
|
||||
public string InMapId
|
||||
{
|
||||
get
|
||||
|
||||
Reference in new issue
Block a user