显示当前路线在线的人
This commit is contained in:
parent
6645310601
commit
8ca32cd1ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -89,3 +89,4 @@ Assets/Resources/Sound.meta
|
|||||||
Assets/MapWorkoutRecords
|
Assets/MapWorkoutRecords
|
||||||
Assets/Mapbox/User
|
Assets/Mapbox/User
|
||||||
Assets/Mapbox/User.meta
|
Assets/Mapbox/User.meta
|
||||||
|
Packages/packages-lock.json
|
||||||
|
|||||||
120
Assets/Resources/UI/Prefab/Ride/OnlinePlayer.prefab
Normal file
120
Assets/Resources/UI/Prefab/Ride/OnlinePlayer.prefab
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1056360222971152080
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1056360222971152087}
|
||||||
|
- component: {fileID: 1056360222971152091}
|
||||||
|
- component: {fileID: 1056360222971152084}
|
||||||
|
- component: {fileID: 1056360222971152085}
|
||||||
|
- component: {fileID: 3346376099031073908}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: OnlinePlayer
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1056360222971152087
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1056360222971152080}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &1056360222971152091
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1056360222971152080}
|
||||||
|
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &1056360222971152084
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1056360222971152080}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!135 &1056360222971152085
|
||||||
|
SphereCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1056360222971152080}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.5
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &3346376099031073908
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1056360222971152080}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 281c3f68a13a427499876dec554c3223, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
character: {fileID: 1056360222971152080}
|
||||||
|
characterAnimator: {fileID: 0}
|
||||||
|
nextPos: {x: 0, y: 0, z: 0}
|
||||||
|
stopRecord: 0
|
||||||
|
CurrentIndex: 0
|
||||||
|
CurrentDistance: 0
|
||||||
|
NextSlopeTotalDistance: 0
|
||||||
|
PreElevation: 0
|
||||||
|
PreSlope: 0
|
||||||
|
currentRotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
currentPos: {x: 0, y: 0, z: 0}
|
||||||
|
_playerController: {fileID: 0}
|
||||||
7
Assets/Resources/UI/Prefab/Ride/OnlinePlayer.prefab.meta
Normal file
7
Assets/Resources/UI/Prefab/Ride/OnlinePlayer.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 202ff57cf0315554eb1aceaa59f6ef54
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -38,7 +38,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
//public bool isQuit;//true 中途退出 或者到达终点
|
//public bool isQuit;//true 中途退出 或者到达终点
|
||||||
protected bool isMajor;//是否是主人公
|
protected bool isMajor;//是否是主人公
|
||||||
protected MapDataModel mapData;
|
protected MapDataModel mapData;
|
||||||
protected int userId;
|
//protected int userId;
|
||||||
protected DateTime startTime;//开始骑行时间
|
protected DateTime startTime;//开始骑行时间
|
||||||
protected DateTime endTime;//结束骑行时间
|
protected DateTime endTime;//结束骑行时间
|
||||||
protected double weight;//体重
|
protected double weight;//体重
|
||||||
@ -59,7 +59,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
protected double totalClimb;
|
protected double totalClimb;
|
||||||
|
|
||||||
public double TotalClimb { get => totalClimb; }
|
public double TotalClimb { get => totalClimb; }
|
||||||
public int UserId { get => userId; }
|
public int UserId { set; get; }//{ get => userId; }
|
||||||
public double Speed { get => speed; }
|
public double Speed { get => speed; }
|
||||||
public double Power { get => power; }
|
public double Power { get => power; }
|
||||||
public double Cadance { get => cadance; }
|
public double Cadance { get => cadance; }
|
||||||
|
|||||||
@ -323,7 +323,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
if (!isPause || DateTime.MinValue == startTime)
|
if (!isPause || DateTime.MinValue == startTime)
|
||||||
{
|
{
|
||||||
isStart = true;
|
isStart = true;
|
||||||
startTime = DateTime.Now;
|
startTime = UIManager.Now.GetDateTime();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,13 +18,13 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
{
|
{
|
||||||
//rankings = service.GetMapRecordRankingsFromServe(param.RankingsId);
|
//rankings = service.GetMapRecordRankingsFromServe(param.RankingsId);
|
||||||
riders = new List<BaseRider>();
|
riders = new List<BaseRider>();
|
||||||
riders.Add(new OnlineRiderModel()
|
//riders.Add(new OnlineRiderModel()
|
||||||
{
|
//{
|
||||||
NickName = App.CurrentUser.Nickname,
|
// NickName = App.CurrentUser.Nickname,
|
||||||
UserId = App.CurrentUser.Id,
|
// UserId = App.CurrentUser.Id,
|
||||||
WxHeadImg = App.CurrentUser.WxHeadImg,
|
// WxHeadImg = App.CurrentUser.WxHeadImg,
|
||||||
Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1])
|
// Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1])
|
||||||
});
|
//});
|
||||||
//foreach (var item in rankings)
|
//foreach (var item in rankings)
|
||||||
//{
|
//{
|
||||||
// riders.Add(new ReviewRiderModel()
|
// riders.Add(new ReviewRiderModel()
|
||||||
@ -64,21 +64,21 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
public override void Run(TargetData targetData)
|
public override void Run(TargetData targetData)
|
||||||
{
|
{
|
||||||
|
|
||||||
riders.RemoveAll(r => r.IsSelf == false);
|
//riders.RemoveAll(r => r.IsSelf == false);
|
||||||
var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false)
|
//var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false)
|
||||||
.ToList();
|
// .ToList();
|
||||||
foreach (var item in onlineUsers)
|
//foreach (var item in onlineUsers)
|
||||||
{
|
//{
|
||||||
riders.Add(new OnlineRiderModel()
|
// riders.Add(new OnlineRiderModel()
|
||||||
{
|
// {
|
||||||
NickName = item.Name,
|
// NickName = item.Name,
|
||||||
UserId = item.Id,
|
// UserId = item.Id,
|
||||||
WxHeadImg = item.HeadImage,
|
// WxHeadImg = item.HeadImage,
|
||||||
Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]),
|
// Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]),
|
||||||
EndDistance = item.EndDistance,
|
// EndDistance = item.EndDistance,
|
||||||
PreDistance = item.PreDistance,
|
// PreDistance = item.PreDistance,
|
||||||
});
|
// });
|
||||||
}
|
//}
|
||||||
|
|
||||||
base.Run(targetData);
|
base.Run(targetData);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,23 +48,23 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
recorderData.PreDistance = recorderData.EndDistance;
|
recorderData.PreDistance = recorderData.EndDistance;
|
||||||
|
|
||||||
riders = new List<BaseRider>();
|
riders = new List<BaseRider>();
|
||||||
var rider = new OnlineRiderModel()
|
//var rider = new OnlineRiderModel()
|
||||||
{
|
//{
|
||||||
NickName = App.CurrentUser.Nickname,
|
// NickName = App.CurrentUser.Nickname,
|
||||||
UserId = App.CurrentUser.Id,
|
// UserId = App.CurrentUser.Id,
|
||||||
WxHeadImg = App.CurrentUser.WxHeadImg + "?t=1",
|
// WxHeadImg = App.CurrentUser.WxHeadImg + "?t=1",
|
||||||
//Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1]),
|
// //Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1]),
|
||||||
EndDistance = recorderData.EndDistance
|
// EndDistance = recorderData.EndDistance
|
||||||
};
|
//};
|
||||||
rider.Point = _turfHelper.Along(rider.EndDistance);
|
//rider.Point = _turfHelper.Along(rider.EndDistance);
|
||||||
|
|
||||||
riders.Add(rider);
|
//riders.Add(rider);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Run(TargetData targetData)
|
public override void Run(TargetData targetData)
|
||||||
{
|
{
|
||||||
#region 获取在线用户
|
#region 获取当前路线在线用户
|
||||||
riders.RemoveAll(r => r.IsSelf == false);
|
riders.RemoveAll(r => r.IsSelf == false);
|
||||||
var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false)
|
var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -80,6 +80,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
PreDistance = item.PreDistance,
|
PreDistance = item.PreDistance,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
base.Run(targetData);
|
base.Run(targetData);
|
||||||
}
|
}
|
||||||
|
|||||||
60
Assets/Scenes/Ride/Scripts/OnlinePlayerController.cs
Normal file
60
Assets/Scenes/Ride/Scripts/OnlinePlayerController.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
using Assets.Scenes.Ride.Scripts.Model;
|
||||||
|
using Assets.Scripts;
|
||||||
|
using DG.Tweening;
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
|
{
|
||||||
|
public class OnlinePlayerController : AbstractPlayer
|
||||||
|
{
|
||||||
|
public PlayerController _playerController;
|
||||||
|
RawImage head;
|
||||||
|
GameObject headPanel;
|
||||||
|
|
||||||
|
protected override void Init()
|
||||||
|
{
|
||||||
|
base.Init();
|
||||||
|
_playerController = FindObjectOfType<PlayerController>();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Compute()
|
||||||
|
{
|
||||||
|
currentlatlong = mainController.Along(totalDistance);//下一个坐标
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDistance(double _distance)
|
||||||
|
{
|
||||||
|
distance = _distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTotalDistance(double _totalDistance)
|
||||||
|
{
|
||||||
|
totalDistance = _totalDistance;
|
||||||
|
}
|
||||||
|
private string headUrl;
|
||||||
|
public void SetHead(string url )
|
||||||
|
{
|
||||||
|
headUrl = url;
|
||||||
|
}
|
||||||
|
public void MoveHead(Transform parent,Vector3 nextPosition)
|
||||||
|
{
|
||||||
|
if (headPanel == null)
|
||||||
|
{
|
||||||
|
headPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Ride/HeadPanel"));
|
||||||
|
headPanel.transform.parent = parent;
|
||||||
|
headPanel.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
||||||
|
}
|
||||||
|
if (head == null)
|
||||||
|
{
|
||||||
|
head = headPanel.GetComponentInChildren<RawImage>();
|
||||||
|
if (!string.IsNullOrEmpty(headUrl))
|
||||||
|
{
|
||||||
|
Utils.DisplayImage(head, headUrl, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headPanel.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scenes/Ride/Scripts/OnlinePlayerController.cs.meta
Normal file
11
Assets/Scenes/Ride/Scripts/OnlinePlayerController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 281c3f68a13a427499876dec554c3223
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,6 +1,9 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Assets.Scenes.Ride.Scripts.Model;
|
using Assets.Scenes.Ride.Scripts.Model;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
@ -8,10 +11,15 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
#region 骑行逻辑
|
#region 骑行逻辑
|
||||||
TrailRenderer trail;
|
TrailRenderer trail;
|
||||||
|
GameObject onlineUserPrefab;
|
||||||
|
GameObject miniMapPlayerPrefab;
|
||||||
|
|
||||||
protected override void Init()
|
protected override void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
base.Init();
|
||||||
|
onlineUserPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/OnlinePlayer");
|
||||||
|
miniMapPlayerPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/MiniMapPlayer");
|
||||||
|
|
||||||
totalDistance = mainController.selectParamModel.EndDistance;
|
totalDistance = mainController.selectParamModel.EndDistance;
|
||||||
currentlatlong = mainController.GetCenterCoordinate();
|
currentlatlong = mainController.GetCenterCoordinate();
|
||||||
trail = FindObjectOfType<TrailRenderer>();
|
trail = FindObjectOfType<TrailRenderer>();
|
||||||
@ -28,18 +36,18 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
/// 计算数据,父类会在此方法后处理动画
|
/// 计算数据,父类会在此方法后处理动画
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void Compute()
|
protected override void Compute()
|
||||||
{
|
{
|
||||||
//计算数据
|
//计算数据
|
||||||
//speed = mainController.UpDateSpeed();
|
//speed = mainController.UpDateSpeed();
|
||||||
heartRate = mainController.UpDateHeart()??0;
|
heartRate = mainController.UpDateHeart() ?? 0;
|
||||||
power = mainController.UpdatePower();
|
power = mainController.UpdatePower();
|
||||||
cadance = mainController.UpdateCadence();
|
cadance = mainController.UpdateCadence();
|
||||||
weight = App.CurrentUser.Weight;
|
weight = App.CurrentUser.Weight;
|
||||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
power = 2000;//测试功率
|
power = 2380;//测试功率
|
||||||
#endif
|
#endif
|
||||||
mainController.TrackResistance(currentSlope * App.rideSetting.sensitivity/100);
|
mainController.TrackResistance(currentSlope * App.rideSetting.sensitivity / 100);
|
||||||
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
||||||
distance = mainController.UpdateDistance(speed);
|
distance = mainController.UpdateDistance(speed);
|
||||||
totalDistance += distance;
|
totalDistance += distance;
|
||||||
@ -61,17 +69,58 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
_Lon = currentlatlong.y,
|
_Lon = currentlatlong.y,
|
||||||
_TotalClimb = totalClimb,
|
_TotalClimb = totalClimb,
|
||||||
};
|
};
|
||||||
recorderData.PreDistance = TotalDistance-Distance;
|
recorderData.PreDistance = TotalDistance - Distance;
|
||||||
recorderData.EndDistance = TotalDistance;
|
recorderData.EndDistance = TotalDistance;
|
||||||
recorderData.RiderDatas.Add(targetData);
|
recorderData.RiderDatas.Add(targetData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
protected override void SendTcp()
|
protected override void SendTcp()
|
||||||
{
|
{
|
||||||
if (mainController.cyclingController != null)
|
if (mainController.cyclingController != null)
|
||||||
{
|
{
|
||||||
mainController.cyclingController.Run(null);
|
mainController.cyclingController.Run(null);
|
||||||
|
ShowOnlineUsers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<OnlinePlayerController> otherList = new List<OnlinePlayerController>();
|
||||||
|
|
||||||
|
|
||||||
|
private void ShowOnlineUsers()
|
||||||
|
{
|
||||||
|
var onlineRiders = mainController.cyclingController.riders;
|
||||||
|
List<OnlinePlayerController> currentOnlineUserList = new List<OnlinePlayerController>();
|
||||||
|
currentOnlineUserList.AddRange(FindObjectsOfType<OnlinePlayerController>());
|
||||||
|
|
||||||
|
if (onlineRiders.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in onlineRiders)
|
||||||
|
{
|
||||||
|
var onlineRider = item as OnlineRiderModel;
|
||||||
|
var currentUser = currentOnlineUserList.Where(c => c.UserId == item.UserId).FirstOrDefault();
|
||||||
|
var onlineDistance = onlineRider.EndDistance - onlineRider.PreDistance;
|
||||||
|
var onlineTotalDistance = onlineRider.EndDistance;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
//大地图人物
|
||||||
|
GameObject otherPlayerObj = (GameObject)Instantiate(onlineUserPrefab, transform.parent);
|
||||||
|
var onlinePlayerController = otherPlayerObj.GetComponent<OnlinePlayerController>();
|
||||||
|
otherList.Add(onlinePlayerController);
|
||||||
|
onlinePlayerController.UserId = onlineRider.UserId;
|
||||||
|
onlinePlayerController.SetDistance(onlineDistance);
|
||||||
|
onlinePlayerController.SetTotalDistance(onlineTotalDistance);
|
||||||
|
onlinePlayerController.SetHead(onlineRider.WxHeadImg);
|
||||||
|
//小地图人物
|
||||||
|
GameObject miniPlayer = (GameObject)Instantiate(miniMapPlayerPrefab, transform.parent);
|
||||||
|
var miniController = miniPlayer.GetComponent<MiniMapPlayerController>();
|
||||||
|
miniController.SetController(onlinePlayerController);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentUser.SetDistance(onlineDistance);
|
||||||
|
currentUser.SetTotalDistance(onlineTotalDistance);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -650,6 +650,21 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
itemPosition.y += 5f;
|
itemPosition.y += 5f;
|
||||||
item.MoveHead(graph.transform, itemPosition);
|
item.MoveHead(graph.transform, itemPosition);
|
||||||
}
|
}
|
||||||
|
//移动在线的人
|
||||||
|
var onlineUsers = FindObjectsOfType<OnlinePlayerController>();
|
||||||
|
foreach (var item in onlineUsers)
|
||||||
|
{
|
||||||
|
var itemIndex = chartDataSourceScript.GetViewIndex(item.CurrentIndex) + 1;
|
||||||
|
if (!mainController.isStart && !mainController.isPause && !mainController.isQuit || (mainController.isStart && item.TotalDistance == 0))//未开始未暂停未结束
|
||||||
|
{
|
||||||
|
itemIndex = 0;
|
||||||
|
}
|
||||||
|
var m = graph.DataSource.GetPoint("Player 2", itemIndex);
|
||||||
|
graph.PointToWorldSpace(out Vector3 itemPosition, m.x, m.y, "Player 2");
|
||||||
|
itemPosition.x -= 12f;
|
||||||
|
itemPosition.y += 5f;
|
||||||
|
item.MoveHead(graph.transform, itemPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//移动总海拔图范围
|
//移动总海拔图范围
|
||||||
private void MoveElevationImage()
|
private void MoveElevationImage()
|
||||||
|
|||||||
@ -228,7 +228,7 @@ namespace Assets.Scripts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIManager.Instance.StartCoroutine(DownloadImage(img, url,(texture)=> {
|
UIManager.Instance.StartCoroutine(DownloadImage(img, url,(texture)=> {
|
||||||
if (cache)
|
if (cache && !propTextureCache.ContainsKey(url))
|
||||||
{
|
{
|
||||||
propTextureCache.Add(url, texture);
|
propTextureCache.Add(url, texture);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,328 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"com.coffee.softmask-for-ugui": {
|
|
||||||
"version": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "git",
|
|
||||||
"dependencies": {},
|
|
||||||
"hash": "f59d147fe04be6a84b3cd7eb93bce149410911be"
|
|
||||||
},
|
|
||||||
"com.unity.2d.sprite": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.cinemachine": {
|
|
||||||
"version": "2.6.3",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.collab-proxy": {
|
|
||||||
"version": "1.2.16",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.ext.nunit": {
|
|
||||||
"version": "1.0.6",
|
|
||||||
"depth": 1,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.ide.rider": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.test-framework": "1.1.1"
|
|
||||||
},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.ide.vscode": {
|
|
||||||
"version": "1.2.3",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.test-framework": {
|
|
||||||
"version": "1.1.22",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.ext.nunit": "1.0.6",
|
|
||||||
"com.unity.modules.imgui": "1.0.0",
|
|
||||||
"com.unity.modules.jsonserialize": "1.0.0"
|
|
||||||
},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.timeline": {
|
|
||||||
"version": "1.2.18",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.director": "1.0.0",
|
|
||||||
"com.unity.modules.animation": "1.0.0",
|
|
||||||
"com.unity.modules.audio": "1.0.0",
|
|
||||||
"com.unity.modules.particlesystem": "1.0.0"
|
|
||||||
},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.ugui": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.ui": "1.0.0",
|
|
||||||
"com.unity.modules.imgui": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.ai": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.androidjni": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.animation": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.assetbundle": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.audio": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.cloth": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.physics": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.director": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.audio": "1.0.0",
|
|
||||||
"com.unity.modules.animation": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.imageconversion": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.imgui": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.jsonserialize": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.particlesystem": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.physics": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.physics2d": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.screencapture": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.imageconversion": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.subsystems": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 1,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.jsonserialize": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.terrain": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.terrainphysics": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.physics": "1.0.0",
|
|
||||||
"com.unity.modules.terrain": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.tilemap": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.physics2d": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.ui": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.uielements": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.imgui": "1.0.0",
|
|
||||||
"com.unity.modules.jsonserialize": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.umbra": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.unityanalytics": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
|
||||||
"com.unity.modules.jsonserialize": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.unitywebrequest": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.unitywebrequestassetbundle": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.assetbundle": "1.0.0",
|
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.unitywebrequestaudio": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
|
||||||
"com.unity.modules.audio": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.unitywebrequesttexture": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
|
||||||
"com.unity.modules.imageconversion": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.unitywebrequestwww": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
|
||||||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
|
|
||||||
"com.unity.modules.unitywebrequestaudio": "1.0.0",
|
|
||||||
"com.unity.modules.audio": "1.0.0",
|
|
||||||
"com.unity.modules.assetbundle": "1.0.0",
|
|
||||||
"com.unity.modules.imageconversion": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.vehicles": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.physics": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.video": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.audio": "1.0.0",
|
|
||||||
"com.unity.modules.ui": "1.0.0",
|
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.vr": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.jsonserialize": "1.0.0",
|
|
||||||
"com.unity.modules.physics": "1.0.0",
|
|
||||||
"com.unity.modules.xr": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"com.unity.modules.wind": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {}
|
|
||||||
},
|
|
||||||
"com.unity.modules.xr": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "builtin",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.modules.physics": "1.0.0",
|
|
||||||
"com.unity.modules.jsonserialize": "1.0.0",
|
|
||||||
"com.unity.modules.subsystems": "1.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user