ar观察者模式
This commit is contained in:
parent
df936c4e04
commit
7822584cdd
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public class ARObject : MonoBehaviour
|
public class ARGameObject : MonoBehaviour
|
||||||
{
|
{
|
||||||
public string Hash;
|
public string Hash;
|
||||||
public const int Layer = 1;
|
public const int Layer = 1;
|
||||||
@ -23,12 +23,14 @@ namespace Assets.AR
|
|||||||
|
|
||||||
private float FrameRate = 29.97f;
|
private float FrameRate = 29.97f;
|
||||||
|
|
||||||
public ARObjectTimeTransform[] TimeTransforms { get; set; }
|
public ARVideoTransform[] TimeTransforms { get; set; }
|
||||||
|
|
||||||
public string CustomUrl { get; set; }
|
public string CustomUrl { get; set; }
|
||||||
|
|
||||||
public string ArName { get; set; }
|
public string ArName { get; set; }
|
||||||
|
|
||||||
|
public int UserId { get; set; }
|
||||||
|
|
||||||
public Vector3 CameraPositionOffset { get; set; }
|
public Vector3 CameraPositionOffset { get; set; }
|
||||||
|
|
||||||
public float Frame => !this.useMultilapTransform ? this.frame : this.frame + this.videoSync.LastVideoFrame;
|
public float Frame => !this.useMultilapTransform ? this.frame : this.frame + this.videoSync.LastVideoFrame;
|
||||||
@ -3,7 +3,7 @@ using UnityEngine.Rendering;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public static class ARMeshFactory
|
public static class ARGameObjectFactory
|
||||||
{
|
{
|
||||||
private static bool IsValidVertex(Vector3 v) => !float.IsNaN(v.x) && !float.IsInfinity(v.x) && !float.IsNaN(v.y) && !float.IsInfinity(v.y) && !float.IsNaN(v.z) && !float.IsInfinity(v.z);
|
private static bool IsValidVertex(Vector3 v) => !float.IsNaN(v.x) && !float.IsInfinity(v.x) && !float.IsNaN(v.y) && !float.IsInfinity(v.y) && !float.IsNaN(v.z) && !float.IsInfinity(v.z);
|
||||||
//创建轨迹
|
//创建轨迹
|
||||||
@ -22,15 +22,15 @@ namespace Assets.AR
|
|||||||
Vector3[] vector3Array1 = new Vector3[num1 * 2];
|
Vector3[] vector3Array1 = new Vector3[num1 * 2];
|
||||||
Vector3 left;
|
Vector3 left;
|
||||||
Vector3 right;
|
Vector3 right;
|
||||||
ARMeshFactory.CreateVertices(start, route, lOffset, rOffset, out left, out right, margin);
|
ARGameObjectFactory.CreateVertices(start, route, lOffset, rOffset, out left, out right, margin);
|
||||||
vector3Array1[0] = left;
|
vector3Array1[0] = left;
|
||||||
vector3Array1[1] = right;
|
vector3Array1[1] = right;
|
||||||
int num2 = 2;
|
int num2 = 2;
|
||||||
int num3 = 0;
|
int num3 = 0;
|
||||||
for (int frame = start + 1; frame <= end; ++frame)
|
for (int frame = start + 1; frame <= end; ++frame)
|
||||||
{
|
{
|
||||||
ARMeshFactory.CreateVertices(frame, route, lOffset, rOffset, out left, out right, margin);
|
ARGameObjectFactory.CreateVertices(frame, route, lOffset, rOffset, out left, out right, margin);
|
||||||
if (ARMeshFactory.IsValidVertex(left) && ARMeshFactory.IsValidVertex(right))
|
if (ARGameObjectFactory.IsValidVertex(left) && ARGameObjectFactory.IsValidVertex(right))
|
||||||
{
|
{
|
||||||
Vector3[] vector3Array2 = vector3Array1;
|
Vector3[] vector3Array2 = vector3Array1;
|
||||||
int index1 = num2;
|
int index1 = num2;
|
||||||
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public enum ARObjectType
|
public enum ARGameObjectType
|
||||||
{
|
{
|
||||||
Sign,
|
Sign,
|
||||||
Box,
|
Box,
|
||||||
@ -17,7 +17,7 @@ namespace Assets.AR
|
|||||||
Custom,
|
Custom,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RiderCameraDistance
|
public enum CameraDistance
|
||||||
{
|
{
|
||||||
FirstPerson,
|
FirstPerson,
|
||||||
Near,
|
Near,
|
||||||
@ -25,7 +25,7 @@ namespace Assets.AR
|
|||||||
Far,
|
Far,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum VideoControlMode
|
public enum VideoPlayMode
|
||||||
{
|
{
|
||||||
Front,
|
Front,
|
||||||
AutoPanorama,
|
AutoPanorama,
|
||||||
@ -4,12 +4,12 @@ using UnityEngine.Rendering;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public abstract class ARObjectsController : MonoBehaviour
|
public abstract class ARGameObjectsController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public float MaximumVisibilityDistance = 200f;
|
public float MaximumVisibilityDistance = 200f;
|
||||||
private readonly Vector3 CameraOriginOffset = Vector3.up * -100f;
|
private readonly Vector3 CameraOriginOffset = Vector3.up * -100f;
|
||||||
protected static readonly Vector3 DefaultObjectPosition = new Vector3(0.0f, 1000f, 0.0f);
|
protected static readonly Vector3 DefaultObjectPosition = new Vector3(0.0f, 1000f, 0.0f);
|
||||||
protected List<ARObject> arObjects = new List<ARObject>();
|
protected List<ARGameObject> arObjects = new List<ARGameObject>();
|
||||||
protected Material matShadow { get; set; }
|
protected Material matShadow { get; set; }
|
||||||
protected Material matModelMask;
|
protected Material matModelMask;
|
||||||
protected AVProVideoPlayer videoPlayer { get; set; }
|
protected AVProVideoPlayer videoPlayer { get; set; }
|
||||||
@ -21,7 +21,7 @@ namespace Assets.AR
|
|||||||
protected GameObject trajectoryObject;
|
protected GameObject trajectoryObject;
|
||||||
private float ambientIntensity;
|
private float ambientIntensity;
|
||||||
private GameObject camGo;
|
private GameObject camGo;
|
||||||
protected Dictionary<int, ARObjectsController.Segment> trajectorySegments = new Dictionary<int, ARObjectsController.Segment>();
|
protected Dictionary<int, ARGameObjectsController.Segment> trajectorySegments = new Dictionary<int, ARGameObjectsController.Segment>();
|
||||||
protected int lapCount = 1;
|
protected int lapCount = 1;
|
||||||
protected double lapLength;
|
protected double lapLength;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ namespace Assets.AR
|
|||||||
this.matShadow = Resources.Load<Material>("UI/Material/TransparentPlane");
|
this.matShadow = Resources.Load<Material>("UI/Material/TransparentPlane");
|
||||||
//this.matModelMask = Resources.Load<Material>("Materials/ModelDepth");
|
//this.matModelMask = Resources.Load<Material>("Materials/ModelDepth");
|
||||||
this.arObjects.Clear();
|
this.arObjects.Clear();
|
||||||
this.arObjects.AddRange(FindObjectsOfType<ARObject>());
|
this.arObjects.AddRange(FindObjectsOfType<ARGameObject>());
|
||||||
SetupCamera();
|
SetupCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,18 +66,18 @@ namespace Assets.AR
|
|||||||
if (this.Route.CameraRotationsRear != null && this.Route.CameraRotationsRear.Length == this.Route.CameraRotations.Length)
|
if (this.Route.CameraRotationsRear != null && this.Route.CameraRotationsRear.Length == this.Route.CameraRotations.Length)
|
||||||
{
|
{
|
||||||
this.AR360Version = true;
|
this.AR360Version = true;
|
||||||
ARObject.MaxDistanceVisibilityModels = 200f;
|
ARGameObject.MaxDistanceVisibilityModels = 200f;
|
||||||
this.MaximumVisibilityDistance = 500f;
|
this.MaximumVisibilityDistance = 500f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.AR360Version = false;
|
this.AR360Version = false;
|
||||||
ARObject.MaxDistanceVisibilityModels = 80f;
|
ARGameObject.MaxDistanceVisibilityModels = 80f;
|
||||||
this.MaximumVisibilityDistance = 200f;
|
this.MaximumVisibilityDistance = 200f;
|
||||||
}
|
}
|
||||||
if (route == null)
|
if (route == null)
|
||||||
return;
|
return;
|
||||||
foreach (ARObject arObject in this.arObjects)
|
foreach (ARGameObject arObject in this.arObjects)
|
||||||
{
|
{
|
||||||
arObject.VideoSync = videoSync;
|
arObject.VideoSync = videoSync;
|
||||||
arObject.Route = route;
|
arObject.Route = route;
|
||||||
@ -92,10 +92,10 @@ namespace Assets.AR
|
|||||||
float visibilityRear,
|
float visibilityRear,
|
||||||
float visibilityFront)
|
float visibilityFront)
|
||||||
{
|
{
|
||||||
foreach (ARObject arObject in this.arObjects)
|
foreach (ARGameObject arObject in this.arObjects)
|
||||||
{
|
{
|
||||||
arObject.CameraPositionOffset = this.cameraPositionOffset;
|
arObject.CameraPositionOffset = this.cameraPositionOffset;
|
||||||
if (arObject is ARLaneObject arLaneObject)
|
if (arObject is ARLaneGameObject arLaneObject)
|
||||||
arLaneObject.FrameIndexDistanceCorrection = this.FrameIndexDistanceCorrection;
|
arLaneObject.FrameIndexDistanceCorrection = this.FrameIndexDistanceCorrection;
|
||||||
//if (this.SelectedPanorama != null && (arObject.ObjectType == ARObjectType.Box || arObject.ObjectType == ARObjectType.Sphere))
|
//if (this.SelectedPanorama != null && (arObject.ObjectType == ARObjectType.Box || arObject.ObjectType == ARObjectType.Sphere))
|
||||||
//{
|
//{
|
||||||
@ -112,7 +112,7 @@ namespace Assets.AR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool IsArObjectActive(ARObject arObject) => (double)arObject.VisibilityLevel > 0.0 ;
|
protected virtual bool IsArObjectActive(ARGameObject arObject) => (double)arObject.VisibilityLevel > 0.0 ;
|
||||||
|
|
||||||
|
|
||||||
protected virtual Material GetTrajectoryMaterial() => this.matShadow;
|
protected virtual Material GetTrajectoryMaterial() => this.matShadow;
|
||||||
@ -165,13 +165,13 @@ namespace Assets.AR
|
|||||||
if (!this.trajectorySegments.ContainsKey(index))
|
if (!this.trajectorySegments.ContainsKey(index))
|
||||||
{
|
{
|
||||||
GameObject trajectory = this.CreateTrajectory(index, 0.0f, 0.0f);
|
GameObject trajectory = this.CreateTrajectory(index, 0.0f, 0.0f);
|
||||||
ARObjectsController.Segment segment = new ARObjectsController.Segment(trajectory, trajectory.transform.position);
|
ARGameObjectsController.Segment segment = new ARGameObjectsController.Segment(trajectory, trajectory.transform.position);
|
||||||
this.trajectorySegments.Add(index, segment);
|
this.trajectorySegments.Add(index, segment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (int key in this.trajectorySegments.Keys)
|
foreach (int key in this.trajectorySegments.Keys)
|
||||||
{
|
{
|
||||||
ARObjectsController.Segment trajectorySegment = this.trajectorySegments[key];
|
ARGameObjectsController.Segment trajectorySegment = this.trajectorySegments[key];
|
||||||
trajectorySegment.GameObject.transform.position = trajectorySegment.Position - this.cameraPositionOffset;
|
trajectorySegment.GameObject.transform.position = trajectorySegment.Position - this.cameraPositionOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ namespace Assets.AR
|
|||||||
float rOffset,
|
float rOffset,
|
||||||
float margin = float.NaN)
|
float margin = float.NaN)
|
||||||
{
|
{
|
||||||
GameObject trajectory = ARMeshFactory.CreateTrajectory(this.Route, segment, lOffset, rOffset, margin);
|
GameObject trajectory = ARGameObjectFactory.CreateTrajectory(this.Route, segment, lOffset, rOffset, margin);
|
||||||
trajectory.transform.parent = this.trajectoryObject.transform;
|
trajectory.transform.parent = this.trajectoryObject.transform;
|
||||||
//trajectory.layer = 9;
|
//trajectory.layer = 9;
|
||||||
trajectory.GetComponent<MeshRenderer>().shadowCastingMode = ShadowCastingMode.Off;
|
trajectory.GetComponent<MeshRenderer>().shadowCastingMode = ShadowCastingMode.Off;
|
||||||
@ -3,7 +3,7 @@ using DG.Tweening;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public class ARLaneObject : ARObject
|
public class ARLaneGameObject : ARGameObject
|
||||||
{
|
{
|
||||||
public Vector3 Lean { get; set; }//偏移量
|
public Vector3 Lean { get; set; }//偏移量
|
||||||
|
|
||||||
@ -4,7 +4,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public abstract class ARLaneObjectsController : ARObjectsController
|
public abstract class ARLaneGameObjectsController : ARGameObjectsController
|
||||||
{
|
{
|
||||||
protected const float LaneWidth = 0.7f;
|
protected const float LaneWidth = 0.7f;
|
||||||
protected const float StartRegionDistance = 200f;
|
protected const float StartRegionDistance = 200f;
|
||||||
@ -12,9 +12,9 @@ namespace Assets.AR
|
|||||||
private const float StartRowsRandomDistance = 0.4f;
|
private const float StartRowsRandomDistance = 0.4f;
|
||||||
private const float StartRowsRandomWidth = 0.15f;
|
private const float StartRowsRandomWidth = 0.15f;
|
||||||
private const float MinCollisionDistance = 1.33f;
|
private const float MinCollisionDistance = 1.33f;
|
||||||
protected readonly Dictionary<int, ARLaneObject> riderObjects = new Dictionary<int, ARLaneObject>();
|
protected readonly Dictionary<int, ARLaneGameObject> riderObjects = new Dictionary<int, ARLaneGameObject>();
|
||||||
private readonly Dictionary<int, Vector2> randomizedStartOffsets = new Dictionary<int, Vector2>();
|
private readonly Dictionary<int, Vector2> randomizedStartOffsets = new Dictionary<int, Vector2>();
|
||||||
private readonly List<ARLaneObject> collisionList = new List<ARLaneObject>();
|
private readonly List<ARLaneGameObject> collisionList = new List<ARLaneGameObject>();
|
||||||
|
|
||||||
public bool AllowStartOrder { get; set; } = true;
|
public bool AllowStartOrder { get; set; } = true;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace Assets.AR
|
|||||||
|
|
||||||
public int FollowedRiderId { get; set; }
|
public int FollowedRiderId { get; set; }
|
||||||
|
|
||||||
public IReadOnlyDictionary<int, ARLaneObject> ArRiders => (IReadOnlyDictionary<int, ARLaneObject>)this.riderObjects;
|
public IReadOnlyDictionary<int, ARLaneGameObject> ArRiders => (IReadOnlyDictionary<int, ARLaneGameObject>)this.riderObjects;
|
||||||
|
|
||||||
protected virtual void Start()
|
protected virtual void Start()
|
||||||
{
|
{
|
||||||
@ -50,10 +50,10 @@ namespace Assets.AR
|
|||||||
//检测碰撞
|
//检测碰撞
|
||||||
private void DetectRidersCollisions(float cameraDistance)
|
private void DetectRidersCollisions(float cameraDistance)
|
||||||
{
|
{
|
||||||
float num1 = cameraDistance - ARObject.MaxDistanceVisibilityModels;
|
float num1 = cameraDistance - ARGameObject.MaxDistanceVisibilityModels;
|
||||||
float num2 = cameraDistance + ARObject.MaxDistanceVisibilityModels;
|
float num2 = cameraDistance + ARGameObject.MaxDistanceVisibilityModels;
|
||||||
this.collisionList.Clear();
|
this.collisionList.Clear();
|
||||||
foreach (ARLaneObject arLaneObject in this.riderObjects.Values)
|
foreach (ARLaneGameObject arLaneObject in this.riderObjects.Values)
|
||||||
{
|
{
|
||||||
if (arLaneObject.gameObject.activeSelf && !arLaneObject.IsAtFinish)
|
if (arLaneObject.gameObject.activeSelf && !arLaneObject.IsAtFinish)
|
||||||
{
|
{
|
||||||
@ -64,7 +64,7 @@ namespace Assets.AR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (ARLaneObject collision in this.collisionList)
|
foreach (ARLaneGameObject collision in this.collisionList)
|
||||||
{
|
{
|
||||||
if ((double)collision.RouteDistance < 200.0)
|
if ((double)collision.RouteDistance < 200.0)
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ namespace Assets.AR
|
|||||||
collision.DistanceSort = collision.Distance;
|
collision.DistanceSort = collision.Distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.collisionList.Sort((Comparison<ARLaneObject>)((r1, r2) =>
|
this.collisionList.Sort((Comparison<ARLaneGameObject>)((r1, r2) =>
|
||||||
{
|
{
|
||||||
int num3 = r1.Lane.CompareTo(r2.Lane);
|
int num3 = r1.Lane.CompareTo(r2.Lane);
|
||||||
if (num3 == 0)
|
if (num3 == 0)
|
||||||
@ -82,7 +82,7 @@ namespace Assets.AR
|
|||||||
float deltaTime = Time.deltaTime;
|
float deltaTime = Time.deltaTime;
|
||||||
for (int index = 0; index < this.collisionList.Count; ++index)
|
for (int index = 0; index < this.collisionList.Count; ++index)
|
||||||
{
|
{
|
||||||
ARLaneObject collision = this.collisionList[index];
|
ARLaneGameObject collision = this.collisionList[index];
|
||||||
float lane = collision.Lane;
|
float lane = collision.Lane;
|
||||||
float num4 = this.GetLane(collision.RouteDistance, collision.DistanceSort, index);
|
float num4 = this.GetLane(collision.RouteDistance, collision.DistanceSort, index);
|
||||||
if ((double)collision.LaneWidth != 0.0)
|
if ((double)collision.LaneWidth != 0.0)
|
||||||
@ -94,7 +94,7 @@ namespace Assets.AR
|
|||||||
collision.Lane = num4;
|
collision.Lane = num4;
|
||||||
}
|
}
|
||||||
this.CalculateOvertakingParameters();
|
this.CalculateOvertakingParameters();
|
||||||
foreach (ARLaneObject collision in this.collisionList)
|
foreach (ARLaneGameObject collision in this.collisionList)
|
||||||
{
|
{
|
||||||
collision.LaneWidth = 0.7f;
|
collision.LaneWidth = 0.7f;
|
||||||
float num6 = this.Route.LeftHanded ? this.GetRouteLeftOffset(collision.Frame) : this.GetRouteRightOffset(collision.Frame);
|
float num6 = this.Route.LeftHanded ? this.GetRouteLeftOffset(collision.Frame) : this.GetRouteRightOffset(collision.Frame);
|
||||||
@ -109,7 +109,7 @@ namespace Assets.AR
|
|||||||
float deltaTime = Time.deltaTime;
|
float deltaTime = Time.deltaTime;
|
||||||
for (int index = 0; index < this.collisionList.Count; ++index)
|
for (int index = 0; index < this.collisionList.Count; ++index)
|
||||||
{
|
{
|
||||||
ARLaneObject collision = this.collisionList[index];
|
ARLaneGameObject collision = this.collisionList[index];
|
||||||
bool flag1 = collision.StartPosition == this.FollowedRiderId;
|
bool flag1 = collision.StartPosition == this.FollowedRiderId;
|
||||||
float x = Math.Abs(collision.Distance - cameraDistance);
|
float x = Math.Abs(collision.Distance - cameraDistance);
|
||||||
float x2 = 4f;
|
float x2 = 4f;
|
||||||
@ -124,7 +124,7 @@ namespace Assets.AR
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float num1 = VTMath.Lerp(0.0f, 1f, x2, 0.0f, x);
|
float num1 = PFMath.Lerp(0.0f, 1f, x2, 0.0f, x);
|
||||||
float num2 = collision.Lane * collision.LaneWidth - collision.BaseOffset;
|
float num2 = collision.Lane * collision.LaneWidth - collision.BaseOffset;
|
||||||
float num3 = 0.75f;
|
float num3 = 0.75f;
|
||||||
if (this.NearViewMode && !flag1)
|
if (this.NearViewMode && !flag1)
|
||||||
@ -149,7 +149,7 @@ namespace Assets.AR
|
|||||||
private void CalculateOvertakingParameters()
|
private void CalculateOvertakingParameters()
|
||||||
{
|
{
|
||||||
float deltaTime = Time.deltaTime;
|
float deltaTime = Time.deltaTime;
|
||||||
foreach (ARLaneObject laneObject in this.riderObjects.Values)
|
foreach (ARLaneGameObject laneObject in this.riderObjects.Values)
|
||||||
{
|
{
|
||||||
float num1 = laneObject.Speed * deltaTime;
|
float num1 = laneObject.Speed * deltaTime;
|
||||||
if ((double)num1 == 0.0)
|
if ((double)num1 == 0.0)
|
||||||
@ -166,7 +166,7 @@ namespace Assets.AR
|
|||||||
if ((double)num1 > 0.0)
|
if ((double)num1 > 0.0)
|
||||||
{
|
{
|
||||||
float num3 = Mathf.Atan(num2 / num1);
|
float num3 = Mathf.Atan(num2 / num1);
|
||||||
curvature = (float)(0.039999999105930328 * (double)VTMath.Lerp(0.0f, 3f, 20f, 1f, laneObject.Speed)) * num3;
|
curvature = (float)(0.039999999105930328 * (double)PFMath.Lerp(0.0f, 3f, 20f, 1f, laneObject.Speed)) * num3;
|
||||||
}
|
}
|
||||||
this.UpdateRiderCurvature(laneObject, curvature, deltaTime);
|
this.UpdateRiderCurvature(laneObject, curvature, deltaTime);
|
||||||
float angle = -57.29578f * Mathf.Atan(num2 / num1);
|
float angle = -57.29578f * Mathf.Atan(num2 / num1);
|
||||||
@ -175,14 +175,14 @@ namespace Assets.AR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateRiderCurvature(ARLaneObject laneObject, float curvature, float deltaTime)
|
protected void UpdateRiderCurvature(ARLaneGameObject laneObject, float curvature, float deltaTime)
|
||||||
{
|
{
|
||||||
float num = 6f;
|
float num = 6f;
|
||||||
laneObject.Curvature = Mathf.Lerp(laneObject.Curvature, curvature, num * deltaTime);
|
laneObject.Curvature = Mathf.Lerp(laneObject.Curvature, curvature, num * deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateLaneChangingDirection(
|
protected void UpdateLaneChangingDirection(
|
||||||
ARLaneObject laneObject,
|
ARLaneGameObject laneObject,
|
||||||
float angle,
|
float angle,
|
||||||
float deltaTime)
|
float deltaTime)
|
||||||
{
|
{
|
||||||
@ -198,10 +198,10 @@ namespace Assets.AR
|
|||||||
float b = 0.0f;
|
float b = 0.0f;
|
||||||
for (int index = count - 1; index >= 0; --index)
|
for (int index = count - 1; index >= 0; --index)
|
||||||
{
|
{
|
||||||
ARLaneObject collision = this.collisionList[index];
|
ARLaneGameObject collision = this.collisionList[index];
|
||||||
if ((double)collision.Lane + 1.0 >= (double)b)
|
if ((double)collision.Lane + 1.0 >= (double)b)
|
||||||
{
|
{
|
||||||
float collisionParameter = ARLaneObjectsController.GetCollisionParameter(modelDistance, collision.DistanceSort, overtakingThreshold);
|
float collisionParameter = ARLaneGameObjectsController.GetCollisionParameter(modelDistance, collision.DistanceSort, overtakingThreshold);
|
||||||
if ((double)collisionParameter > 0.0)
|
if ((double)collisionParameter > 0.0)
|
||||||
b = Mathf.Max(collision.Lane + collisionParameter, b);
|
b = Mathf.Max(collision.Lane + collisionParameter, b);
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ namespace Assets.AR
|
|||||||
x = -x;
|
x = -x;
|
||||||
if ((double)x < 1.0)
|
if ((double)x < 1.0)
|
||||||
return 1f;
|
return 1f;
|
||||||
return (double)x > (double)maxDistance ? 0.0f : VTMath.SmoothStep(1f, 1f, maxDistance, 0.0f, x);
|
return (double)x > (double)maxDistance ? 0.0f : PFMath.SmoothStep(1f, 1f, maxDistance, 0.0f, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetRouteLeftOffset(float frame) => this.Route == null ? 0.0f : this.Route.GetLeftSideOffset(frame);
|
private float GetRouteLeftOffset(float frame) => this.Route == null ? 0.0f : this.Route.GetLeftSideOffset(frame);
|
||||||
@ -205,7 +205,7 @@ namespace Assets.AR
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
if (index == frameDistances.Length)
|
if (index == frameDistances.Length)
|
||||||
return (double)(frameDistances.Length - 1);
|
return (double)(frameDistances.Length - 1);
|
||||||
double num = VTMath.InverseLerp(frameDistances[index - 1], frameDistances[index], distance);
|
double num = PFMath.InverseLerp(frameDistances[index - 1], frameDistances[index], distance);
|
||||||
return (double)index + num - 1.0;
|
return (double)index + num - 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ namespace Assets.AR
|
|||||||
if (index >= this.FrameCount)
|
if (index >= this.FrameCount)
|
||||||
return this.FrameDistances[this.FrameDistances.Length - 1];
|
return this.FrameDistances[this.FrameDistances.Length - 1];
|
||||||
double t = frame - (double)(index - 1);
|
double t = frame - (double)(index - 1);
|
||||||
return VTMath.Lerp(this.FrameDistances[index - 1], this.FrameDistances[index], t);
|
return PFMath.Lerp(this.FrameDistances[index - 1], this.FrameDistances[index], t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CameraProjectionParameters GetCameraProjectionParameters(
|
public CameraProjectionParameters GetCameraProjectionParameters(
|
||||||
@ -558,7 +558,7 @@ namespace Assets.AR
|
|||||||
Vector3 filteredCameraPosition1 = this.GetFilteredCameraPosition((float)this.GetFrameAtDistance(num - 10.0));
|
Vector3 filteredCameraPosition1 = this.GetFilteredCameraPosition((float)this.GetFrameAtDistance(num - 10.0));
|
||||||
Vector3 filteredCameraPosition2 = this.GetFilteredCameraPosition((float)this.GetFrameAtDistance(num + 10.0));
|
Vector3 filteredCameraPosition2 = this.GetFilteredCameraPosition((float)this.GetFrameAtDistance(num + 10.0));
|
||||||
Vector3 center;
|
Vector3 center;
|
||||||
if (!Geometry.CircleCenter(filteredCameraPosition1, aP1, filteredCameraPosition2, out center))
|
if (!GeometryUtil.CircleCenter(filteredCameraPosition1, aP1, filteredCameraPosition2, out center))
|
||||||
{
|
{
|
||||||
numArray[index] = 0.0f;
|
numArray[index] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,20 +8,20 @@ using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public class ARTrainingController : ARLaneObjectsController
|
public class ARTrainingController : ARLaneGameObjectsController
|
||||||
{
|
{
|
||||||
public MediaPlayer mediaPlayer;
|
public MediaPlayer mediaPlayer;
|
||||||
private ARData aRData;
|
private ARData aRData;
|
||||||
private RouteDetailData detail;
|
private RouteDetailData detail;
|
||||||
private VideoPointsSync videoPointsSync;
|
private VideoPointsSync videoPointsSync;
|
||||||
private readonly List<ARLaneObject> collisionList = new List<ARLaneObject>();
|
private readonly List<ARLaneGameObject> collisionList = new List<ARLaneGameObject>();
|
||||||
VideoPlayerControl VideoPlayerControl;
|
ARVideoPlayerControl VideoPlayerControl;
|
||||||
ARLaneObject[] rides { get; set; }
|
ARLaneGameObject[] rides { get; set; }
|
||||||
public ARLaneObject mainRiderObject { get; set; }
|
public ARLaneGameObject mainRiderObject { get; set; }
|
||||||
private Light arLight;
|
private Light arLight;
|
||||||
private Light arBackLight;
|
private Light arBackLight;
|
||||||
public RiderCameraDistance RiderCameraDistance { get; set; }
|
public CameraDistance RiderCameraDistance { get; set; }
|
||||||
public VideoControlMode VideoControlMode { get; private set; }
|
public VideoPlayMode VideoControlMode { get; private set; }
|
||||||
private float autoCameraSwitchTimeCounter = 80f;
|
private float autoCameraSwitchTimeCounter = 80f;
|
||||||
float timers = 0f;
|
float timers = 0f;
|
||||||
private VideoGameManager manager;
|
private VideoGameManager manager;
|
||||||
@ -55,14 +55,14 @@ namespace Assets.AR
|
|||||||
//ar数据加载本地,本地没有就下载
|
//ar数据加载本地,本地没有就下载
|
||||||
this.aRData = arData;
|
this.aRData = arData;
|
||||||
this.detail = routeDetailData;
|
this.detail = routeDetailData;
|
||||||
|
this.RiderCameraDistance = AR.CameraDistance.Middle;
|
||||||
videoPointsSync = new VideoPointsSync(detail.VideoPoints.Select(c => new VideoPoint()
|
videoPointsSync = new VideoPointsSync(detail.VideoPoints.Select(c => new VideoPoint()
|
||||||
{
|
{
|
||||||
Distance = (float)c.Distance,
|
Distance = (float)c.Distance,
|
||||||
Time = (float)c.VideoTime
|
Time = (float)c.VideoTime
|
||||||
}));
|
}));
|
||||||
videoSync = videoPointsSync;
|
videoSync = videoPointsSync;
|
||||||
this.VideoPlayerControl = new VideoPlayerControl();
|
this.VideoPlayerControl = new ARVideoPlayerControl();
|
||||||
this.VideoPlayerControl.VideoSyncSource = videoSync;
|
this.VideoPlayerControl.VideoSyncSource = videoSync;
|
||||||
this.videoPlayer = new AVProVideoPlayer();
|
this.videoPlayer = new AVProVideoPlayer();
|
||||||
this.videoPlayer.videoPlayer = mediaPlayer;
|
this.videoPlayer.videoPlayer = mediaPlayer;
|
||||||
@ -70,7 +70,7 @@ namespace Assets.AR
|
|||||||
this.VideoPlayerControl.VideoFrameOffset = this.Route.VideoFrameOffset;
|
this.VideoPlayerControl.VideoFrameOffset = this.Route.VideoFrameOffset;
|
||||||
this.VideoPlayerControl.Route = Route;
|
this.VideoPlayerControl.Route = Route;
|
||||||
this.VideoPlayerControl.SetVideoPlayer(videoPlayer);
|
this.VideoPlayerControl.SetVideoPlayer(videoPlayer);
|
||||||
rides = FindObjectsOfType<ARLaneObject>();
|
rides = FindObjectsOfType<ARLaneGameObject>();
|
||||||
SetUpLight();
|
SetUpLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ namespace Assets.AR
|
|||||||
{
|
{
|
||||||
|
|
||||||
var item = dic.Value;
|
var item = dic.Value;
|
||||||
if (dic.Key.UserId == App.CurrentUser.Id)
|
if (dic.Key.UserId == manager.CurrentPlayer.userId)
|
||||||
{
|
{
|
||||||
mainRiderObject = item;
|
mainRiderObject = item;
|
||||||
}
|
}
|
||||||
@ -109,14 +109,28 @@ namespace Assets.AR
|
|||||||
item.IsAtFinish = dic.Key.EndDistance >= manager.GetMapRoute().Distance*1000f;
|
item.IsAtFinish = dic.Key.EndDistance >= manager.GetMapRoute().Distance*1000f;
|
||||||
if (!this.arObjects.Contains(item))
|
if (!this.arObjects.Contains(item))
|
||||||
this.arObjects.Add(item);
|
this.arObjects.Add(item);
|
||||||
if (!this.riderObjects.ContainsKey(item.GetInstanceID()))
|
if (!this.riderObjects.ContainsKey(item.UserId))
|
||||||
this.riderObjects.Add(item.GetInstanceID(), item);
|
this.riderObjects.Add(item.UserId, item);
|
||||||
}
|
}
|
||||||
|
this.arObjects.RemoveAll(c => !manager.rideObjs.Select(m => m.Key.UserId.ToString()).Contains(c.UserId.ToString()));
|
||||||
|
|
||||||
|
var keys = riderObjects.Keys.ToList();
|
||||||
|
foreach (var item in keys)
|
||||||
|
{
|
||||||
|
if (!manager.rideObjs.Keys.Where(c => c.UserId == item).Any())
|
||||||
|
{
|
||||||
|
riderObjects.Remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
timers += 1f;
|
timers += 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainRiderObject == null || Route == null)
|
if (mainRiderObject == null || Route == null)
|
||||||
|
{
|
||||||
|
videoPlayer?.Pause();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
var delta = Time.deltaTime;
|
var delta = Time.deltaTime;
|
||||||
foreach (var obj in this.riderObjects.Values)
|
foreach (var obj in this.riderObjects.Values)
|
||||||
{
|
{
|
||||||
@ -135,12 +149,12 @@ namespace Assets.AR
|
|||||||
this.UpdateRidersLean();
|
this.UpdateRidersLean();
|
||||||
this.UpdateBackLight();
|
this.UpdateBackLight();
|
||||||
if (Input.GetKeyDown(KeyCode.F))
|
if (Input.GetKeyDown(KeyCode.F))
|
||||||
this.SetVideoControlMode(VideoControlMode.Front);
|
this.SetVideoControlMode(VideoPlayMode.Front);
|
||||||
if (Input.GetKeyDown(KeyCode.P))
|
if (Input.GetKeyDown(KeyCode.P))
|
||||||
this.SetVideoControlMode(VideoControlMode.AutoPanorama);
|
this.SetVideoControlMode(VideoPlayMode.AutoPanorama);
|
||||||
if (!Input.GetKeyDown(KeyCode.B))
|
if (!Input.GetKeyDown(KeyCode.B))
|
||||||
return;
|
return;
|
||||||
this.SetVideoControlMode(VideoControlMode.Rear);
|
this.SetVideoControlMode(VideoPlayMode.Rear);
|
||||||
}
|
}
|
||||||
//创建
|
//创建
|
||||||
private void SetUpLight()
|
private void SetUpLight()
|
||||||
@ -173,28 +187,27 @@ namespace Assets.AR
|
|||||||
this.arBackLight.cullingMask = 512;
|
this.arBackLight.cullingMask = 512;
|
||||||
}
|
}
|
||||||
//设置video显示模式
|
//设置video显示模式
|
||||||
public void SetVideoControlMode(VideoControlMode mode)
|
public void SetVideoControlMode(VideoPlayMode mode)
|
||||||
{
|
{
|
||||||
if (mode == this.VideoControlMode)
|
if (mode == this.VideoControlMode)
|
||||||
return;
|
return;
|
||||||
if (!this.AR360Version)
|
if (!this.AR360Version)
|
||||||
mode = VideoControlMode.Front;
|
mode = VideoPlayMode.Front;
|
||||||
this.VideoControlMode = mode;
|
this.VideoControlMode = mode;
|
||||||
this.autoCameraSwitchTimeCounter = 80f;
|
this.autoCameraSwitchTimeCounter = 80f;
|
||||||
if (mode == VideoControlMode.AutoPanorama)
|
if (mode == VideoPlayMode.AutoPanorama)
|
||||||
return;
|
return;
|
||||||
this.videoPlayer.IntendedRear = mode == VideoControlMode.Rear;
|
this.videoPlayer.IntendedRear = mode == VideoPlayMode.Rear;
|
||||||
}
|
}
|
||||||
//更新摄像机的位置
|
//更新摄像机的位置
|
||||||
private void UpdateCameraFollowDistance()
|
private void UpdateCameraFollowDistance()
|
||||||
{
|
{
|
||||||
this.RiderCameraDistance = RiderCameraDistance.Middle;
|
this.NearViewMode = this.RiderCameraDistance == AR.CameraDistance.Near;
|
||||||
this.NearViewMode = this.RiderCameraDistance == RiderCameraDistance.Near;
|
|
||||||
float cameraFollowDistance = GetCameraFollowDistance(this.RiderCameraDistance);
|
float cameraFollowDistance = GetCameraFollowDistance(this.RiderCameraDistance);
|
||||||
this.VideoPlayerControl.CameraFollowDistance = cameraFollowDistance;
|
this.VideoPlayerControl.CameraFollowDistance = cameraFollowDistance;
|
||||||
}
|
}
|
||||||
//人物是否显示
|
//人物是否显示
|
||||||
protected override bool IsArObjectActive(ARObject arObject)
|
protected override bool IsArObjectActive(ARGameObject arObject)
|
||||||
{
|
{
|
||||||
bool flag = base.IsArObjectActive(arObject);
|
bool flag = base.IsArObjectActive(arObject);
|
||||||
if ((UnityEngine.Object)arObject != (UnityEngine.Object)this.mainRiderObject)
|
if ((UnityEngine.Object)arObject != (UnityEngine.Object)this.mainRiderObject)
|
||||||
@ -204,17 +217,17 @@ namespace Assets.AR
|
|||||||
return flag && (double)this.VideoPlayerControl.CameraDistanceError > 5.0;
|
return flag && (double)this.VideoPlayerControl.CameraDistanceError > 5.0;
|
||||||
}
|
}
|
||||||
//获取摄像机的位置
|
//获取摄像机的位置
|
||||||
public static float GetCameraFollowDistance(RiderCameraDistance distance)
|
public static float GetCameraFollowDistance(CameraDistance distance)
|
||||||
{
|
{
|
||||||
switch (distance)
|
switch (distance)
|
||||||
{
|
{
|
||||||
case RiderCameraDistance.FirstPerson:
|
case AR.CameraDistance.FirstPerson:
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
case RiderCameraDistance.Near:
|
case AR.CameraDistance.Near:
|
||||||
return 1.5f;
|
return 1.5f;
|
||||||
case RiderCameraDistance.Middle:
|
case AR.CameraDistance.Middle:
|
||||||
return 5f;
|
return 5f;
|
||||||
case RiderCameraDistance.Far:
|
case AR.CameraDistance.Far:
|
||||||
return 10f;
|
return 10f;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Unknown rider's camera distance.");
|
throw new ArgumentException("Unknown rider's camera distance.");
|
||||||
@ -237,26 +250,26 @@ namespace Assets.AR
|
|||||||
this.DestroyRiderTitle(riderId);
|
this.DestroyRiderTitle(riderId);
|
||||||
}
|
}
|
||||||
//创建人物
|
//创建人物
|
||||||
private BaseRenderer CreateRiderModel(OnlineRiderModel rider, float lane)
|
private AbstractRenderer CreateRiderModel(OnlineRiderModel rider, float lane)
|
||||||
{
|
{
|
||||||
GameObject gameObject;
|
GameObject gameObject;
|
||||||
RiderRenderer riderModel;
|
PlayerRenderer riderModel;
|
||||||
if (rider.Sex == 1)
|
if (rider.Sex == 1)
|
||||||
{
|
{
|
||||||
gameObject = UnityEngine.Object.Instantiate<GameObject>(this.BikerMalePrefab);
|
gameObject = UnityEngine.Object.Instantiate<GameObject>(this.BikerMalePrefab);
|
||||||
gameObject.name = "RiderMale " + rider.UserId.ToString();
|
gameObject.name = "RiderMale " + rider.UserId.ToString();
|
||||||
riderModel = gameObject.AddComponent<RiderRenderer>();
|
riderModel = gameObject.AddComponent<PlayerRenderer>();
|
||||||
riderModel.Initialize(true, false);
|
riderModel.Initialize(true, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gameObject = UnityEngine.Object.Instantiate<GameObject>(this.BikerFemalePrefab);
|
gameObject = UnityEngine.Object.Instantiate<GameObject>(this.BikerFemalePrefab);
|
||||||
gameObject.name = "RiderFemale " + rider.UserId.ToString();
|
gameObject.name = "RiderFemale " + rider.UserId.ToString();
|
||||||
riderModel = gameObject.AddComponent<RiderRenderer>();
|
riderModel = gameObject.AddComponent<PlayerRenderer>();
|
||||||
riderModel.Initialize(false, false);
|
riderModel.Initialize(false, false);
|
||||||
}
|
}
|
||||||
gameObject.transform.parent = this.transform;
|
gameObject.transform.parent = this.transform;
|
||||||
gameObject.transform.position = ARObjectsController.DefaultObjectPosition;
|
gameObject.transform.position = ARGameObjectsController.DefaultObjectPosition;
|
||||||
gameObject.layer = 9;
|
gameObject.layer = 9;
|
||||||
riderModel.Route = this.Route;
|
riderModel.Route = this.Route;
|
||||||
riderModel.VideoSync = this.videoSync;
|
riderModel.VideoSync = this.videoSync;
|
||||||
@ -269,30 +282,30 @@ namespace Assets.AR
|
|||||||
//riderModel.BikeTexture = modelTextures.BikeTexture;
|
//riderModel.BikeTexture = modelTextures.BikeTexture;
|
||||||
if ((double)lane != -1.0)
|
if ((double)lane != -1.0)
|
||||||
riderModel.Lane = lane;
|
riderModel.Lane = lane;
|
||||||
this.riderObjects.Add(rider.UserId, (ARLaneObject)riderModel);
|
this.riderObjects.Add(rider.UserId, (ARLaneGameObject)riderModel);
|
||||||
this.arObjects.Add((ARObject)riderModel);
|
this.arObjects.Add((ARGameObject)riderModel);
|
||||||
//是否
|
//是否
|
||||||
if (this.IsMainRider(rider))
|
if (this.IsMainRider(rider))
|
||||||
this.mainRiderObject = (ARLaneObject)riderModel;
|
this.mainRiderObject = (ARLaneGameObject)riderModel;
|
||||||
return (BaseRenderer)riderModel;
|
return (AbstractRenderer)riderModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ARLaneObject CreateRiderObject(OnlineRiderModel rider, float lane)
|
private ARLaneGameObject CreateRiderObject(OnlineRiderModel rider, float lane)
|
||||||
{
|
{
|
||||||
ARLaneObject riderObject = new GameObject("RiderObject " + rider.UserId.ToString())
|
ARLaneGameObject riderObject = new GameObject("RiderObject " + rider.UserId.ToString())
|
||||||
{
|
{
|
||||||
transform = {
|
transform = {
|
||||||
parent = this.transform
|
parent = this.transform
|
||||||
},
|
},
|
||||||
layer = 9
|
layer = 9
|
||||||
}.AddComponent<ARLaneObject>();
|
}.AddComponent<ARLaneGameObject>();
|
||||||
riderObject.Route = this.Route;
|
riderObject.Route = this.Route;
|
||||||
riderObject.VideoSync = this.videoSync;
|
riderObject.VideoSync = this.videoSync;
|
||||||
//riderObject.VideoPlayer = this.videoPlayer;
|
//riderObject.VideoPlayer = this.videoPlayer;
|
||||||
if ((double)lane != -1.0)
|
if ((double)lane != -1.0)
|
||||||
riderObject.Lane = lane;
|
riderObject.Lane = lane;
|
||||||
this.riderObjects.Add(rider.UserId, riderObject);
|
this.riderObjects.Add(rider.UserId, riderObject);
|
||||||
this.arObjects.Add((ARObject)riderObject);
|
this.arObjects.Add((ARGameObject)riderObject);
|
||||||
if (this.IsMainRider(rider))
|
if (this.IsMainRider(rider))
|
||||||
this.mainRiderObject = riderObject;
|
this.mainRiderObject = riderObject;
|
||||||
return riderObject;
|
return riderObject;
|
||||||
@ -300,13 +313,13 @@ namespace Assets.AR
|
|||||||
//销毁骑手
|
//销毁骑手
|
||||||
private void DestroyRider(int riderId)
|
private void DestroyRider(int riderId)
|
||||||
{
|
{
|
||||||
ARLaneObject arLaneObject;
|
ARLaneGameObject arLaneObject;
|
||||||
if (!this.riderObjects.TryGetValue(riderId, out arLaneObject))
|
if (!this.riderObjects.TryGetValue(riderId, out arLaneObject))
|
||||||
return;
|
return;
|
||||||
this.arObjects.Remove((ARObject)arLaneObject);
|
this.arObjects.Remove((ARGameObject)arLaneObject);
|
||||||
this.riderObjects.Remove(riderId);
|
this.riderObjects.Remove(riderId);
|
||||||
if ((UnityEngine.Object)arLaneObject == (UnityEngine.Object)this.mainRiderObject)
|
if ((UnityEngine.Object)arLaneObject == (UnityEngine.Object)this.mainRiderObject)
|
||||||
this.mainRiderObject = (ARLaneObject)null;
|
this.mainRiderObject = (ARLaneGameObject)null;
|
||||||
UnityEngine.Object.Destroy((UnityEngine.Object)arLaneObject.gameObject);
|
UnityEngine.Object.Destroy((UnityEngine.Object)arLaneObject.gameObject);
|
||||||
}
|
}
|
||||||
//创建骑行人员头顶的名字
|
//创建骑行人员头顶的名字
|
||||||
@ -392,7 +405,7 @@ namespace Assets.AR
|
|||||||
{
|
{
|
||||||
if (!this.visibleRiders.ContainsKey(num))
|
if (!this.visibleRiders.ContainsKey(num))
|
||||||
{
|
{
|
||||||
ARLaneObject riderObject = this.riderObjects[num];
|
ARLaneGameObject riderObject = this.riderObjects[num];
|
||||||
if (!riderObject.IsAtFinish || (double)riderObject.VisibilityLevel <= 0.0)
|
if (!riderObject.IsAtFinish || (double)riderObject.VisibilityLevel <= 0.0)
|
||||||
{
|
{
|
||||||
this.DestroyRider(num);
|
this.DestroyRider(num);
|
||||||
@ -405,11 +418,11 @@ namespace Assets.AR
|
|||||||
{
|
{
|
||||||
var rider = visibleRiderItem.Rider;
|
var rider = visibleRiderItem.Rider;
|
||||||
bool showModel = visibleRiderItem.ShowModel;
|
bool showModel = visibleRiderItem.ShowModel;
|
||||||
ARLaneObject arLaneObject;
|
ARLaneGameObject arLaneObject;
|
||||||
//二次检查
|
//二次检查
|
||||||
if (this.riderObjects.TryGetValue(rider.UserId, out arLaneObject))
|
if (this.riderObjects.TryGetValue(rider.UserId, out arLaneObject))
|
||||||
{
|
{
|
||||||
if (arLaneObject is BaseRenderer)
|
if (arLaneObject is AbstractRenderer)
|
||||||
{
|
{
|
||||||
if (!showModel)
|
if (!showModel)
|
||||||
{
|
{
|
||||||
@ -438,7 +451,7 @@ namespace Assets.AR
|
|||||||
public int VisibleRiderTitlesLimit => this.VisibleModelsLimit + 10;
|
public int VisibleRiderTitlesLimit => this.VisibleModelsLimit + 10;
|
||||||
private void UpdateVisibleRiders()
|
private void UpdateVisibleRiders()
|
||||||
{
|
{
|
||||||
float visibilityModels = ARObject.MaxDistanceVisibilityModels;
|
float visibilityModels = ARGameObject.MaxDistanceVisibilityModels;
|
||||||
float visibilityDistance = this.MaximumVisibilityDistance;
|
float visibilityDistance = this.MaximumVisibilityDistance;
|
||||||
float routeDistance = this.CameraDistance;
|
float routeDistance = this.CameraDistance;
|
||||||
bool flag = this.AllowStartOrder && (double)routeDistance < 200.0;
|
bool flag = this.AllowStartOrder && (double)routeDistance < 200.0;
|
||||||
@ -500,7 +513,7 @@ namespace Assets.AR
|
|||||||
if ((double)num6 > -(double)num2 && (double)num6 < (double)num1)
|
if ((double)num6 > -(double)num2 && (double)num6 < (double)num1)
|
||||||
{
|
{
|
||||||
float num7 = -1f;
|
float num7 = -1f;
|
||||||
ARLaneObject laneObject;
|
ARLaneGameObject laneObject;
|
||||||
if (this.riderObjects.TryGetValue(rider.UserId, out laneObject))
|
if (this.riderObjects.TryGetValue(rider.UserId, out laneObject))
|
||||||
{
|
{
|
||||||
if ((double)laneObject.Lane > (double)num4)
|
if ((double)laneObject.Lane > (double)num4)
|
||||||
@ -630,7 +643,7 @@ namespace Assets.AR
|
|||||||
{
|
{
|
||||||
float routeDistance1 = (float)visibleRiderItem.Rider.RouteDistance;
|
float routeDistance1 = (float)visibleRiderItem.Rider.RouteDistance;
|
||||||
float routeDistance2 = (float)sorted.Rider.RouteDistance;
|
float routeDistance2 = (float)sorted.Rider.RouteDistance;
|
||||||
float collisionParameter = ARLaneObjectsController.GetCollisionParameter(routeDistance1, routeDistance2, this.GetOvertakingThreshold(routeDistance1));
|
float collisionParameter = ARLaneGameObjectsController.GetCollisionParameter(routeDistance1, routeDistance2, this.GetOvertakingThreshold(routeDistance1));
|
||||||
sorted.Lane += collisionParameter;
|
sorted.Lane += collisionParameter;
|
||||||
if ((double)sorted.Lane > (double)maxLane)
|
if ((double)sorted.Lane > (double)maxLane)
|
||||||
sorted.Lane = float.MaxValue;
|
sorted.Lane = float.MaxValue;
|
||||||
@ -647,7 +660,7 @@ namespace Assets.AR
|
|||||||
//更新骑手的偏移角度
|
//更新骑手的偏移角度
|
||||||
private void UpdateRidersLean()
|
private void UpdateRidersLean()
|
||||||
{
|
{
|
||||||
foreach (ARLaneObject riderObject in this.riderObjects.Values)
|
foreach (ARLaneGameObject riderObject in this.riderObjects.Values)
|
||||||
{
|
{
|
||||||
float num1 = this.Route.GetTrajectoryCurvature(riderObject.Frame) + riderObject.Curvature;
|
float num1 = this.Route.GetTrajectoryCurvature(riderObject.Frame) + riderObject.Curvature;
|
||||||
float z1;
|
float z1;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public class VideoPlayerControl
|
public class ARVideoPlayerControl
|
||||||
{
|
{
|
||||||
private const float MinVideoPlaybackSpeedChangeInterval = 0.2f;
|
private const float MinVideoPlaybackSpeedChangeInterval = 0.2f;
|
||||||
private const float MaxPlaybackSpeed = 1.5f;
|
private const float MaxPlaybackSpeed = 1.5f;
|
||||||
@ -123,7 +123,7 @@ namespace Assets.AR
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
f = frame - (this.VideoPlayer.CurrentFrame - (float)this.VideoFrameOffset);
|
f = frame - (this.VideoPlayer.CurrentFrame - (float)this.VideoFrameOffset);
|
||||||
float num1 = Mathf.Clamp01(VTMath.Lerp(0.0f, 1f, 100f, 0.0f, Mathf.Abs(f)));
|
float num1 = Mathf.Clamp01(PFMath.Lerp(0.0f, 1f, 100f, 0.0f, Mathf.Abs(f)));
|
||||||
this.FrameIndexDistanceCorrection = f * num1;
|
this.FrameIndexDistanceCorrection = f * num1;
|
||||||
this.CameraDistanceError = distance - distanceForVideoFrame;
|
this.CameraDistanceError = distance - distanceForVideoFrame;
|
||||||
if (this.IsMultilap)
|
if (this.IsMultilap)
|
||||||
@ -141,7 +141,7 @@ namespace Assets.AR
|
|||||||
double totalSeconds = DateTime.UtcNow.Subtract(this.lastPlaybackSpeedChange).TotalSeconds;
|
double totalSeconds = DateTime.UtcNow.Subtract(this.lastPlaybackSpeedChange).TotalSeconds;
|
||||||
if (totalSeconds >= 0.0 && totalSeconds < 0.20000000298023224)
|
if (totalSeconds >= 0.0 && totalSeconds < 0.20000000298023224)
|
||||||
return;
|
return;
|
||||||
float num3 = 1f;
|
float num3 = (float)totalSeconds;
|
||||||
float num4 = num3 * speed;
|
float num4 = num3 * speed;
|
||||||
var offset = this.VideoSyncSource.GetDistanceForVideoFrame((float)((double)this.VideoPlayer.CurrentFrame - (double)this.VideoFrameOffset + (double)num3 * (double)this.VideoPlayer.PlaybackSpeed * (double)this.VideoPlayer.FrameRate));
|
var offset = this.VideoSyncSource.GetDistanceForVideoFrame((float)((double)this.VideoPlayer.CurrentFrame - (double)this.VideoFrameOffset + (double)num3 * (double)this.VideoPlayer.PlaybackSpeed * (double)this.VideoPlayer.FrameRate));
|
||||||
var left = (double)Math.Abs(distance + num4 - offset);
|
var left = (double)Math.Abs(distance + num4 - offset);
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public class ARObjectTimeTransform
|
public class ARVideoTransform
|
||||||
{
|
{
|
||||||
public int Frame;
|
public int Frame;
|
||||||
public float Distance;
|
public float Distance;
|
||||||
@ -132,17 +132,17 @@ namespace Assets.AR
|
|||||||
this.videoPlayer.CloseMedia();
|
this.videoPlayer.CloseMedia();
|
||||||
this.ReleaseRenderTextures();
|
this.ReleaseRenderTextures();
|
||||||
}
|
}
|
||||||
|
private float pauseSpeed = 0.001f;
|
||||||
public bool SetPlaybackSpeed(float playbackSpeed)
|
public bool SetPlaybackSpeed(float playbackSpeed)
|
||||||
{
|
{
|
||||||
if (this.IsSeeking || this.IsPaused || DateTime.UtcNow.Subtract(this.lastPlaybackSpeedChange).TotalSeconds < 1.0)
|
if (this.IsSeeking || this.IsPaused || DateTime.UtcNow.Subtract(this.lastPlaybackSpeedChange).TotalSeconds < 1.0)
|
||||||
return false;
|
return false;
|
||||||
if ((double)playbackSpeed == 0.0 && !this.pausedByPlaybackSpeed)
|
if ((double)playbackSpeed <= pauseSpeed && !this.pausedByPlaybackSpeed)
|
||||||
{
|
{
|
||||||
this.pausedByPlaybackSpeed = true;
|
this.pausedByPlaybackSpeed = true;
|
||||||
this.videoPlayer.Pause();
|
this.videoPlayer.Pause();
|
||||||
}
|
}
|
||||||
else if ((double)playbackSpeed > 0.0 && this.pausedByPlaybackSpeed)
|
else if ((double)playbackSpeed > pauseSpeed && this.pausedByPlaybackSpeed)
|
||||||
{
|
{
|
||||||
this.pausedByPlaybackSpeed = false;
|
this.pausedByPlaybackSpeed = false;
|
||||||
if (!this.pausedByTrainingPause)
|
if (!this.pausedByTrainingPause)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public abstract class BaseRenderer : ARLaneObject
|
public abstract class AbstractRenderer : ARLaneGameObject
|
||||||
{
|
{
|
||||||
protected Animator animator;
|
protected Animator animator;
|
||||||
protected Shader shaderNormal;
|
protected Shader shaderNormal;
|
||||||
@ -3,7 +3,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public static class Geometry
|
public static class GeometryUtil
|
||||||
{
|
{
|
||||||
public static bool CircleCenter(Vector3 aP0, Vector3 aP1, Vector3 aP2, out Vector3 center)
|
public static bool CircleCenter(Vector3 aP0, Vector3 aP1, Vector3 aP2, out Vector3 center)
|
||||||
{
|
{
|
||||||
@ -3,7 +3,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Assets
|
namespace Assets
|
||||||
{
|
{
|
||||||
public static class VTMath
|
public static class PFMath
|
||||||
{
|
{
|
||||||
public const double Deg2Rad = 0.017453292519943295;
|
public const double Deg2Rad = 0.017453292519943295;
|
||||||
public const double Rad2Deg = 57.295779513082323;
|
public const double Rad2Deg = 57.295779513082323;
|
||||||
@ -29,9 +29,9 @@ namespace Assets
|
|||||||
return (double)value <= (double)max ? value : max;
|
return (double)value <= (double)max ? value : max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float Clamp01(float value) => VTMath.Clamp(value, 0.0f, 1f);
|
public static float Clamp01(float value) => PFMath.Clamp(value, 0.0f, 1f);
|
||||||
|
|
||||||
public static double Clamp01(double value) => VTMath.Clamp(value, 0.0, 1.0);
|
public static double Clamp01(double value) => PFMath.Clamp(value, 0.0, 1.0);
|
||||||
|
|
||||||
public static bool InBounds(double value, double min, double max) => min <= value && value <= max;
|
public static bool InBounds(double value, double min, double max) => min <= value && value <= max;
|
||||||
|
|
||||||
@ -39,14 +39,14 @@ namespace Assets
|
|||||||
|
|
||||||
public static double Lerp(double x1, double y1, double x2, double y2, double x)
|
public static double Lerp(double x1, double y1, double x2, double y2, double x)
|
||||||
{
|
{
|
||||||
double t = x1 != x2 ? VTMath.InverseLerp(x1, x2, x) : 0.5;
|
double t = x1 != x2 ? PFMath.InverseLerp(x1, x2, x) : 0.5;
|
||||||
return VTMath.Lerp(y1, y2, t);
|
return PFMath.Lerp(y1, y2, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float Lerp(float x1, float y1, float x2, float y2, float x)
|
public static float Lerp(float x1, float y1, float x2, float y2, float x)
|
||||||
{
|
{
|
||||||
float t = (double)x1 != (double)x2 ? VTMath.InverseLerp(x1, x2, x) : 0.5f;
|
float t = (double)x1 != (double)x2 ? PFMath.InverseLerp(x1, x2, x) : 0.5f;
|
||||||
return VTMath.Lerp(y1, y2, t);
|
return PFMath.Lerp(y1, y2, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double Lerp(double a, double b, double t) => (1.0 - t) * a + t * b;
|
public static double Lerp(double a, double b, double t) => (1.0 - t) * a + t * b;
|
||||||
@ -61,23 +61,23 @@ namespace Assets
|
|||||||
|
|
||||||
public static float SmoothStep(float x) => (float)((double)x * (double)x * (3.0 - 2.0 * (double)x));
|
public static float SmoothStep(float x) => (float)((double)x * (double)x * (3.0 - 2.0 * (double)x));
|
||||||
|
|
||||||
public static double SmoothStep(double a, double b, double t) => VTMath.Lerp(a, b, VTMath.SmoothStep(t));
|
public static double SmoothStep(double a, double b, double t) => PFMath.Lerp(a, b, PFMath.SmoothStep(t));
|
||||||
|
|
||||||
public static float SmoothStep(float a, float b, float t) => VTMath.Lerp(a, b, VTMath.SmoothStep(t));
|
public static float SmoothStep(float a, float b, float t) => PFMath.Lerp(a, b, PFMath.SmoothStep(t));
|
||||||
|
|
||||||
public static double SmoothStep(double x1, double y1, double x2, double y2, double x)
|
public static double SmoothStep(double x1, double y1, double x2, double y2, double x)
|
||||||
{
|
{
|
||||||
double t = x1 != x2 ? VTMath.InverseLerp(x1, x2, x) : 0.5;
|
double t = x1 != x2 ? PFMath.InverseLerp(x1, x2, x) : 0.5;
|
||||||
return VTMath.SmoothStep(y1, y2, t);
|
return PFMath.SmoothStep(y1, y2, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float SmoothStep(float x1, float y1, float x2, float y2, float x)
|
public static float SmoothStep(float x1, float y1, float x2, float y2, float x)
|
||||||
{
|
{
|
||||||
float t = (double)x1 != (double)x2 ? VTMath.InverseLerp(x1, x2, x) : 0.5f;
|
float t = (double)x1 != (double)x2 ? PFMath.InverseLerp(x1, x2, x) : 0.5f;
|
||||||
return VTMath.SmoothStep(y1, y2, t);
|
return PFMath.SmoothStep(y1, y2, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double InverseSmoothStep(double a, double b, double value) => VTMath.InverseSmoothStep(VTMath.InverseLerp(a, b, value));
|
public static double InverseSmoothStep(double a, double b, double value) => PFMath.InverseSmoothStep(PFMath.InverseLerp(a, b, value));
|
||||||
|
|
||||||
public static double InverseSmoothStep(double x)
|
public static double InverseSmoothStep(double x)
|
||||||
{
|
{
|
||||||
@ -106,7 +106,7 @@ namespace Assets
|
|||||||
Vector3d lineStart,
|
Vector3d lineStart,
|
||||||
Vector3d lineEnd)
|
Vector3d lineEnd)
|
||||||
{
|
{
|
||||||
return Vector3d.Magnitude(VTMath.ProjectPointToLineSegment(point, lineStart, lineEnd) - point);
|
return Vector3d.Magnitude(PFMath.ProjectPointToLineSegment(point, lineStart, lineEnd) - point);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3d ProjectPointToLineSegment(
|
public static Vector3d ProjectPointToLineSegment(
|
||||||
@ -114,7 +114,7 @@ namespace Assets
|
|||||||
Vector3d lineStart,
|
Vector3d lineStart,
|
||||||
Vector3d lineEnd)
|
Vector3d lineEnd)
|
||||||
{
|
{
|
||||||
double lineParameter = VTMath.ProjectPointToLineParameter(point, lineStart, lineEnd);
|
double lineParameter = PFMath.ProjectPointToLineParameter(point, lineStart, lineEnd);
|
||||||
return Vector3d.LerpClamped(lineStart, lineEnd, lineParameter);
|
return Vector3d.LerpClamped(lineStart, lineEnd, lineParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4,7 +4,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Assets.AR
|
namespace Assets.AR
|
||||||
{
|
{
|
||||||
public class RiderRenderer : BaseRenderer
|
public class PlayerRenderer : AbstractRenderer
|
||||||
{
|
{
|
||||||
private const int PowerWindowSize = 10;
|
private const int PowerWindowSize = 10;
|
||||||
private const float Circumference = 2.13097382f;
|
private const float Circumference = 2.13097382f;
|
||||||
@ -83,16 +83,14 @@ namespace Assets.AR
|
|||||||
{
|
{
|
||||||
if ((UnityEngine.Object)this.animator != (UnityEngine.Object)null)
|
if ((UnityEngine.Object)this.animator != (UnityEngine.Object)null)
|
||||||
{
|
{
|
||||||
if (lastSpeed > 0)
|
if (lastSpeed > 1)
|
||||||
{
|
{
|
||||||
animator.Play("rideLoop");
|
animator.Play("rideLoop");
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
animator.Play("idle");
|
animator.Play("idle");
|
||||||
}
|
}
|
||||||
animator.SetFloat("speed", lastSpeed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string LastAnimatorState { get; set; }
|
private string LastAnimatorState { get; set; }
|
||||||
@ -9,7 +9,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace Assets.Scripts.Scenes.VideoRide
|
namespace Assets.Scripts.Scenes.VideoRide
|
||||||
{
|
{
|
||||||
public class TestPlayer : ARLaneObjectsController
|
public class TestPlayer : ARLaneGameObjectsController
|
||||||
{
|
{
|
||||||
protected Transform LightTrans { get; set; }
|
protected Transform LightTrans { get; set; }
|
||||||
public MediaPlayer mediaPlayer;
|
public MediaPlayer mediaPlayer;
|
||||||
@ -18,11 +18,11 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
private RouteDetailData detail;
|
private RouteDetailData detail;
|
||||||
private VideoPointsSync videoPointsSync;
|
private VideoPointsSync videoPointsSync;
|
||||||
private int index = 1;
|
private int index = 1;
|
||||||
private readonly List<ARLaneObject> collisionList = new List<ARLaneObject>();
|
private readonly List<ARLaneGameObject> collisionList = new List<ARLaneGameObject>();
|
||||||
///private Dictionary<int, IRouteRider> riders = new Dictionary<int, IRouteRider>();
|
///private Dictionary<int, IRouteRider> riders = new Dictionary<int, IRouteRider>();
|
||||||
VideoPlayerControl VideoPlayerControl;
|
ARVideoPlayerControl VideoPlayerControl;
|
||||||
ARLaneObject[] rides;
|
ARLaneGameObject[] rides;
|
||||||
public ARLaneObject mainObject;
|
public ARLaneGameObject mainObject;
|
||||||
|
|
||||||
private Light arLight;
|
private Light arLight;
|
||||||
private Light arBackLight;
|
private Light arBackLight;
|
||||||
@ -45,7 +45,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
|
|
||||||
videoSync = videoPointsSync;
|
videoSync = videoPointsSync;
|
||||||
|
|
||||||
this.VideoPlayerControl = new VideoPlayerControl();
|
this.VideoPlayerControl = new ARVideoPlayerControl();
|
||||||
this.VideoPlayerControl.VideoSyncSource = videoSync;
|
this.VideoPlayerControl.VideoSyncSource = videoSync;
|
||||||
this.videoPlayer = new AVProVideoPlayer();
|
this.videoPlayer = new AVProVideoPlayer();
|
||||||
this.videoPlayer.videoPlayer = mediaPlayer;
|
this.videoPlayer.videoPlayer = mediaPlayer;
|
||||||
@ -53,7 +53,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
this.VideoPlayerControl.VideoFrameOffset = this.Route.VideoFrameOffset;
|
this.VideoPlayerControl.VideoFrameOffset = this.Route.VideoFrameOffset;
|
||||||
this.VideoPlayerControl.Route = Route;
|
this.VideoPlayerControl.Route = Route;
|
||||||
this.VideoPlayerControl.SetVideoPlayer(videoPlayer);
|
this.VideoPlayerControl.SetVideoPlayer(videoPlayer);
|
||||||
rides = FindObjectsOfType<ARLaneObject>();
|
rides = FindObjectsOfType<ARLaneGameObject>();
|
||||||
CreateBackLight();
|
CreateBackLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,39 +134,39 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
this.UpdateRidersLean();
|
this.UpdateRidersLean();
|
||||||
this.UpdateBackLight();
|
this.UpdateBackLight();
|
||||||
if (Input.GetKeyDown(KeyCode.F))
|
if (Input.GetKeyDown(KeyCode.F))
|
||||||
this.SetVideoControlMode(VideoControlMode.Front);
|
this.SetVideoControlMode(VideoPlayMode.Front);
|
||||||
if (Input.GetKeyDown(KeyCode.P))
|
if (Input.GetKeyDown(KeyCode.P))
|
||||||
this.SetVideoControlMode(VideoControlMode.AutoPanorama);
|
this.SetVideoControlMode(VideoPlayMode.AutoPanorama);
|
||||||
if (!Input.GetKeyDown(KeyCode.B))
|
if (!Input.GetKeyDown(KeyCode.B))
|
||||||
return;
|
return;
|
||||||
this.SetVideoControlMode(VideoControlMode.Rear);
|
this.SetVideoControlMode(VideoPlayMode.Rear);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VideoControlMode VideoControlMode { get; private set; }
|
public VideoPlayMode VideoControlMode { get; private set; }
|
||||||
private float autoCameraSwitchTimeCounter = 80f;
|
private float autoCameraSwitchTimeCounter = 80f;
|
||||||
public void SetVideoControlMode(VideoControlMode mode)
|
public void SetVideoControlMode(VideoPlayMode mode)
|
||||||
{
|
{
|
||||||
if (mode == this.VideoControlMode)
|
if (mode == this.VideoControlMode)
|
||||||
return;
|
return;
|
||||||
if (!this.AR360Version)
|
if (!this.AR360Version)
|
||||||
mode = VideoControlMode.Front;
|
mode = VideoPlayMode.Front;
|
||||||
this.VideoControlMode = mode;
|
this.VideoControlMode = mode;
|
||||||
this.autoCameraSwitchTimeCounter = 80f;
|
this.autoCameraSwitchTimeCounter = 80f;
|
||||||
if (mode == VideoControlMode.AutoPanorama)
|
if (mode == VideoPlayMode.AutoPanorama)
|
||||||
return;
|
return;
|
||||||
this.videoPlayer.IntendedRear = mode == VideoControlMode.Rear;
|
this.videoPlayer.IntendedRear = mode == VideoPlayMode.Rear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RiderCameraDistance RiderCameraDistance { get; set; }
|
public CameraDistance RiderCameraDistance { get; set; }
|
||||||
//更新摄像机的位置
|
//更新摄像机的位置
|
||||||
private void UpdateCameraFollowDistance()
|
private void UpdateCameraFollowDistance()
|
||||||
{
|
{
|
||||||
this.RiderCameraDistance = RiderCameraDistance.Middle;
|
this.RiderCameraDistance = AR.CameraDistance.Middle;
|
||||||
this.NearViewMode = this.RiderCameraDistance == RiderCameraDistance.Near;
|
this.NearViewMode = this.RiderCameraDistance == AR.CameraDistance.Near;
|
||||||
float cameraFollowDistance = GetCameraFollowDistance(this.RiderCameraDistance);
|
float cameraFollowDistance = GetCameraFollowDistance(this.RiderCameraDistance);
|
||||||
this.VideoPlayerControl.CameraFollowDistance = cameraFollowDistance;
|
this.VideoPlayerControl.CameraFollowDistance = cameraFollowDistance;
|
||||||
}
|
}
|
||||||
protected override bool IsArObjectActive(ARObject arObject)
|
protected override bool IsArObjectActive(ARGameObject arObject)
|
||||||
{
|
{
|
||||||
bool flag = base.IsArObjectActive(arObject);
|
bool flag = base.IsArObjectActive(arObject);
|
||||||
if ((UnityEngine.Object)arObject != (UnityEngine.Object)this.mainObject)
|
if ((UnityEngine.Object)arObject != (UnityEngine.Object)this.mainObject)
|
||||||
@ -176,17 +176,17 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
return flag && (double)this.VideoPlayerControl.CameraDistanceError > 5.0;
|
return flag && (double)this.VideoPlayerControl.CameraDistanceError > 5.0;
|
||||||
}
|
}
|
||||||
//获取摄像机的位置
|
//获取摄像机的位置
|
||||||
public static float GetCameraFollowDistance(RiderCameraDistance distance)
|
public static float GetCameraFollowDistance(CameraDistance distance)
|
||||||
{
|
{
|
||||||
switch (distance)
|
switch (distance)
|
||||||
{
|
{
|
||||||
case RiderCameraDistance.FirstPerson:
|
case AR.CameraDistance.FirstPerson:
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
case RiderCameraDistance.Near:
|
case AR.CameraDistance.Near:
|
||||||
return 2.5f;
|
return 2.5f;
|
||||||
case RiderCameraDistance.Middle:
|
case AR.CameraDistance.Middle:
|
||||||
return 5f;
|
return 5f;
|
||||||
case RiderCameraDistance.Far:
|
case AR.CameraDistance.Far:
|
||||||
return 10f;
|
return 10f;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Unknown rider's camera distance.");
|
throw new ArgumentException("Unknown rider's camera distance.");
|
||||||
@ -248,7 +248,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
//更新骑手的偏移角度
|
//更新骑手的偏移角度
|
||||||
private void UpdateRidersLean()
|
private void UpdateRidersLean()
|
||||||
{
|
{
|
||||||
foreach (ARLaneObject riderObject in this.riderObjects.Values)
|
foreach (ARLaneGameObject riderObject in this.riderObjects.Values)
|
||||||
{
|
{
|
||||||
float num1 = this.Route.GetTrajectoryCurvature(riderObject.Frame) + riderObject.Curvature;
|
float num1 = this.Route.GetTrajectoryCurvature(riderObject.Frame) + riderObject.Curvature;
|
||||||
float z1;
|
float z1;
|
||||||
|
|||||||
@ -80,7 +80,7 @@ namespace Assets
|
|||||||
|
|
||||||
public static Vector3d LerpClamped(Vector3d a, Vector3d b, double t)
|
public static Vector3d LerpClamped(Vector3d a, Vector3d b, double t)
|
||||||
{
|
{
|
||||||
t = VTMath.Clamp01(t);
|
t = PFMath.Clamp01(t);
|
||||||
return Vector3d.Lerp(a, b, t);
|
return Vector3d.Lerp(a, b, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ AnimatorStateTransition:
|
|||||||
m_Conditions:
|
m_Conditions:
|
||||||
- m_ConditionMode: 3
|
- m_ConditionMode: 3
|
||||||
m_ConditionEvent: speed
|
m_ConditionEvent: speed
|
||||||
m_EventTreshold: 0
|
m_EventTreshold: 1
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: -2690597925175035265}
|
m_DstState: {fileID: -2690597925175035265}
|
||||||
m_Solo: 0
|
m_Solo: 0
|
||||||
|
|||||||
1787
Assets/Resources/UI/Prefab/AR/CancelPanel.prefab
Normal file
1787
Assets/Resources/UI/Prefab/AR/CancelPanel.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Resources/UI/Prefab/AR/CancelPanel.prefab.meta
Normal file
7
Assets/Resources/UI/Prefab/AR/CancelPanel.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 16b6b676346aaae4599661ec416e36ba
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1637,7 +1637,7 @@ CanvasGroup:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 3007624748412546454}
|
m_GameObject: {fileID: 3007624748412546454}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_Alpha: 0
|
m_Alpha: 1
|
||||||
m_Interactable: 1
|
m_Interactable: 1
|
||||||
m_BlocksRaycasts: 1
|
m_BlocksRaycasts: 1
|
||||||
m_IgnoreParentGroups: 0
|
m_IgnoreParentGroups: 0
|
||||||
|
|||||||
@ -3675,7 +3675,7 @@ GameObject:
|
|||||||
- component: {fileID: 2162915128657393134}
|
- component: {fileID: 2162915128657393134}
|
||||||
- component: {fileID: 1841566136631317502}
|
- component: {fileID: 1841566136631317502}
|
||||||
- component: {fileID: 1841566136631316992}
|
- component: {fileID: 1841566136631316992}
|
||||||
- component: {fileID: 7118383410524510623}
|
- component: {fileID: 3611148035918924976}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: VidePlayer
|
m_Name: VidePlayer
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -4032,7 +4032,8 @@ MonoBehaviour:
|
|||||||
totalClimb: 0
|
totalClimb: 0
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
bearing: 0
|
bearing: 0
|
||||||
--- !u!114 &7118383410524510623
|
IsStart: 0
|
||||||
|
--- !u!114 &3611148035918924976
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@ -4050,10 +4051,8 @@ MonoBehaviour:
|
|||||||
PositionOffset: {x: 0, y: 0, z: 0}
|
PositionOffset: {x: 0, y: 0, z: 0}
|
||||||
RotationOffset: {x: 0, y: 0, z: 0}
|
RotationOffset: {x: 0, y: 0, z: 0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
StartPosition: 0
|
wheelFront: {fileID: 0}
|
||||||
TestPower: 500
|
wheelRear: {fileID: 0}
|
||||||
wheelFront: {fileID: 6089162587112974816}
|
|
||||||
wheelRear: {fileID: 5665119758069145564}
|
|
||||||
--- !u!1 &1540924146250517987
|
--- !u!1 &1540924146250517987
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -3125,7 +3125,7 @@ MonoBehaviour:
|
|||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_Sprite: {fileID: 21300000, guid: 80ca2c4b44afce842834c2afcb41da14, type: 3}
|
m_Sprite: {fileID: 21300000, guid: e67d070f35d1a9f4796e8d67fa17b2af, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
|
|||||||
@ -2750,7 +2750,7 @@ MonoBehaviour:
|
|||||||
m_ScrollSensitivity: 50
|
m_ScrollSensitivity: 50
|
||||||
m_Viewport: {fileID: 5195470952481441617}
|
m_Viewport: {fileID: 5195470952481441617}
|
||||||
m_HorizontalScrollbar: {fileID: 0}
|
m_HorizontalScrollbar: {fileID: 0}
|
||||||
m_VerticalScrollbar: {fileID: 0}
|
m_VerticalScrollbar: {fileID: 4068819566306428287}
|
||||||
m_HorizontalScrollbarVisibility: 0
|
m_HorizontalScrollbarVisibility: 0
|
||||||
m_VerticalScrollbarVisibility: 1
|
m_VerticalScrollbarVisibility: 1
|
||||||
m_HorizontalScrollbarSpacing: -3
|
m_HorizontalScrollbarSpacing: -3
|
||||||
@ -17019,10 +17019,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 7055447207513649608}
|
m_Father: {fileID: 7055447207513649608}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0.1155889}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: -0.069000006, y: 0.23300171}
|
||||||
m_SizeDelta: {x: 20, y: 20}
|
m_SizeDelta: {x: 10.188904, y: -3.2523804}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &3296896121850349645
|
--- !u!222 &3296896121850349645
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@ -17060,7 +17060,7 @@ MonoBehaviour:
|
|||||||
m_FillClockwise: 1
|
m_FillClockwise: 1
|
||||||
m_FillOrigin: 0
|
m_FillOrigin: 0
|
||||||
m_UseSpriteMesh: 0
|
m_UseSpriteMesh: 0
|
||||||
m_PixelsPerUnitMultiplier: 1
|
m_PixelsPerUnitMultiplier: 2
|
||||||
--- !u!1 &4860149725120165892
|
--- !u!1 &4860149725120165892
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -17845,7 +17845,7 @@ MonoBehaviour:
|
|||||||
m_SelectOnRight: {fileID: 0}
|
m_SelectOnRight: {fileID: 0}
|
||||||
m_Transition: 1
|
m_Transition: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
m_NormalColor: {r: 0.23921569, g: 0.24313726, b: 0.3019608, a: 1}
|
m_NormalColor: {r: 0.43137255, g: 0.43137255, b: 0.49019608, a: 1}
|
||||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||||
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
@ -21174,8 +21174,8 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: -0.000030517578}
|
||||||
m_SizeDelta: {x: -20, y: -20}
|
m_SizeDelta: {x: -12, y: -0.000030517578}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &6090952175355431170
|
--- !u!1 &6090952175355431170
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -22742,8 +22742,8 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 1, y: 0}
|
m_AnchorMin: {x: 1, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: -1, y: 0}
|
||||||
m_SizeDelta: {x: 6, y: 0}
|
m_SizeDelta: {x: 12.04053, y: -13.69861}
|
||||||
m_Pivot: {x: 1, y: 1}
|
m_Pivot: {x: 1, y: 1}
|
||||||
--- !u!222 &4917913218158151159
|
--- !u!222 &4917913218158151159
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@ -22781,7 +22781,7 @@ MonoBehaviour:
|
|||||||
m_FillClockwise: 1
|
m_FillClockwise: 1
|
||||||
m_FillOrigin: 0
|
m_FillOrigin: 0
|
||||||
m_UseSpriteMesh: 0
|
m_UseSpriteMesh: 0
|
||||||
m_PixelsPerUnitMultiplier: 1
|
m_PixelsPerUnitMultiplier: 3
|
||||||
--- !u!114 &4068819566306428287
|
--- !u!114 &4068819566306428287
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -22824,8 +22824,8 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 6952554627092647068}
|
m_TargetGraphic: {fileID: 6952554627092647068}
|
||||||
m_HandleRect: {fileID: 3601439425270914808}
|
m_HandleRect: {fileID: 3601439425270914808}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1
|
m_Value: 0
|
||||||
m_Size: 0.8844111
|
m_Size: 1
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
|
|||||||
2400
Assets/Resources/UI/Prefab/Panel/RideSettingPanel.prefab
Normal file
2400
Assets/Resources/UI/Prefab/Panel/RideSettingPanel.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2455ebbb22ebe754fb70b974c157e685
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@ -54,6 +54,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
#region 获取当前路线在线用户
|
#region 获取当前路线在线用户
|
||||||
riders.Clear();
|
riders.Clear();
|
||||||
var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).ToList();
|
var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).ToList();
|
||||||
|
onlineUsers = onlineUsers.Where(c => !c.Saved).ToList();
|
||||||
foreach (var item in onlineUsers)
|
foreach (var item in onlineUsers)
|
||||||
{
|
{
|
||||||
riders.Add(new OnlineRiderModel()
|
riders.Add(new OnlineRiderModel()
|
||||||
@ -68,6 +69,8 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
Sex = item.Sex,
|
Sex = item.Sex,
|
||||||
FrameRate = item.FrameRate,
|
FrameRate = item.FrameRate,
|
||||||
Speed = item.Speed,
|
Speed = item.Speed,
|
||||||
|
IsWatcher = item.IsWatcher,
|
||||||
|
Saved = item.Saved
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -21,6 +21,9 @@ namespace Assets.Scenes.Ride.Scripts.Model.RiderModels
|
|||||||
|
|
||||||
public int? FrameRate { get; set; } = 0;
|
public int? FrameRate { get; set; } = 0;
|
||||||
|
|
||||||
|
public bool IsWatcher { get; set; }
|
||||||
|
|
||||||
|
public bool Saved { get; set; }
|
||||||
public OutUser GetOutUser(double preDistance, double currentDistance, TurfHelper turfHelper, CyclingStateEnum cyclingState)
|
public OutUser GetOutUser(double preDistance, double currentDistance, TurfHelper turfHelper, CyclingStateEnum cyclingState)
|
||||||
{
|
{
|
||||||
if (this.IsSelf)
|
if (this.IsSelf)
|
||||||
|
|||||||
@ -70,16 +70,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
manager = FindObjectOfType<VideoGameManager>();
|
manager = FindObjectOfType<VideoGameManager>();
|
||||||
mapData = manager.GetMapData();
|
mapData = manager.GetMapData();
|
||||||
ComputeNextSlope();//初始化坡度等
|
ComputeNextSlope();//初始化坡度等
|
||||||
if (speed > 0)
|
|
||||||
{
|
|
||||||
animator.Play("rideLoop");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
animator.Play("idle");
|
|
||||||
}
|
|
||||||
bone_bottle_2 = transform.Find("bone_cable_20");
|
bone_bottle_2 = transform.Find("bone_cable_20");
|
||||||
|
|
||||||
}
|
}
|
||||||
protected virtual void Update()
|
protected virtual void Update()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||||
|
|
||||||
namespace Assets.Scripts.Scenes.VideoRide
|
namespace Assets.Scripts.Scenes.VideoRide
|
||||||
{
|
{
|
||||||
@ -56,6 +57,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
if (manager.cyclingController == null)
|
if (manager.cyclingController == null)
|
||||||
return;
|
return;
|
||||||
var players = manager.cyclingController.riders;
|
var players = manager.cyclingController.riders;
|
||||||
|
players = players.Where(c => ((OnlineRiderModel)c).IsWatcher == false).ToList();
|
||||||
var headList = FindObjectsOfType<HeadScript>();
|
var headList = FindObjectsOfType<HeadScript>();
|
||||||
var videoPlayer = manager.CurrentPlayer;
|
var videoPlayer = manager.CurrentPlayer;
|
||||||
foreach (var item in players)
|
foreach (var item in players)
|
||||||
@ -73,20 +75,23 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
var onlineHead = Instantiate(headPanel, transform);
|
var onlineHead = Instantiate(headPanel, transform);
|
||||||
onlineHead.GetComponent<HeadScript>().UserId = item.UserId;
|
onlineHead.GetComponent<HeadScript>().UserId = item.UserId;
|
||||||
onlineHead.transform.position = vector3;
|
onlineHead.transform.position = vector3;
|
||||||
if (item.IsSelf)
|
currentHead = onlineHead.GetComponent<HeadScript>();
|
||||||
{
|
|
||||||
onlineHead.transform.Find("Main").gameObject.SetActive(true);
|
|
||||||
onlineHead.transform.SetAsLastSibling();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onlineHead.transform.SetAsFirstSibling();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentHead.transform.position = vector3;
|
currentHead.transform.position = vector3;
|
||||||
}
|
}
|
||||||
|
//控制海拔图头像
|
||||||
|
if (manager.CurrentPlayer.userId == item.UserId)
|
||||||
|
{
|
||||||
|
currentHead.transform.Find("Main").gameObject.SetActive(true);
|
||||||
|
currentHead.transform.SetAsLastSibling();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentHead.transform.Find("Main").gameObject.SetActive(false);
|
||||||
|
currentHead.transform.SetAsFirstSibling();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//删除离线的人
|
//删除离线的人
|
||||||
foreach (var item in headList)
|
foreach (var item in headList)
|
||||||
|
|||||||
@ -56,7 +56,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
trail.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
trail.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
||||||
trail.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
trail.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
||||||
}
|
}
|
||||||
|
float timer = 0f;
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (cyclingCotroller.CurrentPlayer != null)
|
if (cyclingCotroller.CurrentPlayer != null)
|
||||||
@ -69,6 +69,14 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
Vector2 vp2 = _minicamera.WorldToViewportPoint(_player.transform.localPosition);//将三维物体的世界坐标转换为视口坐标
|
Vector2 vp2 = _minicamera.WorldToViewportPoint(_player.transform.localPosition);//将三维物体的世界坐标转换为视口坐标
|
||||||
((RectTransform)tr.transform).anchoredPosition = new Vector2((vp2.x * RectRoot.sizeDelta.x) - (RectRoot.sizeDelta.x * 0.5f), (vp2.y * RectRoot.sizeDelta.y) - (RectRoot.sizeDelta.y * 0.5f));
|
((RectTransform)tr.transform).anchoredPosition = new Vector2((vp2.x * RectRoot.sizeDelta.x) - (RectRoot.sizeDelta.x * 0.5f), (vp2.y * RectRoot.sizeDelta.y) - (RectRoot.sizeDelta.y * 0.5f));
|
||||||
trail.enabled = cyclingCotroller.CurrentPlayer.power > 0;
|
trail.enabled = cyclingCotroller.CurrentPlayer.power > 0;
|
||||||
|
|
||||||
|
timer += Time.deltaTime;
|
||||||
|
|
||||||
|
while (timer >= 1)
|
||||||
|
{
|
||||||
|
CreateMiniPath();
|
||||||
|
timer = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +165,33 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
CreateLineRender(feat);//创建小地图路线
|
CreateLineRender(feat);//创建小地图路线
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateMiniPath()
|
||||||
|
{
|
||||||
|
var dat = new List<Vector3>();
|
||||||
|
var mapData = cyclingCotroller.GetMapData();
|
||||||
|
if (mapData != null)
|
||||||
|
{
|
||||||
|
var count = mapData.List.Count;
|
||||||
|
var interval = Math.Max(Math.Ceiling(count / 100D), 1f);
|
||||||
|
for (int i = 0; i < mapData.List.Count; i++)
|
||||||
|
{
|
||||||
|
if (i % interval == 0)
|
||||||
|
{
|
||||||
|
var point = mapData.List[i].Point;
|
||||||
|
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
|
||||||
|
item.y += 5f;
|
||||||
|
if (cyclingCotroller.CurrentPlayer.currentIndex >= i)
|
||||||
|
{
|
||||||
|
dat.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var feat = new VectorFeatureUnity();
|
||||||
|
feat.Points.Add(dat);
|
||||||
|
CreateRedLineRender(feat);//创建小地图路线
|
||||||
|
}
|
||||||
|
}
|
||||||
//创建小地图路线
|
//创建小地图路线
|
||||||
void CreateLineRender(VectorFeatureUnity feat)
|
void CreateLineRender(VectorFeatureUnity feat)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,10 +29,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
manager = FindObjectOfType<VideoGameManager>();
|
manager = FindObjectOfType<VideoGameManager>();
|
||||||
if (manager._aRMode == VideoGameManager.ARMode.INSPECT)
|
GetComponent<Button>().onClick.AddListener(ButtonListener);
|
||||||
{
|
|
||||||
GetComponent<Button>().onClick.AddListener(ButtonListener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private float timer = 1f;
|
private float timer = 1f;
|
||||||
private void Update()
|
private void Update()
|
||||||
@ -80,8 +77,8 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
}
|
}
|
||||||
private void ButtonListener()
|
private void ButtonListener()
|
||||||
{
|
{
|
||||||
manager.ChangePlayer(Convert.ToInt32(Id));
|
if(manager._aRMode == VideoGameManager.ARMode.INSPECT)
|
||||||
|
manager.ChangePlayer(Convert.ToInt32(Id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using Assets.Scenes.Ride.Scripts;
|
using Assets.Scenes.Ride.Scripts;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -60,6 +61,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
timer -= Time.deltaTime;
|
timer -= Time.deltaTime;
|
||||||
while (timer < 0) {
|
while (timer < 0) {
|
||||||
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam);//最新列表
|
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam);//最新列表
|
||||||
|
list = list.Where(c => c.IsWatcher == false).ToList();
|
||||||
rideNum.text = $"{list.Count}";
|
rideNum.text = $"{list.Count}";
|
||||||
btnRideNum.text = rideNum.text;
|
btnRideNum.text = rideNum.text;
|
||||||
if (manager._aRMode == VideoGameManager.ARMode.RIDE)
|
if (manager._aRMode == VideoGameManager.ARMode.RIDE)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Assets.Scenes.Ride.Scripts;
|
using Assets.Scenes.Ride.Scripts;
|
||||||
|
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||||
using PolyAndCode.UI;
|
using PolyAndCode.UI;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -48,6 +49,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
{
|
{
|
||||||
if (_contactList != null) _contactList.Clear();
|
if (_contactList != null) _contactList.Clear();
|
||||||
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam);
|
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam);
|
||||||
|
list = list.Where(c => c.IsWatcher == false).ToList();
|
||||||
var currentPlayer = list.Where(c => c.IsSelf).FirstOrDefault();
|
var currentPlayer = list.Where(c => c.IsSelf).FirstOrDefault();
|
||||||
list = list.Where(c => c.Id != App.CurrentUser.Id).ToList();
|
list = list.Where(c => c.Id != App.CurrentUser.Id).ToList();
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
@ -73,6 +75,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
var currentDistance = manager.CurrentPlayer.totalDistance;
|
var currentDistance = manager.CurrentPlayer.totalDistance;
|
||||||
var currenList = GetComponentsInChildren<ListItem>(true);
|
var currenList = GetComponentsInChildren<ListItem>(true);
|
||||||
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam,manager.cyclingController.recorderData.RoomId);//最新列表
|
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam,manager.cyclingController.recorderData.RoomId);//最新列表
|
||||||
|
list = list.Where(c => c.IsWatcher == false).ToList();
|
||||||
var currentPlayerInfo = list.Where(c => c.Id.ToString() == manager.CurrentPlayer.UserId.ToString()).FirstOrDefault();
|
var currentPlayerInfo = list.Where(c => c.Id.ToString() == manager.CurrentPlayer.UserId.ToString()).FirstOrDefault();
|
||||||
list = list.Where(c => c.Id != App.CurrentUser.Id).OrderByDescending(c=>c.EndDistance).ToList();
|
list = list.Where(c => c.Id != App.CurrentUser.Id).OrderByDescending(c=>c.EndDistance).ToList();
|
||||||
if (currenList.Count() == 0 && list.Count() > 0)
|
if (currenList.Count() == 0 && list.Count() > 0)
|
||||||
|
|||||||
25
Assets/Scripts/Scenes/VideoRide/RideSettingController.cs
Normal file
25
Assets/Scripts/Scenes/VideoRide/RideSettingController.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Scenes.VideoRide
|
||||||
|
{
|
||||||
|
public class RideSettingController : PFUIPanel
|
||||||
|
{
|
||||||
|
public Slider PowerSlider;
|
||||||
|
public Text PowerText;
|
||||||
|
private VideoGameManager manager;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
manager = FindObjectOfType<VideoGameManager>();
|
||||||
|
PowerSlider.onValueChanged.AddListener(e =>
|
||||||
|
{
|
||||||
|
PowerText.text = e.ToString("f0") + "W";
|
||||||
|
if (manager.CurrentPlayer != null)
|
||||||
|
{
|
||||||
|
manager.CurrentPlayer.mockpower = e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8c630a81d1477c842ad1599135a73d2d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -63,7 +63,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
public ARMode _aRMode { get; set; }
|
public ARMode _aRMode { get; set; }
|
||||||
public int RankingId { get; set; }
|
public int RankingId { get; set; }
|
||||||
|
|
||||||
public Dictionary<IRider,RiderRenderer> rideObjs = new Dictionary<IRider, RiderRenderer>();
|
public Dictionary<IRider, PlayerRenderer> rideObjs = new Dictionary<IRider, PlayerRenderer>();
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
@ -144,7 +144,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
{
|
{
|
||||||
var endTime = UIManager.Now == null ? DateTime.Now : UIManager.Now.GetDateTime();
|
var endTime = UIManager.Now == null ? DateTime.Now : UIManager.Now.GetDateTime();
|
||||||
var startTime = Helper.GetStartTime(endTime, type);
|
var startTime = Helper.GetStartTime(endTime, type);
|
||||||
var list = ConfigHelper.mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 10, "", startTime,endTime);
|
var list = ConfigHelper.mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 10, "", startTime, endTime);
|
||||||
if (list.result)
|
if (list.result)
|
||||||
{
|
{
|
||||||
rankingList = list.data;
|
rankingList = list.data;
|
||||||
@ -158,14 +158,24 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
//创建当前线路其他选手
|
//创建当前线路其他选手
|
||||||
private void CreateOnlineUser(List<BaseRider> list)
|
private void CreateOnlineUser(List<BaseRider> list)
|
||||||
{
|
{
|
||||||
|
list = list.Where(c => ((OnlineRiderModel)c).IsWatcher == false).ToList();
|
||||||
if (list == null || list.Count == 0)
|
if (list == null || list.Count == 0)
|
||||||
{
|
{
|
||||||
var currentList = FindObjectsOfType<RiderRenderer>();
|
var currentList = FindObjectsOfType<PlayerRenderer>();
|
||||||
foreach (var item in currentList)
|
foreach (var item in currentList)
|
||||||
{
|
{
|
||||||
item.Speed = 0;
|
item.Speed = 0;
|
||||||
item.Paused = true;
|
item.Paused = true;
|
||||||
}
|
}
|
||||||
|
rideObjs.Clear();
|
||||||
|
visibleRiders.Clear();
|
||||||
|
//移除退出的选手
|
||||||
|
var onlineUserList = FindObjectsOfType<OnlineVideoPlayer>();
|
||||||
|
foreach (var item in onlineUserList)
|
||||||
|
{
|
||||||
|
DestroyImmediate(item.gameObject);
|
||||||
|
}
|
||||||
|
CurrentPlayer = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var trainController = GetComponent<ARTrainingController>();
|
var trainController = GetComponent<ARTrainingController>();
|
||||||
@ -182,7 +192,14 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var currentPlayerInfo = list.Where(c => c.IsSelf).FirstOrDefault();
|
var currentPlayerInfo = list.Where(c => c.IsSelf).FirstOrDefault();
|
||||||
var needUpdateList = list.OrderByDescending(c=>c.IsSelf).ToList();
|
var needUpdateList = list.OrderByDescending(c => c.IsSelf).ToList();
|
||||||
|
//如果当前为观察者模式且currentPlayerInfo为null随机选择以为用户观察
|
||||||
|
if (currentPlayerInfo == null)
|
||||||
|
{
|
||||||
|
currentPlayerInfo = needUpdateList.Where(c => c.UserId == currentUserId).FirstOrDefault();
|
||||||
|
if(currentPlayerInfo == null)
|
||||||
|
currentPlayerInfo = needUpdateList.FirstOrDefault();
|
||||||
|
}
|
||||||
foreach (var item in needUpdateList)
|
foreach (var item in needUpdateList)
|
||||||
{
|
{
|
||||||
var onlineRider = item as OnlineRiderModel;
|
var onlineRider = item as OnlineRiderModel;
|
||||||
@ -191,11 +208,11 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
if (visibleItem != null)
|
if (visibleItem != null)
|
||||||
{
|
{
|
||||||
visibleItem.SetPlayer(onlineRider.NickName, onlineRider.Speed, onlineRider.PreDistance, onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId, onlineRider.Power, currentPlayerInfo.EndDistance, onlineRider.FrameRate.Value);
|
visibleItem.SetPlayer(onlineRider.NickName, onlineRider.Speed, onlineRider.PreDistance, onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId, onlineRider.Power, currentPlayerInfo.EndDistance, onlineRider.FrameRate.Value);
|
||||||
|
if(visibleItem.userId == currentUserId)
|
||||||
|
CurrentPlayer = visibleItem;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (currentPlayerInfo == null)
|
|
||||||
return;
|
|
||||||
var diff = item.EndDistance % mapData.TotalDistance - currentPlayerInfo.EndDistance % mapData.TotalDistance;
|
var diff = item.EndDistance % mapData.TotalDistance - currentPlayerInfo.EndDistance % mapData.TotalDistance;
|
||||||
if (Math.Abs(diff * 1000) <= MaxVisibleDistance)
|
if (Math.Abs(diff * 1000) <= MaxVisibleDistance)
|
||||||
{
|
{
|
||||||
@ -211,14 +228,17 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
obj = Instantiate(OnlinePlayer_NV, transform);
|
obj = Instantiate(OnlinePlayer_NV, transform);
|
||||||
}
|
}
|
||||||
var online = obj.GetComponentInChildren<OnlineVideoPlayer>();
|
var online = obj.GetComponentInChildren<OnlineVideoPlayer>();
|
||||||
var rideObj = obj.GetComponentInChildren<RiderRenderer>();
|
var rideObj = obj.GetComponentInChildren<PlayerRenderer>();
|
||||||
online.SetStartDistance(item.EndDistance);
|
online.SetStartDistance(item.EndDistance);
|
||||||
rideObj.Distance = (float)online.StartDistance;
|
rideObj.Distance = (float)online.StartDistance;
|
||||||
rideObj.RouteDistance = rideObj.Distance;
|
rideObj.RouteDistance = rideObj.Distance;
|
||||||
|
rideObj.UserId = item.UserId;
|
||||||
rideObjs.Add(online, rideObj);
|
rideObjs.Add(online, rideObj);
|
||||||
visibleRiders.Add(online);
|
visibleRiders.Add(online);
|
||||||
trainController.AddRider(onlineRider);
|
trainController.AddRider(onlineRider);
|
||||||
online.SetPlayer(onlineRider.NickName, onlineRider.Speed, onlineRider.PreDistance, onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId, onlineRider.Power, currentPlayerInfo.EndDistance, onlineRider.FrameRate.Value);
|
online.SetPlayer(onlineRider.NickName, onlineRider.Speed, onlineRider.PreDistance, onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId, onlineRider.Power, currentPlayerInfo.EndDistance, onlineRider.FrameRate.Value);
|
||||||
|
if (currentPlayerInfo.UserId == item.UserId)
|
||||||
|
CurrentPlayer = online;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -238,10 +258,11 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
vp.SetEndDistance(item.EndDistance);
|
vp.SetEndDistance(item.EndDistance);
|
||||||
CurrentPlayer.SetStartDistance(item.EndDistance);
|
CurrentPlayer.SetStartDistance(item.EndDistance);
|
||||||
|
|
||||||
var rideObj = videoPlayer.GetComponent<RiderRenderer>();
|
var rideObj = videoPlayer.GetComponent<PlayerRenderer>();
|
||||||
rideObj.Distance = (float)CurrentPlayer.StartDistance;
|
rideObj.Distance = (float)CurrentPlayer.StartDistance;
|
||||||
rideObj.RouteDistance = rideObj.Distance;
|
rideObj.RouteDistance = rideObj.Distance;
|
||||||
rideObj.IsMain = true;
|
rideObj.IsMain = true;
|
||||||
|
rideObj.UserId = item.UserId;
|
||||||
rideObjs.Add(CurrentPlayer, rideObj);
|
rideObjs.Add(CurrentPlayer, rideObj);
|
||||||
visibleRiders.Add(CurrentPlayer);
|
visibleRiders.Add(CurrentPlayer);
|
||||||
|
|
||||||
@ -271,33 +292,11 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
}
|
}
|
||||||
public GameObject videoPlayer;
|
public GameObject videoPlayer;
|
||||||
public GameObject target;
|
public GameObject target;
|
||||||
|
private int currentUserId { get; set; }
|
||||||
//切换人物 TODO:替换写法
|
//切换人物 TODO:替换写法
|
||||||
public void ChangePlayer(int userId)
|
public void ChangePlayer(int userId)
|
||||||
{
|
{
|
||||||
var players = FindObjectsOfType<OnlineVideoPlayer>();
|
currentUserId = userId;
|
||||||
if (players != null)
|
|
||||||
{
|
|
||||||
CurrentPlayer = players.Where(c => c.UserId == userId).FirstOrDefault();
|
|
||||||
if (CurrentPlayer == null)
|
|
||||||
{
|
|
||||||
var onlineRiders = cyclingController.riders;
|
|
||||||
var currentPlayer = onlineRiders.Where(c => c.UserId == userId).FirstOrDefault();
|
|
||||||
if (currentPlayer != null)
|
|
||||||
{
|
|
||||||
var onlineRider = currentPlayer as OnlineRiderModel;
|
|
||||||
var obj = Instantiate(OnlinePlayer, transform);
|
|
||||||
var online = obj.GetComponent<OnlineVideoPlayer>();
|
|
||||||
online.SetPlayer(onlineRider.NickName, onlineRider.Speed,onlineRider.PreDistance, onlineRider.EndDistance, onlineRider.Cadence, onlineRider.HeartRate, 0, onlineRider.UserId, onlineRider.Power, onlineRider.EndDistance, onlineRider.FrameRate.Value);
|
|
||||||
CurrentPlayer = online;
|
|
||||||
}
|
|
||||||
var clearList = players.Where(c => c.UserId != userId);
|
|
||||||
foreach (var item in clearList)
|
|
||||||
{
|
|
||||||
item.Destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//获取角色头顶信息预制件
|
//获取角色头顶信息预制件
|
||||||
public GameObject GetHeadInfo()
|
public GameObject GetHeadInfo()
|
||||||
@ -315,6 +314,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
Debug.Log("selectParamModel"+ selectParamModel.ContinueMark);
|
Debug.Log("selectParamModel"+ selectParamModel.ContinueMark);
|
||||||
SetCyclingModel(CyclingModel.Single);
|
SetCyclingModel(CyclingModel.Single);
|
||||||
endDistance = routeResult.EndDistance;
|
endDistance = routeResult.EndDistance;
|
||||||
|
App.routeResult = null;
|
||||||
//mediaPlayer.Control.SeekToFrame(routeResult.LastFrame ?? 0);
|
//mediaPlayer.Control.SeekToFrame(routeResult.LastFrame ?? 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
protected RawImage head;
|
protected RawImage head;
|
||||||
protected RawImage country;
|
protected RawImage country;
|
||||||
protected RawImage mapCountry;
|
protected RawImage mapCountry;
|
||||||
protected RawImage altitudeGraph;
|
protected RawImage altitudeGraph { get; set; }
|
||||||
protected Transform mapRanking;
|
protected Transform mapRanking;
|
||||||
protected Text mapId;
|
protected Text mapId;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
|
|
||||||
if (File.Exists(filepath))
|
if (File.Exists(filepath))
|
||||||
{
|
{
|
||||||
//TODO:暂时隐藏watch.SetActive(true);
|
watch.SetActive(true);
|
||||||
slider.value = 100;
|
slider.value = 100;
|
||||||
download.gameObject.SetActive(false);
|
download.gameObject.SetActive(false);
|
||||||
manager.SetMedia(filepath);
|
manager.SetMedia(filepath);
|
||||||
@ -208,7 +208,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
mapCountry.texture = manager.GetCountryImageByCode(route.CountryCode);//路书国家
|
mapCountry.texture = manager.GetCountryImageByCode(route.CountryCode);//路书国家
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
Utils.DisplayImage(altitudeGraph, route.AltitudeGraph,true,null,1f);//渲染海拔图
|
||||||
//显示线路背景图
|
//显示线路背景图
|
||||||
DrawMapRouteAsync(route.Id);
|
DrawMapRouteAsync(route.Id);
|
||||||
//查询排行榜 TODO优化
|
//查询排行榜 TODO优化
|
||||||
@ -263,9 +263,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
};
|
};
|
||||||
UIManager.ShowGameRoomCountDownPanel(seconds,()=> {
|
UIManager.ShowGameRoomCountDownPanel(seconds,()=> {
|
||||||
manager.StartGame();
|
manager.StartGame();
|
||||||
//manager.SetCyclingModel(CyclingModel.GameRoom);
|
},false,true);
|
||||||
//manager.SetCurrentMode(VideoGameManager.ARMode.RIDE);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async void DownloadAsync(BaseEventData baseEvent)
|
protected async void DownloadAsync(BaseEventData baseEvent)
|
||||||
@ -315,10 +313,14 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
{
|
{
|
||||||
var canvasGroup = transform.GetComponent<CanvasGroup>();
|
var canvasGroup = transform.GetComponent<CanvasGroup>();
|
||||||
var ui = manager.GetCanvasTransform();
|
var ui = manager.GetCanvasTransform();
|
||||||
|
InitAR();
|
||||||
|
MapUDPService.IsWatch = true;
|
||||||
|
MapUDPService.SendGizpModel();
|
||||||
canvasGroup.DOFade(0, 1).onComplete += () => {
|
canvasGroup.DOFade(0, 1).onComplete += () => {
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
ui.gameObject.SetActive(true);
|
ui.gameObject.SetActive(true);
|
||||||
manager.SetCurrentMode(VideoGameManager.ARMode.INSPECT);
|
manager.SetCurrentMode(VideoGameManager.ARMode.INSPECT);
|
||||||
|
manager.StartGame();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
protected void Cancel(BaseEventData baseEvent)
|
protected void Cancel(BaseEventData baseEvent)
|
||||||
|
|||||||
@ -63,7 +63,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
{
|
{
|
||||||
power = mockpower;
|
power = mockpower;
|
||||||
cadance = 50;
|
cadance = 50;
|
||||||
heartRate = 120;
|
heartRate = 160;
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
weight = App.CurrentUser.Weight;
|
weight = App.CurrentUser.Weight;
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using DG.Tweening;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
||||||
using static Assets.Scripts.Scenes.VideoRide.VideoGameManager;
|
using static Assets.Scripts.Scenes.VideoRide.VideoGameManager;
|
||||||
|
using Assets.AR;
|
||||||
|
|
||||||
namespace Assets.Scripts.Scenes.VideoRide
|
namespace Assets.Scripts.Scenes.VideoRide
|
||||||
{
|
{
|
||||||
@ -52,9 +53,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
Image ftpImage { get; set; }
|
Image ftpImage { get; set; }
|
||||||
Text wkg { get; set; }
|
Text wkg { get; set; }
|
||||||
|
|
||||||
public Text PowerText;
|
|
||||||
public Slider PowerSlider;
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@ -69,14 +67,10 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
{
|
{
|
||||||
|
|
||||||
mapName.text = manager.GetMapRoute().Name;
|
mapName.text = manager.GetMapRoute().Name;
|
||||||
//#if UNITY_EDITOR
|
|
||||||
//infoText.gameObject.SetActive(true);
|
|
||||||
//infoText.text = $"帧数:{manager.GetCurrentFrame()}";
|
|
||||||
//#endif
|
|
||||||
if (manager.CurrentPlayer != null)
|
if (manager.CurrentPlayer != null)
|
||||||
{
|
{
|
||||||
power.text = Math.Round(manager.CurrentPlayer.power).ToString();
|
power.text = Math.Round(manager.CurrentPlayer.power).ToString();
|
||||||
speed.text = Math.Round(manager.CurrentPlayer.speed).ToString();
|
speed.text = manager.CurrentPlayer.speed.ToString("f1");
|
||||||
heartRate.text = Math.Round((manager.CurrentPlayer.heartRate ?? 0d)).ToString();
|
heartRate.text = Math.Round((manager.CurrentPlayer.heartRate ?? 0d)).ToString();
|
||||||
cadance.text = Math.Round(manager.CurrentPlayer.cadance).ToString();
|
cadance.text = Math.Round(manager.CurrentPlayer.cadance).ToString();
|
||||||
playerTimer.text = Helper.FormatTicks(manager.CurrentPlayer.ticks);
|
playerTimer.text = Helper.FormatTicks(manager.CurrentPlayer.ticks);
|
||||||
@ -84,13 +78,33 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
left.fillAmount = (float)(Math.Round(manager.CurrentPlayer.power) / MAXPOWER_RATE);
|
left.fillAmount = (float)(Math.Round(manager.CurrentPlayer.power) / MAXPOWER_RATE);
|
||||||
right.fillAmount = (float)(Math.Round((manager.CurrentPlayer.heartRate ?? 0f)) / MAXHEARRATE);
|
right.fillAmount = (float)(Math.Round((manager.CurrentPlayer.heartRate ?? 0f)) / MAXHEARRATE);
|
||||||
SetSlopePanel();
|
SetSlopePanel();
|
||||||
//ftp
|
|
||||||
ftpImage.fillAmount = (float)(manager.CurrentPlayer.wkg / MAXWKG);
|
ftpImage.fillAmount = (float)(manager.CurrentPlayer.wkg / MAXWKG);
|
||||||
wkg.text = $"{manager.CurrentPlayer.wkg}w/kg";
|
wkg.text = $"{manager.CurrentPlayer.wkg}w/kg";
|
||||||
//explosive.SetActive(true);TODO:心率过高的时候显示
|
//心率过高的时候显示
|
||||||
|
if (manager.CurrentPlayer.UserId == App.CurrentUser.Id)
|
||||||
|
{
|
||||||
|
explosive.SetActive(ComputeHearRateRatio(manager.CurrentPlayer.heartRate ?? 0) > MAX_HEART_RATIO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
explosive.SetActive(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private const float MAX_HEART_RATIO = 0.9f;
|
||||||
|
private float ComputeHearRateRatio(int heartRate)
|
||||||
|
{
|
||||||
|
// 220 - 年龄= 最大心率 ratio = heartRate /最大心率
|
||||||
|
var age = DateTime.Now.Year - App.CurrentUser.Birthday?.Year;
|
||||||
|
if (DateTime.Now.Month - App.CurrentUser.Birthday?.Month > 0 && DateTime.Now.Day - App.CurrentUser.Birthday?.Day > 0)
|
||||||
|
{
|
||||||
|
age += 1;
|
||||||
|
}
|
||||||
|
age = age ?? 0;
|
||||||
|
var ratio = heartRate / (220 - age);
|
||||||
|
return (float)ratio;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetCurrentMode(VideoGameManager.ARMode aRMode)
|
public void SetCurrentMode(VideoGameManager.ARMode aRMode)
|
||||||
{
|
{
|
||||||
@ -142,15 +156,11 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
//
|
//
|
||||||
explosive = transform.Find("Panel/Explosive").gameObject;
|
explosive = transform.Find("Panel/Explosive").gameObject;
|
||||||
//toolbar 事件注册
|
//toolbar 事件注册
|
||||||
UIManager.AddEvent(settingBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, PauseClick);
|
UIManager.AddEvent(settingBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSetting);
|
||||||
UIManager.AddEvent(changeViewBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeViewClick);
|
UIManager.AddEvent(changeViewBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeViewClick);
|
||||||
UIManager.AddEvent(deviceBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, DeviceClick);
|
UIManager.AddEvent(deviceBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, DeviceClick);
|
||||||
UIManager.AddEvent(quitBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, QuitClick);
|
UIManager.AddEvent(quitBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, QuitClick);
|
||||||
PowerSlider.onValueChanged.AddListener(e =>
|
|
||||||
{
|
|
||||||
PowerText.text = e.ToString("f0") + "W";
|
|
||||||
manager.CurrentPlayer.mockpower = e;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
//设置坡度信息
|
//设置坡度信息
|
||||||
private void SetSlopePanel()
|
private void SetSlopePanel()
|
||||||
@ -188,10 +198,9 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PauseClick(BaseEventData e)
|
private void ShowSetting(BaseEventData e)
|
||||||
{
|
{
|
||||||
settingPanel.SetActive(true);
|
UIManager.ShowRideSettingPanel();
|
||||||
settingPanel.transform.SetAsLastSibling();
|
|
||||||
}
|
}
|
||||||
private void DeviceClick(BaseEventData e)
|
private void DeviceClick(BaseEventData e)
|
||||||
{
|
{
|
||||||
@ -200,21 +209,27 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
|
|
||||||
private void ChangeViewClick(BaseEventData e)
|
private void ChangeViewClick(BaseEventData e)
|
||||||
{
|
{
|
||||||
var videoPlayer = FindObjectOfType<VideoPlayer>();
|
|
||||||
var nearByScript = FindObjectOfType<NearByScript>();
|
var nearByScript = FindObjectOfType<NearByScript>();
|
||||||
var rankingScript = FindObjectOfType<RankingScript>();
|
var rankingScript = FindObjectOfType<RankingScript>();
|
||||||
var currentPlayer = manager.CurrentPlayer == null ? videoPlayer.transform : manager.CurrentPlayer.transform;
|
var arController = FindObjectOfType<ARTrainingController>();
|
||||||
manager._viewMode = manager._viewMode == ViewMode.THIRD ? ViewMode.FIRST : ViewMode.THIRD;
|
|
||||||
var cameraImage = changeViewBtn.transform.Find("Camera").gameObject;
|
var cameraImage = changeViewBtn.transform.Find("Camera").gameObject;
|
||||||
|
|
||||||
|
manager._viewMode = manager._viewMode == ViewMode.THIRD ? ViewMode.FIRST : ViewMode.THIRD;
|
||||||
if (manager._viewMode == ViewMode.FIRST)
|
if (manager._viewMode == ViewMode.FIRST)
|
||||||
{
|
{
|
||||||
currentPlayer.DOMoveX(0f, 0f);
|
|
||||||
currentPlayer.DOMoveZ(-0.1f, 0f);
|
|
||||||
currentPlayer.DOMoveY(-0.85f, 0f);
|
|
||||||
ftpPanel.SetActive(true);
|
ftpPanel.SetActive(true);
|
||||||
nearByScript.Hidehandler(null);
|
nearByScript.Hidehandler(null);
|
||||||
rankingScript.Hidehandler(null);
|
rankingScript.Hidehandler(null);
|
||||||
cameraImage.SetActive(true);
|
cameraImage.SetActive(true);
|
||||||
|
arController.RiderCameraDistance = CameraDistance.FirstPerson;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ftpPanel.SetActive(false);
|
||||||
|
nearByScript.Showhandler(null);
|
||||||
|
rankingScript.Showhandler(null);
|
||||||
|
cameraImage.SetActive(false);
|
||||||
|
arController.RiderCameraDistance = CameraDistance.Middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +264,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
|||||||
}
|
}
|
||||||
private void QuitClick(BaseEventData e)
|
private void QuitClick(BaseEventData e)
|
||||||
{
|
{
|
||||||
if (manager.CurrentPlayer.UserId == App.CurrentUser.Id && (manager.CurrentPlayer.ticks == 0 || manager.CurrentPlayer.EndDistance - manager.CurrentPlayer.StartDistance < 0.1f))
|
if (manager.CurrentPlayer != null && manager.CurrentPlayer.UserId == App.CurrentUser.Id && (manager.CurrentPlayer.ticks == 0 || manager.CurrentPlayer.EndDistance - manager.CurrentPlayer.StartDistance < 0.1f))
|
||||||
{
|
{
|
||||||
UIManager.ShowConfirm("Quit", App.GetLocalString("Current ride distance too short to save."), () => {
|
UIManager.ShowConfirm("Quit", App.GetLocalString("Current ride distance too short to save."), () => {
|
||||||
UIManager.CloseConfirm();
|
UIManager.CloseConfirm();
|
||||||
|
|||||||
@ -43,15 +43,15 @@ class GameRoomDownLoad : MonoBehaviour
|
|||||||
{
|
{
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
downLoadList.SetActive(true);
|
downLoadList.SetActive(true);
|
||||||
var content = downLoadList.transform.Find("Viewport/Content");
|
//var content = downLoadList.transform.Find("Viewport/Content");
|
||||||
var list = FindObjectsOfType<GameRoomDownloadTask>();
|
//var list = FindObjectsOfType<GameRoomDownloadTask>();
|
||||||
//新增
|
////新增
|
||||||
var obj = list.Where(c => c.RoomId == RoomId).FirstOrDefault();
|
//var obj = list.Where(c => c.RoomId == RoomId).FirstOrDefault();
|
||||||
if (obj == null)
|
//if (obj == null)
|
||||||
{
|
//{
|
||||||
var newtask = Instantiate(downLoadTask, content);
|
// var newtask = Instantiate(downLoadTask, content);
|
||||||
newtask.GetComponent<GameRoomDownloadTask>().Init(RoomId, FileName,gameObject);
|
// newtask.GetComponent<GameRoomDownloadTask>().Init(RoomId, FileName,gameObject);
|
||||||
}
|
//}
|
||||||
});
|
});
|
||||||
|
|
||||||
UIManager.AddEvent(enterBtn, EventTriggerType.PointerClick, (ee) =>
|
UIManager.AddEvent(enterBtn, EventTriggerType.PointerClick, (ee) =>
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class GameRoomDownloadTask : MonoBehaviour
|
|||||||
{
|
{
|
||||||
modal.SetActive(true);
|
modal.SetActive(true);
|
||||||
modal.GetComponent<GameRoomDownLoad>().ComeIntoStep2(FileName);
|
modal.GetComponent<GameRoomDownLoad>().ComeIntoStep2(FileName);
|
||||||
transform.parent.parent.parent.gameObject.SetActive(false);
|
//transform.parent.parent.parent.gameObject.SetActive(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,8 @@ public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnter
|
|||||||
var tabContainer = transform.Find("TabContainer");
|
var tabContainer = transform.Find("TabContainer");
|
||||||
var diff = tabContainer.Find("Diff");
|
var diff = tabContainer.Find("Diff");
|
||||||
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
|
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
|
||||||
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
|
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D && !myMap.EnableAR);
|
||||||
|
tabContainer.Find("AR").gameObject?.SetActive(myMap.EnableAR);
|
||||||
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
|
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
|
||||||
//if (!isModal)
|
//if (!isModal)
|
||||||
//{
|
//{
|
||||||
|
|||||||
@ -23,12 +23,13 @@ public class GameRoomCountDownController : PFUIPanel
|
|||||||
{
|
{
|
||||||
base.Show();
|
base.Show();
|
||||||
}
|
}
|
||||||
|
private bool isSimple { get; set; }
|
||||||
public void Init(int seconds,Action action,bool isEnd = false)
|
public void Init(int seconds,Action action,bool isEnd = false,bool isSimple = false)
|
||||||
{
|
{
|
||||||
Seconds = seconds;
|
Seconds = seconds;
|
||||||
Callback = action;
|
Callback = action;
|
||||||
endCount.gameObject.SetActive(isEnd);
|
endCount.gameObject.SetActive(isEnd);
|
||||||
|
this.isSimple = isSimple;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Close()
|
public override void Close()
|
||||||
@ -52,7 +53,14 @@ public class GameRoomCountDownController : PFUIPanel
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
count.text = Helper.FormatTicks(Seconds);
|
if (isSimple)
|
||||||
|
{
|
||||||
|
count.text = Seconds.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count.text = Helper.FormatTicks(Seconds);
|
||||||
|
}
|
||||||
endCount.text = Helper.FormatTicks(Seconds);
|
endCount.text = Helper.FormatTicks(Seconds);
|
||||||
}
|
}
|
||||||
Seconds--;
|
Seconds--;
|
||||||
|
|||||||
@ -223,7 +223,7 @@ public class GameRoomListController : PFUIPanel
|
|||||||
MapUDPService.MessageListener = ListenerHandler;
|
MapUDPService.MessageListener = ListenerHandler;
|
||||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
||||||
}
|
}
|
||||||
|
private List<string> fileNameList = new List<string>();
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
//房间已经进行骑行时间
|
//房间已经进行骑行时间
|
||||||
@ -277,12 +277,12 @@ public class GameRoomListController : PFUIPanel
|
|||||||
if (Loom.DownLoadTaskList.Count>0)
|
if (Loom.DownLoadTaskList.Count>0)
|
||||||
{
|
{
|
||||||
var content = downLoadList.transform.Find("Viewport/Content");
|
var content = downLoadList.transform.Find("Viewport/Content");
|
||||||
var taskList = FindObjectsOfType<GameRoomDownloadTask>();
|
|
||||||
foreach (var item in Loom.DownLoadTaskList)
|
foreach (var item in Loom.DownLoadTaskList)
|
||||||
{
|
{
|
||||||
var done = taskList.Where(c => c.FileName.Equals(item.Key)).Any();
|
var done = fileNameList.Where(c => c.Equals(item.Key)).Any();
|
||||||
if (!done)
|
if (!done)
|
||||||
{
|
{
|
||||||
|
fileNameList.Add(item.Key);
|
||||||
var newtask = Instantiate(_downLoadTask, content);
|
var newtask = Instantiate(_downLoadTask, content);
|
||||||
newtask.GetComponent<GameRoomDownloadTask>().Init(0, item.Key, downloadPanel);
|
newtask.GetComponent<GameRoomDownloadTask>().Init(0, item.Key, downloadPanel);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ using Assets.Scenes.Ride.Scripts;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Assets.Scripts.Devices.Ant;
|
using Assets.Scripts.Devices.Ant;
|
||||||
|
using Assets.Scripts.Scenes.VideoRide;
|
||||||
|
|
||||||
public class UIManager : MonoBehaviour
|
public class UIManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -133,6 +134,15 @@ public class UIManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RideSettingController mRideSettingController;
|
||||||
|
public RideSettingController RideSettingController
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.GetPanelInstance("RideSettingPanel", ref this.mRideSettingController);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private SettingContoller mSettingContoller;
|
private SettingContoller mSettingContoller;
|
||||||
public SettingContoller SettingModal
|
public SettingContoller SettingModal
|
||||||
{
|
{
|
||||||
@ -882,14 +892,20 @@ public class UIManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
UIManager.Show(UIManager.Instance.GameRoomLoadingPanel, null, true);
|
UIManager.Show(UIManager.Instance.GameRoomLoadingPanel, null, true);
|
||||||
}
|
}
|
||||||
public static void ShowGameRoomCountDownPanel(int seconds,Action action,bool isEnd = false)
|
//显示关门时间倒计时
|
||||||
|
public static void ShowGameRoomCountDownPanel(int seconds,Action action,bool isEnd = false, bool isSimple = false)
|
||||||
{
|
{
|
||||||
if (UIManager.Instance.GameRoomCountDownPanel!= null)
|
if (UIManager.Instance.GameRoomCountDownPanel!= null)
|
||||||
{
|
{
|
||||||
UIManager.Instance.GameRoomCountDownPanel.Init(seconds, action, isEnd);
|
UIManager.Instance.GameRoomCountDownPanel.Init(seconds, action, isEnd, isSimple);
|
||||||
}
|
}
|
||||||
UIManager.Show(UIManager.Instance.GameRoomCountDownPanel, null, true);
|
UIManager.Show(UIManager.Instance.GameRoomCountDownPanel, null, true);
|
||||||
}
|
}
|
||||||
|
//显示骑行设置面板
|
||||||
|
public static void ShowRideSettingPanel()
|
||||||
|
{
|
||||||
|
UIManager.Show(UIManager.Instance.RideSettingController, null, true);
|
||||||
|
}
|
||||||
public static void ShowDevicePanel()
|
public static void ShowDevicePanel()
|
||||||
{
|
{
|
||||||
UIManager.Show(UIManager.Instance.DevicePanel, null, true);
|
UIManager.Show(UIManager.Instance.DevicePanel, null, true);
|
||||||
|
|||||||
@ -474,7 +474,7 @@ public class Davinci : MonoBehaviour
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
color = image.color;
|
color = image.color;
|
||||||
maxAlpha = color.a;
|
maxAlpha = Math.Max(color.a, 1);
|
||||||
|
|
||||||
if (fadeTime > 0)
|
if (fadeTime > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -378,12 +378,12 @@ namespace Assets.Scripts
|
|||||||
}
|
}
|
||||||
public static Dictionary<string, Texture> propTextureCache = new Dictionary<string, Texture>();
|
public static Dictionary<string, Texture> propTextureCache = new Dictionary<string, Texture>();
|
||||||
public delegate Coroutine StartCoroutine(IEnumerator routine);
|
public delegate Coroutine StartCoroutine(IEnumerator routine);
|
||||||
public static void DisplayImage(MaskableGraphic img, string url, bool cache = true,Dictionary<string,Texture> caches = null)
|
public static void DisplayImage(MaskableGraphic img, string url, bool cache = true,Dictionary<string,Texture> caches = null,float fadeTime = 0)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Davinci.get().load(url).setCached(cache).into(img).setFadeTime(0).start();
|
Davinci.get().load(url).setCached(cache).into(img).setFadeTime(fadeTime).start();
|
||||||
return;
|
return;
|
||||||
//可以考虑缓存到硬盘里
|
//可以考虑缓存到硬盘里
|
||||||
//Texture2D tex = null;
|
//Texture2D tex = null;
|
||||||
|
|||||||
@ -17,7 +17,4 @@ EditorBuildSettings:
|
|||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/VideoPlay.unity
|
path: Assets/Scenes/VideoPlay.unity
|
||||||
guid: f25b9f482e27079448d130ae1ed0ea34
|
guid: f25b9f482e27079448d130ae1ed0ea34
|
||||||
- enabled: 1
|
|
||||||
path: Assets/Scenes/TestVideoPlay.unity
|
|
||||||
guid: b5f405e85b6fce54eb64e445b8a7997f
|
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user