新版loading逻辑

This commit is contained in:
lishuo committed 2022-12-05 18:29:49 +08:00
1 parent 3c64109090
commit ae58f4d461
367 files changed
+74232 -220035

No files matched your search

-5
View File
@@ -55,16 +55,11 @@ namespace Assets.AR
PositionOffset = Vector3.up * route.CameraHeight * (-1);
Quaternion cameraRotation = this.GetCameraRotation(this.frame - this.FrameIndexDistanceCorrection);
Vector3 filteredCameraPosition = this.GetFilteredCameraPosition(this.frame - this.FrameIndexDistanceCorrection);
Debug.Log(FrameIndexDistanceCorrection);
Vector3 vector3 = Vector3.left * (this.route.LeftHanded ? -1f : 1f) * (this.LaneWidth * (this.Lane + this.LaneCamera) - this.BaseOffset);
var targetPos = filteredCameraPosition + cameraRotation * (vector3 + this.PositionOffset);
this.transform.position = targetPos;
this.transform.rotation = cameraRotation * Quaternion.Euler(this.RotationOffset) * Quaternion.Euler(this.Lean);
this.transform.localScale = this.Scale;
var animator = GetComponent<Animator>();
animator.SetFloat("speed", 30);
animator.SetFloat("power", (float)TestPower);
}
}
}
+2 -7
View File
@@ -1,16 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine;
namespace Assets.AR
{
public class ARObject : MonoBehaviour
{
public string Hash;
public const int Layer = 9;
public const int Layer = 1;
public const int TestRidersLayer = 10;
public static float MaxDistanceVisibilityModels = 80f;
public const float VisibilityHidingTime = 0.2f;
+3 -10
View File
@@ -1,5 +1,4 @@
using RenderHeads.Media.AVProVideo;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
@@ -56,12 +55,6 @@ namespace Assets.AR
protected virtual void SetupCamera()
{
//this.camGo = new GameObject("ARCamera");
//this.camGo.transform.parent = this.transform;
//this.UnityCamera = this.camGo.AddComponent<Camera>();
//this.UnityCamera.cullingMask = 512;
//this.UnityCamera.clearFlags = CameraClearFlags.Nothing;
//this.UnityCamera.depth = 1f;
this.UnityCamera = Camera.main;
}
@@ -91,7 +84,7 @@ namespace Assets.AR
}
this.trajectoryObject = new GameObject("TrajectoryMesh");
this.trajectoryObject.transform.parent = this.transform;
this.trajectoryObject.layer = 9;
//this.trajectoryObject.layer = 9;
}
protected virtual void UpdateObjects(
@@ -192,7 +185,7 @@ namespace Assets.AR
{
GameObject trajectory = ARMeshFactory.CreateTrajectory(this.Route, segment, lOffset, rOffset, margin);
trajectory.transform.parent = this.trajectoryObject.transform;
trajectory.layer = 9;
//trajectory.layer = 9;
trajectory.GetComponent<MeshRenderer>().shadowCastingMode = ShadowCastingMode.Off;
trajectory.GetComponent<MeshRenderer>().material = this.GetTrajectoryMaterial();
return trajectory;
+1 -3
View File
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Rendering;
namespace Assets
namespace Assets.AR
{
public class ARRoute
{
+59 -2
View File
@@ -1,9 +1,12 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Runtime.Serialization;
using UnityEngine;
namespace Assets
namespace Assets.AR
{
[Serializable]
public class RouteDetailData
@@ -14,6 +17,19 @@ namespace Assets
public List<RouteDetailSplitData> Splits;
public long Record;
public long UserRecord;
public static RouteDetailData LoadFromFile(string path)
{
JsonSerializer jsonSerializer = new JsonSerializer();
jsonSerializer.Converters.Add((JsonConverter)new VectorDataConverter());
using (FileStream fileStream = File.Open(path, FileMode.Open))
{
using (StreamReader reader1 = new StreamReader(fileStream))
{
using (JsonTextReader reader2 = new JsonTextReader((TextReader)reader1))
return jsonSerializer.Deserialize<RouteDetailData>((JsonReader)reader2);
}
}
}
}
public class RouteDetailSplitData
@@ -134,6 +150,47 @@ namespace Assets
public ARObjectData[] Objects;
public ARPanoramaData[] Panoramas;
public ARPanoramaData[] Panoramas20;
public byte[] SaveToByteData() => EncoderUtils.ToGzipBytes(JsonConvert.SerializeObject((object)this));
public static ARData LoadFromByteData(byte[] data) => JsonUtility.FromJson<ARData>(EncoderUtils.UncompressGzipToString(data));
public static ARData LoadFromFile(string path)
{
JsonSerializer jsonSerializer = new JsonSerializer();
jsonSerializer.Converters.Add((JsonConverter)new VectorDataConverter());
using (FileStream fileStream = File.Open(path, FileMode.Open))
{
using (StreamReader reader1 = new StreamReader((Stream)fileStream))
{
using (JsonTextReader reader2 = new JsonTextReader((TextReader)reader1))
return jsonSerializer.Deserialize<ARData>((JsonReader)reader2);
}
}
}
}
public class VectorDataConverter : JsonConverter
{
public override bool CanConvert(Type objectType) => objectType == typeof(VectorData);
public override object ReadJson(
JsonReader reader,
Type objectType,
object existingValue,
JsonSerializer serializer)
{
VectorData vectorData = new VectorData();
reader.Read();
vectorData.x = (float)reader.ReadAsDouble().Value;
reader.Read();
vectorData.y = (float)reader.ReadAsDouble().Value;
reader.Read();
vectorData.z = (float)reader.ReadAsDouble().Value;
reader.Read();
return (object)vectorData;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) => throw new NotImplementedException();
}
[Serializable]
+381
View File
@@ -0,0 +1,381 @@
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using RenderHeads.Media.AVProVideo;
using Assets.Scripts.Scenes.VideoRide;
using Assets.Core;
namespace Assets.AR
{
public class ARTrainingController : ARLaneObjectsController
{
public MediaPlayer mediaPlayer;
private ARData aRData;
private RouteDetailData detail;
private VideoPointsSync videoPointsSync;
private int index = 1;
private readonly List<ARLaneObject> collisionList = new List<ARLaneObject>();
VideoPlayerControl VideoPlayerControl;
ARLaneObject[] rides;
public ARLaneObject mainObject { get; set; }
private Light arLight;
private Light arBackLight;
public RiderCameraDistance RiderCameraDistance { get; set; }
public VideoControlMode VideoControlMode { get; private set; }
private float autoCameraSwitchTimeCounter = 80f;
float timers = 1f;
double weight = 70;
double bikeWeight = 20;
private VideoGameManager manager;
protected override void Start()
{
base.Start();
this.arObjects.Clear();
manager = GetComponent<VideoGameManager>();
}
public void Initialize(ARData arData, RouteDetailData routeDetailData)
{
//ar数据加载本地,本地没有就下载
//var txt = Resources.Load<TextAsset>("UI/93824").text;
//var route = Resources.Load<TextAsset>("UI/route-93824").text;
this.aRData = arData; //Newtonsoft.Json.JsonConvert.DeserializeObject<ARData>(txt);
this.detail = routeDetailData;//Newtonsoft.Json.JsonConvert.DeserializeObject<RouteDetailData>(route);
videoPointsSync = new VideoPointsSync(detail.VideoPoints.Select(c => new VideoPoint()
{
Distance = (float)c.Distance,
Time = (float)c.VideoTime
}));
videoSync = videoPointsSync;
this.VideoPlayerControl = new VideoPlayerControl();
this.VideoPlayerControl.VideoSyncSource = videoSync;
this.videoPlayer = new AVProVideoPlayer();
this.videoPlayer.videoPlayer = mediaPlayer;
SetArRoute(new ARRoute(aRData.Route), videoSync, videoPlayer);
this.VideoPlayerControl.VideoFrameOffset = this.Route.VideoFrameOffset;
this.VideoPlayerControl.Route = Route;
this.VideoPlayerControl.SetVideoPlayer(videoPlayer);
rides = FindObjectsOfType<ARLaneObject>();
SetUpLight();
}
protected override void Update()
{
if (!manager.IsStart())
return;
timers -= Time.deltaTime;
while (timers < 0)
{
foreach (var dic in manager.rideObjs)
{
var item = dic.Value;
item.Speed = (float)(dic.Key.Speed/3.6d);
item.DeltaDistance = item.Speed;
item.Route = Route;
item.VideoSync = videoPointsSync;
if(!this.arObjects.Contains(item))
this.arObjects.Add(item);
if (!this.riderObjects.ContainsKey(item.GetInstanceID()))
this.riderObjects.Add(item.GetInstanceID(), item);
}
if (mainObject != null)
{
mainObject.Speed = (float)(manager.CurrentPlayer.Speed / 3.6d);
mainObject.DeltaDistance = mainObject.Speed;
if (!this.riderObjects.ContainsKey(mainObject.GetInstanceID()))
this.riderObjects.Add(mainObject.GetInstanceID(), mainObject);
}
timers += 1f;
}
if (mainObject == null)
{
mainObject = manager.CurrentPlayer.gameObject.GetComponent<RiderRenderer>();
this.arObjects.Add(mainObject);
mainObject.Speed = (float)(manager.CurrentPlayer.Speed / 3.6d);
mainObject.DeltaDistance = mainObject.Speed;
mainObject.Route = Route;
mainObject.VideoSync = videoPointsSync;
if (!this.riderObjects.ContainsKey(mainObject.GetInstanceID()))
this.riderObjects.Add(mainObject.GetInstanceID(), mainObject);
}
foreach (var item in this.riderObjects.Values)
{
item.Distance += item.DeltaDistance * Time.deltaTime;
item.RouteDistance += item.DeltaDistance * Time.deltaTime;
if (item.Distance >= Route.GetTotalDistance())
{
item.IsAtFinish = true;
}
}
this.FrameIndexDistanceCorrection = this.VideoPlayerControl.FrameIndexDistanceCorrection;
//mainObject = manager.CurrentPlayer;
//this.FollowedRiderId = mainObject.Id;
this.UpdateCameraFollowDistance();
VideoPlayerControl.UpdateVideoPlaybackSpeed(mainObject.Speed, mainObject.distance);
base.Update();
this.UpdateRidersVisibility();
this.UpdateRidersLean();
this.UpdateBackLight();
if (Input.GetKeyDown(KeyCode.F))
this.SetVideoControlMode(VideoControlMode.Front);
if (Input.GetKeyDown(KeyCode.P))
this.SetVideoControlMode(VideoControlMode.AutoPanorama);
if (!Input.GetKeyDown(KeyCode.B))
return;
this.SetVideoControlMode(VideoControlMode.Rear);
}
//创建
private void SetUpLight()
{
GameObject gameObject1 = new GameObject("ARLight");
gameObject1.layer = this.gameObject.layer;
gameObject1.transform.SetParent(this.transform);
this.arLight = gameObject1.AddComponent<Light>();
this.arLight.type = LightType.Directional;
this.arLight.transform.rotation = Quaternion.Euler(90f, 0.0f, 0.0f);
//if (this.BuildConfig.IsIOs || this.BuildConfig.IsTvOs)
//{
// this.arLight.shadows = LightShadows.Hard;
// this.arLight.shadowStrength = 0.5f;
//}
//else
{
this.arLight.shadows = LightShadows.Soft;
this.arLight.shadowStrength = 1f;
}
this.arLight.cullingMask = 512;
GameObject gameObject2 = new GameObject("ARBackLight");
gameObject2.layer = this.gameObject.layer;
gameObject2.transform.SetParent(this.transform);
this.arBackLight = gameObject2.AddComponent<Light>();
this.arBackLight.type = LightType.Directional;
this.arBackLight.transform.rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);
this.arBackLight.shadows = LightShadows.None;
this.arBackLight.intensity = 0.5f;
this.arBackLight.cullingMask = 512;
}
//设置video显示模式
public void SetVideoControlMode(VideoControlMode mode)
{
if (mode == this.VideoControlMode)
return;
if (!this.AR360Version)
mode = VideoControlMode.Front;
this.VideoControlMode = mode;
this.autoCameraSwitchTimeCounter = 80f;
if (mode == VideoControlMode.AutoPanorama)
return;
this.videoPlayer.IntendedRear = mode == VideoControlMode.Rear;
}
//更新摄像机的位置
private void UpdateCameraFollowDistance()
{
this.RiderCameraDistance = RiderCameraDistance.Middle;
this.NearViewMode = this.RiderCameraDistance == RiderCameraDistance.Near;
float cameraFollowDistance = GetCameraFollowDistance(this.RiderCameraDistance);
this.VideoPlayerControl.CameraFollowDistance = cameraFollowDistance;
}
//人物是否显示
protected override bool IsArObjectActive(ARObject arObject)
{
bool flag = base.IsArObjectActive(arObject);
if ((UnityEngine.Object)arObject != (UnityEngine.Object)this.mainObject)
return flag;
if ((double)this.VideoPlayerControl.CameraFollowDistance > 0.0 || this.AR360Version)
return flag;
return flag && (double)this.VideoPlayerControl.CameraDistanceError > 5.0;
}
//获取摄像机的位置
public static float GetCameraFollowDistance(RiderCameraDistance distance)
{
switch (distance)
{
case RiderCameraDistance.FirstPerson:
return 0.0f;
case RiderCameraDistance.Near:
return 3f;
case RiderCameraDistance.Middle:
return 5f;
case RiderCameraDistance.Far:
return 10f;
default:
throw new ArgumentException("Unknown rider's camera distance.");
}
}
private void UpdateRidersVisibility()
{
//if (!this.videoPlayer.Initialized)
// return;
//this.UpdateVisibleRiders();
////删除当前道路上应该消失的骑手
//foreach (int num in this.riderObjects.Keys.ToArray<int>())
//{
// if (!this.visibleRiders.ContainsKey(num))
// {
// ARLaneObject riderObject = this.riderObjects[num];
// if (!riderObject.IsAtFinish || (double)riderObject.VisibilityLevel <= 0.0)
// {
// this.DestroyRider(num);
// this.DestroyRiderTitle(num);
// }
// }
//}
////新增应该显示的骑手
//foreach (TrainingARController.VisibleRiderItem visibleRiderItem in this.visibleRiders.Values)
//{
// IRouteRider rider = visibleRiderItem.Rider;
// bool showModel = visibleRiderItem.ShowModel;
// ARLaneObject arLaneObject;
// //二次检查
// if (this.riderObjects.TryGetValue(rider.Id, out arLaneObject))
// {
// if (arLaneObject is BaseRenderer)
// {
// if (!showModel)
// {
// float lane = arLaneObject.Lane;
// this.DestroyRider(rider.Id);
// this.CreateRiderObject(rider, lane);
// }
// }
// else if (showModel)
// {
// float lane = arLaneObject.Lane;
// this.DestroyRider(rider.Id);
// this.CreateRiderModel(rider, lane);
// }
// }
// else
// {
// if (showModel)
// this.CreateRiderModel(rider, visibleRiderItem.Lane);
// else
// this.CreateRiderObject(rider, visibleRiderItem.Lane);
// this.CreateRiderTitleObject(rider);
// }
//}
}
//更新骑手的偏移角度
private void UpdateRidersLean()
{
foreach (ARLaneObject riderObject in this.riderObjects.Values)
{
float num1 = this.Route.GetTrajectoryCurvature(riderObject.Frame) + riderObject.Curvature;
float z1;
if ((double)num1 == 0.0)
{
z1 = 0.0f;
}
else
{
double speed = riderObject.Speed;
float f = 57.29578f * Mathf.Atan((float)(speed * speed * (double)num1 / 9.81));
float num2 = (double)f >= 0.0 ? 1f : -1f;
float num3 = Mathf.Abs(f);
if ((double)num3 > 20.0)
f = (float)((double)Mathf.Atan((float)(((double)num3 - 20.0) / 10.5)) * 10.5 + 20.0) * num2;
float num4 = Mathf.Clamp(f, -35f, 35f);
float z2 = riderObject.Lean.z;
z1 = Mathf.Clamp(num4, z2 - 60f * Time.deltaTime, z2 + 60f * Time.deltaTime);
}
float y = Mathf.Clamp(riderObject.LaneChangingDirection, -6f, 6f);
riderObject.Lean = new Vector3(0.0f, y, z1);
}
}
//更新后背的光线
private void UpdateBackLight()
{
//if (this.SelectedPanorama != null)
//{
// this.arBackLight.transform.position = this.PanoramaCamera.transform.position;
// this.arBackLight.transform.rotation = this.PanoramaCamera.transform.rotation;
//}
//else
{
this.arBackLight.transform.position = this.UnityCamera.transform.position;
this.arBackLight.transform.rotation = this.UnityCamera.transform.rotation;
}
this.arLight.transform.rotation = this.Route.GetLightDirection(this.videoPlayer.CurrentFrame);
this.arLight.shadowStrength = this.Route.GetShadowIntensity(this.videoPlayer.CurrentFrame);
}
protected void LateUpdate() => this.UpdateRiderTitles();
private void UpdateRiderTitles()
{
//foreach (int key in this.riderNameViews.Keys)
//{
// ARLaneObject riderObject = this.riderObjects[key];
// UIRect riderNameView = this.riderNameViews[key];
// RiderValueView riderValueView;
// this.riderValueViews.TryGetValue(key, out riderValueView);
// float num1 = Vector3.Distance(riderObject.transform.position, this.UnityCamera.transform.position);
// if (!riderObject.gameObject.activeSelf || (double)num1 > (double)this.MaximumVisibilityDistance || this.SelectedPanorama == null && (double)num1 < 3.0)
// {
// riderNameView.Active = false;
// if ((UnityEngine.Object)riderValueView != (UnityEngine.Object)null)
// riderValueView.Active = false;
// }
// else
// {
// riderNameView.Active = true;
// if ((UnityEngine.Object)riderValueView != (UnityEngine.Object)null)
// riderValueView.Active = (double)num1 < 30.0;
// float nameViewAlpha = this.GetNameViewAlpha(num1);
// if ((double)nameViewAlpha < 1.0)
// riderNameView.Alpha = nameViewAlpha;
// float t = this.GetValueViewAlpha(num1);
// if ((double)t < 1.0 && (UnityEngine.Object)riderValueView != (UnityEngine.Object)null)
// riderValueView.Alpha = t;
// if (this.sportProfile == SportProfile.Running)
// {
// if ((UnityEngine.Object)riderValueView != (UnityEngine.Object)null)
// riderValueView.Active = false;
// t = 0.0f;
// }
// Vector3 vector3 = 5f * this.uiScale * Mathf.Max(0.1f, this.SelectedPanorama != null ? 1f : this.GetDistanceScale(num1));
// Quaternion rotation = this.UnityCamera.transform.rotation;
// if (this.SelectedPanorama != null)
// {
// rotation = this.PanoramaCamera.transform.rotation;
// }
// else
// {
// if ((double)riderObject.Distance < (double)this.CameraDistance)
// rotation *= Quaternion.Euler(0.0f, 180f, 0.0f);
// if (this.videoPlayer.IsRear)
// rotation *= Quaternion.Euler(0.0f, 180f, 0.0f);
// }
// float num2 = Mathf.Lerp(-0.5f * this.Route.RiderScale, 0.6f * this.Route.RiderScale, Mathf.Clamp01(VTMath.Lerp(ARObject.MaxDistanceVisibilityModels - 5f, 1f, ARObject.MaxDistanceVisibilityModels, 0.0f, num1)));
// float num3 = 14f;
// float num4 = Mathf.Lerp(num2 + vector3.y * (0.5f * riderNameView.Height), num2 + vector3.y * (float)((double)num3 + 0.5 * (double)riderNameView.Height + 5.0), t);
// float num5 = -this.Route.RiderScale * riderObject.PositionOffset.y;
// riderNameView.transform.localScale = vector3;
// riderNameView.transform.position = riderObject.transform.position + rotation * new Vector3(0.0f, num4 + num5, 0.0f);
// riderNameView.transform.rotation = rotation;
// if ((UnityEngine.Object)riderValueView != (UnityEngine.Object)null)
// {
// float num6 = num2 + vector3.y * (0.5f * num3);
// riderValueView.transform.localScale = vector3;
// riderValueView.transform.position = riderObject.transform.position + rotation * new Vector3(0.0f, num6 + num5, 0.0f);
// riderValueView.transform.rotation = rotation;
// }
// }
//}
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 300e4dc5d644157469bca467c586af2e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Assets.AR
private bool interpolate;
private bool useFlow;
private bool pausedByTrainingPause = false;
private bool pausedByPlaybackSpeed;
private bool pausedByPlaybackSpeed = true;
private RenderTexture currentTexture;
private RenderTexture previousTexture;
private bool switchBuffer = true;
+1 -1
View File
@@ -1,7 +1,7 @@
using System;
using UnityEngine;
namespace Assets
namespace Assets.AR
{
public static class Geometry
{
+12 -10
View File
@@ -1,5 +1,5 @@
using System;
using System.Runtime.InteropServices;
using Assets.Core;
using System;
using UnityEngine;
namespace Assets.AR
@@ -32,8 +32,8 @@ namespace Assets.AR
private float PowerWinSum;
private float lastPowerPeak = float.MinValue;
private int powerPeakSum;
private Transform wheelFront;
private Transform wheelRear;
public Transform wheelFront;
public Transform wheelRear;
private float lookTime;
private bool lockIdleAnimations;
@@ -78,14 +78,15 @@ namespace Assets.AR
this.Initialize(male);
this.TimeTrialBike = timeTrialBike;
}
//人物再刚显示的时候计算当前人物的状态
private void OnEnable()
{
if ((UnityEngine.Object)this.animator != (UnityEngine.Object)null)
{
//根据人物当前的属性计算动画状态
animator.SetFloat("speed", (float)Speed);
animator.SetFloat("power", (float)Power);
}
if (!this.LockIdleAnimations)
return;
}
protected override void Start()
@@ -167,13 +168,14 @@ namespace Assets.AR
private void FixedUpdate()
{
//if (this.Paused || (double)this.Speed <= 0.0)
////if (this.Paused || (double)this.Speed <= 0.0)
//if ((double)this.Speed <= 0.0)
// return;
//float angle = (float)VTMath.Clamp(VTMath.Lerp(0.0, 0.0, 1689.3684817282528, 6.5, 360.0 * ((double)this.Speed < 10.0 ? (double)this.Speed : 2.3463451135114624)), 0.0, 6.5);
//this.wheelFront.transform.Rotate(Vector3.right, angle);
//this.wheelRear.transform.Rotate(Vector3.right, angle);
}
//设置模型
protected override void SetupModels()
{
@@ -183,7 +185,7 @@ namespace Assets.AR
private void PlanNextLook()
{
}
//更新水平
private void UpdateDiffciulityLevel()
{
float num = this.PowerWinSum / 10f;
+1 -14
View File
@@ -2,7 +2,6 @@
using DG.Tweening;
using RenderHeads.Media.AVProVideo;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -142,19 +141,7 @@ namespace Assets.Scripts.Scenes.VideoRide
return;
this.SetVideoControlMode(VideoControlMode.Rear);
}
private IEnumerator PlayPosition(ARLaneObject aRLaneObject,double prePos, double offset)
{
float t = 0;
while (t <= 1)
{
t += Time.deltaTime * 5f;
double result = prePos + offset * t;
aRLaneObject.distance = (float)result;
aRLaneObject.RouteDistance = (float)result ;
yield return null;
}
}
public VideoControlMode VideoControlMode { get; private set; }
private float autoCameraSwitchTimeCounter = 80f;
public void SetVideoControlMode(VideoControlMode mode)
+1 -1
View File
@@ -154,7 +154,7 @@ namespace Assets.AR
var ratio = ((double)num5 != 0.0 ? speed / num5 : 0.0f);
var deltaRatio = (float)(((double)frame - ((double)this.VideoPlayer.CurrentFrame - (double)this.VideoFrameOffset)) / 2.0) / this.VideoPlayer.FrameRate;
float playbackSpeed = Mathf.Clamp(ratio + deltaRatio, 0.0f, 1.8f);
Debug.Log(playbackSpeed);
//Debug.Log(playbackSpeed);
if ((double)playbackSpeed == (double)this.VideoPlayer.PlaybackSpeed || !this.VideoPlayer.SetPlaybackSpeed(playbackSpeed))
return;
this.lastPlaybackSpeedChange = DateTime.UtcNow;