using GeoJSON.Net.Geometry; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assets.Scenes.Ride.Scripts.Model { public class VideoMapModel { public double x { get; set; } public double y { get; set; } public double speed { get; set; } public int position { get; set; } } /// /// 排名 /// public class CompetitionRankingSortModel { public int Index { get; set; } public string Name { get; set; } public string Headimage { get; set; } public double Near { get; set; } public string KGWeight { get; set; } public double Speed { get; set; } public string CountryImg { get; set; } public int UserId { get; set; } public bool IsSelf { get; set; } public DateTime CreateTime { get; set; } public bool IsCompleted { get; set; } public double EndDistance { get; set; } } /// /// 结果页模型 /// public class CompetitionResultModel { public int Index { get; set; } public int UserId { get; set; } public string Name { get; set; } public string WxHeadImg { get; set; } //public string Time { get; set; } public double Power { get; set; } public double WeightKg { get; set; } public double Weight { get; set; } public double BicycleWeight { get; set; } public double? HeartRate { get; set; } public string DeviceType { get; set; } public string CreateTime { get; set; } /// /// 骑行时长 /// public string TripTime { get; set; } public string CompleteTime { get; set; } /// /// 与冲线时间的差距 /// public string Gap { get; set; } public string Country { get; set; } } public class RankingDataModel { public int UserId { get; set; } 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 Head { get; set; } public string TripTime { get; set; } } public class RankingSortData { public int Index { get; set; } public int UserId { get; set; } public string WxHeadImg { get; set; } public string NickName { get; set; } /// /// 注意这里TotalTime不是时间是距离,为了重用前端组件,没改名称 /// public double TotalTime { get; set; } public int Ticks { get; set; } /// /// 其他人和我的距离(m) /// public double Near { get; set; } } public class CyclingFrameRankingModel { public List data { get; set; } public List sort { get; set; } public int myranking { get; set; } } /// /// 比赛的排名 /// public class CompetitionRankingModel { public List Sorts { get; set; } public int Total { get; set; } public int MyRanking { get; set; } public List Results { get; set; } public List TopList { get; set; } } /// /// 骑行中 输出的数据模型 /// public class OutModel { public double progress { get; set; } public double? Elevation { get; set; } public string Seconds { get; set; } public int? EleIndex { get; set; } //public long ExcuteTime { get; set; } //public double? Bearing { get; set; } /// /// 坡度 /// public double SlopeGrade { get; set; } public TargetData targetData { get; set; } public List baseRiders { get; set; } public CyclingFrameRankingModel Ranking { get; set; } public CompetitionRankingModel CompetitionRanking { get; set; } public bool CanStart { get; set; } = true; /// /// 开始倒计时 /// public int StartCountDown { get; set; } /// /// 结束倒计时 /// public int EndCountDown { get; set; } /// /// 标识比赛的倒计时是关门时间 /// public bool IsClosed { get; set; } ///// ///// 是否已保存 ///// //public bool Saved { get; set; } /// /// 比赛模式下,第一名的坐标 /// public GeographicPosition FirstPoint { get; set; } public ChartSymbol ChartSymbol { get; set; } } public class OutUser { public int UserId { get; set; } public string InMapId { get; set; } public double NextDistance { get; set; } public double PreDistance { get; set; } //public TargetData targetData { get; set; }//暂时不需要此字段 public List NextFrameArray { get; set; } //private List _nextFrameArray { get; set; } //public List NextFrameArray //{ // get // { // if (_nextFrameArray != null) // { // return _nextFrameArray; // } // _nextFrameArray = (List)CefBrowserPool.GetFrame(BrowserWindow.Main).EvaluateScriptAsync($"getFrameArray({PreDistance},{NextDistance})").ConfigureAwait(false).GetAwaiter().GetResult().Result; // return _nextFrameArray; // } //} public string NickName { get; set; } public string WxHeadImg { get; set; } public bool IsSelf { get { return this.UserId == App.CurrentUser.Id; } } public GeographicPosition Point { get; set; } public double Bearing { get; set; } } public class ChartSymbol { private double _grade = 0; private double _nextGrade = 0; public string GradeSymbol { get { if (_grade > 0) { return "+"; } if (_grade < 0) { return "-"; } return ""; } } public string GradeDisplay { get { if (_grade < 0) { return (_grade * -1).ToString("0.#"); } if (_grade > 0) { return _grade.ToString("0.#"); } return "0"; } } public string NextGrade { get { if (_nextGrade > 0) { return "+" + _nextGrade.ToString("0.#"); } return _nextGrade.ToString("0.#"); } } /// /// 单位m /// public double Distance { get; set; } /// /// /// /// /// /// 单位m public ChartSymbol(double grade, double nextGrade, double distance) { this._grade = grade; this._nextGrade = nextGrade; this.Distance = Math.Round(distance, 1); } } public class NearRiderModel { public int Id { get; set; } public string Name { get; set; } public string Headimage { get; set; } public double Near { get; set; } public string KGWeight { get; set; } public double Speed { get; set; } public string CountryImg { get; set; } public string Country { get; set; } public bool IsSelf { get; set; } } public class MsgModel { public int RouteId { get; set; } public int MemberId { get; set; } public double[] Point { get; set; } //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 TotalTicks { get; set; } public bool IsCompleted { get; set; } /// /// 需要展示的属性 /// //public string Prop { get; set; } public double EndDistance { get; set; } ///// ///// 是否展示在线的人 ///// //public bool ShowVirtual { get; set; } /// /// 命令类型,0命令,1消息 /// public byte CommandType { get; set; } //public bool IsVirtual { get; set; } /// /// 功率体重比 /// public double WeightKg { get; set; } public double PreDistance { get; set; } public int Competitionid { get; set; } /// /// 客户端通过是否有用户保存了数据,来拉取相应的已经被保存的数据。(主要用在比赛) /// public bool Saved { get; set; } //public int V { get; set; } public int FrameRate { get; set; } } public class GzipMsgModel { public int CommandType { get; set; } public int V { get; set; } public string Encoding { get; set; } public string Client { get; set; } public int MemberId { get; set; } public int Competitionid { get; set; } public bool IsWatch { get; set; } } public class ReceiveMsgModel { public int RouteId { get; set; } public int MemberId { get; set; } public double[] Point { get; set; } //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; } /// /// 需要展示的属性 /// //public string Prop { get; set; } public double EndDistance { get; set; } /// /// 是否展示在线的人 /// //public bool ShowVirtual { get; set; } /// /// 命令类型,0命令,1消息 /// //public byte CommandType { get; set; } //public bool IsVirtual { get; set; } public double PreDistance { get; set; } /// /// 功率体重比 /// public double WeightKg { get; set; } public int Competitionid { get; set; } public bool Saved { get; set; } public string WatchIdList { get; set; } public int? FrameRate { get; set; } public static ReceiveMsgModel Parse(string str) { var list = str.Split(','); if (list.Length != 15) { return null; } try { return new ReceiveMsgModel { RouteId = Convert.ToInt32(list[0],CultureInfo.InvariantCulture), MemberId = Convert.ToInt32(list[1], CultureInfo.InvariantCulture), Point = new double[] { double.Parse(list[2].Split(':')[0], CultureInfo.InvariantCulture), double.Parse(list[2].Split(':')[1], CultureInfo.InvariantCulture) }, IsCompleted = ToBoolean(list[3]), //exit = ToBoolean(list[4]), Speed = Convert.ToDouble(list[4], CultureInfo.InvariantCulture), PreDistance = Convert.ToDouble(list[5], CultureInfo.InvariantCulture), 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]), 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), FrameRate = Convert.ToInt32(list[14], CultureInfo.InvariantCulture), }; } catch { return null; } } private static bool ToBoolean(string str) { return Convert.ToBoolean(int.Parse(str)); } } public class OnlineUser { /// /// 用户Id /// public int Id { get; set; } /// /// 在地图中的ID /// public string InMapId { get { //if (IsVirtual) //{ // return "Online-Virtual-" + this.Id; //} return "Online-" + this.Id; } } public bool IsVirtual { get; set; } /// /// 虚拟人物名称 /// public string Name { get; set; } public double Weight { get; set; } /// /// 头像地址 /// public string HeadImage { get; set; } /// /// 路线Id /// public int RouteId { get; set; } public string RouteName { get; set; } /// /// FTP /// public int FTP { get; set; } /// /// 点位 /// public double[] Point { get; set; } /// /// 需要展示的属性 /// //public List Show { get; set; } /// /// 需要隐藏的属性 /// public List Hide { get; set; } /// /// 是否骑行完毕 /// public bool IsCompleted { get; set; } public bool IsWatcher { get; set; } public List WatcherList { get; set; } public double PreDistance { get; set; } /// /// 最后距离 /// public double EndDistance { get; set; } ///// ///// 是否退出 ///// //public bool exit { get; set; } /// /// 速度(km/h) /// 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; } ///// ///// 圆形头像 ///// //public string CircHeadImg //{ // get; set; //} public bool IsSelf { get { return Id == App.CurrentUser.Id; } } public double WeightKg { get; set; } public int CompetitionId { get; set; } /// /// 已保存的 /// public bool Saved { get; set; } public DateTime LastActiveTime { get; set; } public bool IsLost { get { return (DateTime.Now - LastActiveTime).TotalSeconds > 3; } } public string Country { get; set; } public DateTime CreateTime { get; set; } public int? FrameRate { get; set; } } public class KeyPaire { public object Key { get; set; } public object Value { get; set; } public KeyPaire(object key, object value) { this.Key = key; this.Value = value; } } }