using Assets.Scripts.Apis.Models;
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 RoomModel
{
public int Id { get; set; }
public int UserId { get; set; }//房主
public int Status { get; set; }//房间状态 0 :准备状态 1:开始loading
public DateTime? StartTime { get; set; }//开始时间
public static RoomModel Parse(string msg)
{
var detail = new RoomModel();
try
{
var arr = msg.Split(',');
DateTime? startTime = null;
if(!string.IsNullOrEmpty(arr[3]))
startTime = Convert.ToDateTime(arr[3], CultureInfo.InvariantCulture);
detail.Id = Convert.ToInt32(arr[0], CultureInfo.InvariantCulture);
detail.UserId = Convert.ToInt32(arr[1], CultureInfo.InvariantCulture);
detail.Status = Convert.ToInt32(arr[2], CultureInfo.InvariantCulture);
detail.StartTime = startTime;
}
catch (Exception)
{
}
return detail;
}
}
public class ExtendInfo
{
public int TotalTicks { get; set; }
public int RoomId { get; set; }
public int FrameRate { get; set; }
public int UserId { get; set; }
public static ExtendInfo Parse(string s)
{
if (string.IsNullOrEmpty(s))
return null;
var info = s.Split(',');
var ex = new ExtendInfo()
{
UserId = Convert.ToInt32(info[0]),
RoomId = Convert.ToInt32(info[1]),
FrameRate = Convert.ToInt32(info[2]),
TotalTicks = Convert.ToInt32(info[3]),
};
return ex;
}
}
public class RoomDetailModel
{
public int RoomId { get; set; }
public int UserId { get; set; }
public DateTime JoinAt { get; set; }
public int Status { get; set; }
public double Process { get; set; }
public bool IsOwner { get; set; }
public static RoomDetailModel Parse(string msg)
{
var detail = new RoomDetailModel();
try
{
var arr = msg.Split(',');
detail.RoomId = Convert.ToInt32(arr[0], CultureInfo.InvariantCulture);
detail.UserId = Convert.ToInt32(arr[1], CultureInfo.InvariantCulture);
detail.JoinAt = Convert.ToDateTime(arr[2], CultureInfo.InvariantCulture);
detail.Status = Convert.ToInt32(arr[3], CultureInfo.InvariantCulture);
detail.Process = Convert.ToDouble(arr[4], CultureInfo.InvariantCulture);
detail.IsOwner = Convert.ToBoolean(arr[5], CultureInfo.InvariantCulture);
}
catch (Exception)
{
}
return detail;
}
}
public class QueryGameRoomListCommand
{
public byte CommandType { get; set; }
public byte SubType { get; set; }
public int V { get; set; }
public int UserId { get; set; }
public int PageIndex { get; set; }
public int PageSize { get; set; }
public string Name { get; set; }
}
public class QueryGameRoomDetailCommand
{
public byte CommandType { get; set; }
public byte SubType { get; set; }
public int V { get; set; }
public int RoomId { get; set; }
}
public class CreateGameRoomCommand
{
public byte CommandType { get; set; }
public byte SubType { get; set; }
public int V { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public int RouteId { get; set; }
public int UserId { get; set; }
public int CloseTime { get; set; }
public int MaxMembers { get; set; }
public string Password { get; set; }
public DateTime CreateTime { get; set; }
public string MapRouteName { get; set; }
public double Distance { get; set; }
public double TotalClimb { get; set; }
public double AverageGrade { get; set; }
public bool Enable3D { get; set; }
public bool EnableAR { get; set; }
public bool IsLock { get; set; }
public string FileName { get; set; }
public string FileUrl { get; set; }
public string AltitudeGraph { get; set; }
}
public class JoinGameRoomCommand
{
public byte CommandType { get; set; }
public byte SubType { get; set; }
public int V { get; set; }
public int RoomId { get; set; }
public int UserId { get; set; }
public DateTime JoinAt { 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