using Assets.Scenes.Ride.Scripts.Model.RiderModels; using Assets.Scripts; using Assets.Scripts.Apis.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels { public class ReviewModel : BaseCycling { public List rankings; public ReviewModel(Route route1, RouteResultParam param) : base(route1, CyclingModel.Review) { //rankings = service.GetMapRecordRankingsFromServe(param.RankingsId); riders = new List(); //riders.Add(new OnlineRiderModel() //{ // NickName = App.CurrentUser.Nickname, // UserId = App.CurrentUser.Id, // WxHeadImg = App.CurrentUser.WxHeadImg, // Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1]) //}); //foreach (var item in rankings) //{ // riders.Add(new ReviewRiderModel() // { // NickName = item.NickName, // UserId = item.UserId, // WxHeadImg = item.WxHeadImg, // record = item.record, // Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1]) // }); //} recorderData = new RecorderDataModel() { CurrentUser = App.CurrentUser, //BelongUserId = PubCommData.CurrentUser.Id, Competitionid = 0, ContinueIndex = 0, ContinueMark = Guid.NewGuid().ToString(), EndDistance = 0, PreDistance = 0, IsCompleted = false, IsNeedRanking = true, CyclingState = CyclingStateEnum.Prepare, //ManufacturerId = ManufacturerId, CurrentRoute = route, CurrentRouteStartDistance = 0, //DeviceNumber = DeviceNumber, //AntModelId = antModelId }; if (param != null) { recorderData.ContinueIndex = param.ContinueIndex??0; if (!string.IsNullOrEmpty(param.ContinueMark)) { recorderData.ContinueMark = param.ContinueMark; } recorderData.EndDistance = param.EndDistance; recorderData.PreDistance = param.EndDistance; recorderData.CurrentRouteStartDistance = param.EndDistance; } //recorderData = recorderData1; this.IsRecord = true; //riders = riders1; } public override void Run(TargetData targetData) { #region 获取当前路线在线用户 riders.RemoveAll(r => r.IsSelf == false); var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false) .ToList(); foreach (var item in onlineUsers) { riders.Add(new OnlineRiderModel() { NickName = item.Name, UserId = item.Id, WxHeadImg = item.HeadImage, Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]), EndDistance = item.EndDistance, PreDistance = item.PreDistance, WeightKg = item.WeightKg, }); } #endregion base.Run(targetData); } } }