After many rewrites and much debugging, video syncing finally works properly.
This commit is contained in:
parent
0b3fc5c08b
commit
1aebaeef76
@ -83724,7 +83724,6 @@ MonoBehaviour:
|
|||||||
PrefabModifications: []
|
PrefabModifications: []
|
||||||
SerializationNodes: []
|
SerializationNodes: []
|
||||||
_udonSharpBackingUdonBehaviour: {fileID: 2057791819}
|
_udonSharpBackingUdonBehaviour: {fileID: 2057791819}
|
||||||
_GameManager: {fileID: 515404446}
|
|
||||||
_VideoPlayer: {fileID: 2057791821}
|
_VideoPlayer: {fileID: 2057791821}
|
||||||
_BlankScreenMesh: {fileID: 1123331149}
|
_BlankScreenMesh: {fileID: 1123331149}
|
||||||
_VideoScreenMesh: {fileID: 1123331146}
|
_VideoScreenMesh: {fileID: 1123331146}
|
||||||
@ -94312,12 +94311,16 @@ MonoBehaviour:
|
|||||||
- {fileID: 2100000, guid: 0c3dfdcd7a2a6ac408ec3d431f9a4932, type: 2}
|
- {fileID: 2100000, guid: 0c3dfdcd7a2a6ac408ec3d431f9a4932, type: 2}
|
||||||
- {fileID: 2100000, guid: accd304c49b7d6d43b97738e8e118342, type: 2}
|
- {fileID: 2100000, guid: accd304c49b7d6d43b97738e8e118342, type: 2}
|
||||||
- {fileID: 2100000, guid: 2c0cd617d97924748a9d5e2eeb2039b5, type: 2}
|
- {fileID: 2100000, guid: 2c0cd617d97924748a9d5e2eeb2039b5, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 672c36f6dbb36b5439cc0fdd2f74c531, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 51b03d257a738e6468f623865f31dbec, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 12e96dbe16f21704485645506bfc235a, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 98b5c6e030fc83d48bbba9e927a456d4, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 79cdc811085b366438fb60b12a3642ba, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 4fb0b8cdca56f5d47be970c7490cb7a1, type: 2}
|
||||||
- {fileID: 2100000, guid: af0c1cbaaffed304ba0e3a1fbac41e7e, type: 2}
|
- {fileID: 2100000, guid: af0c1cbaaffed304ba0e3a1fbac41e7e, type: 2}
|
||||||
- {fileID: 2100000, guid: cc22c7f9de95cab4488b30fe8699a82a, type: 2}
|
- {fileID: 2100000, guid: cc22c7f9de95cab4488b30fe8699a82a, type: 2}
|
||||||
- {fileID: 2100000, guid: fe872fb72ad98da4dbb868481468e848, type: 2}
|
- {fileID: 2100000, guid: fe872fb72ad98da4dbb868481468e848, type: 2}
|
||||||
- {fileID: 2100000, guid: 4fb0b8cdca56f5d47be970c7490cb7a1, type: 2}
|
- {fileID: 2100000, guid: d7188495ea0838346af40c820ec9ffc8, type: 2}
|
||||||
- {fileID: 2100000, guid: d1244b908a4cccd4397cc9cad45fe846, type: 2}
|
|
||||||
- {fileID: 2100000, guid: e53b90b5a4f1c3048b28024a40b455e7, type: 2}
|
|
||||||
- {fileID: 2100000, guid: 4de84333504452948874f4422dec7b56, type: 2}
|
- {fileID: 2100000, guid: 4de84333504452948874f4422dec7b56, type: 2}
|
||||||
- {fileID: 2100000, guid: 97a375a2664a65f44a74b8e0711591fb, type: 2}
|
- {fileID: 2100000, guid: 97a375a2664a65f44a74b8e0711591fb, type: 2}
|
||||||
- {fileID: 2100000, guid: 9cdc0250a4c9b534fae68ae6aa90bf31, type: 2}
|
- {fileID: 2100000, guid: 9cdc0250a4c9b534fae68ae6aa90bf31, type: 2}
|
||||||
@ -94326,42 +94329,38 @@ MonoBehaviour:
|
|||||||
- {fileID: 2100000, guid: ea08301eace4f164bb3aae930413a978, type: 2}
|
- {fileID: 2100000, guid: ea08301eace4f164bb3aae930413a978, type: 2}
|
||||||
- {fileID: 2100000, guid: 6dd6b8b1c8133f04dbc23ac81f5dfded, type: 2}
|
- {fileID: 2100000, guid: 6dd6b8b1c8133f04dbc23ac81f5dfded, type: 2}
|
||||||
- {fileID: 2100000, guid: c3186340e03d26341969d34663dbf8f3, type: 2}
|
- {fileID: 2100000, guid: c3186340e03d26341969d34663dbf8f3, type: 2}
|
||||||
|
- {fileID: 2100000, guid: bc5888e576e9cb34bab7b7af42d2b63f, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 1eb2f964062497347b887d2c940e79c5, type: 2}
|
||||||
- {fileID: 2100000, guid: 012e77fb6a6d69548802da3b41814618, type: 2}
|
- {fileID: 2100000, guid: 012e77fb6a6d69548802da3b41814618, type: 2}
|
||||||
- {fileID: 2100000, guid: 4d875a76d6e247742b8d3d66214b2c2d, type: 2}
|
- {fileID: 2100000, guid: 4d875a76d6e247742b8d3d66214b2c2d, type: 2}
|
||||||
- {fileID: 2100000, guid: 12e96dbe16f21704485645506bfc235a, type: 2}
|
|
||||||
- {fileID: 2100000, guid: 8db36ece14c543d47be04e1d0cde1a1f, type: 2}
|
- {fileID: 2100000, guid: 8db36ece14c543d47be04e1d0cde1a1f, type: 2}
|
||||||
- {fileID: 2100000, guid: 77485a45419b5da498cc74acff31c49a, type: 2}
|
- {fileID: 2100000, guid: 77485a45419b5da498cc74acff31c49a, type: 2}
|
||||||
- {fileID: 2100000, guid: d2b3854a83244764192826cd7eadc955, type: 2}
|
- {fileID: 2100000, guid: d2b3854a83244764192826cd7eadc955, type: 2}
|
||||||
- {fileID: 2100000, guid: 8de5e47a4e3831b40b59595ad3e2e267, type: 2}
|
- {fileID: 2100000, guid: 8de5e47a4e3831b40b59595ad3e2e267, type: 2}
|
||||||
- {fileID: 2100000, guid: d23dd47c26278f94ea3bc15c730f59ed, type: 2}
|
- {fileID: 2100000, guid: d23dd47c26278f94ea3bc15c730f59ed, type: 2}
|
||||||
- {fileID: 2100000, guid: 77cb94791cc41a5498279122022730b0, type: 2}
|
- {fileID: 2100000, guid: 77cb94791cc41a5498279122022730b0, type: 2}
|
||||||
- {fileID: 2100000, guid: 98b5c6e030fc83d48bbba9e927a456d4, type: 2}
|
|
||||||
- {fileID: 2100000, guid: c0998459c7ac0e94d825035839d01ac9, type: 2}
|
- {fileID: 2100000, guid: c0998459c7ac0e94d825035839d01ac9, type: 2}
|
||||||
- {fileID: 2100000, guid: fa8f228d6d5f77d479bf970e355f4bc3, type: 2}
|
- {fileID: 2100000, guid: fa8f228d6d5f77d479bf970e355f4bc3, type: 2}
|
||||||
- {fileID: 2100000, guid: 90a6fdf8f72a7a84d83dcb448e0f749e, type: 2}
|
- {fileID: 2100000, guid: 90a6fdf8f72a7a84d83dcb448e0f749e, type: 2}
|
||||||
- {fileID: 2100000, guid: 6075d345a5007be4abb1a4485d1ebb5f, type: 2}
|
- {fileID: 2100000, guid: 6075d345a5007be4abb1a4485d1ebb5f, type: 2}
|
||||||
- {fileID: 2100000, guid: d7188495ea0838346af40c820ec9ffc8, type: 2}
|
|
||||||
- {fileID: 2100000, guid: 79cdc811085b366438fb60b12a3642ba, type: 2}
|
|
||||||
- {fileID: 2100000, guid: ffd504a9168a01c459170bb8f2fcea1c, type: 2}
|
- {fileID: 2100000, guid: ffd504a9168a01c459170bb8f2fcea1c, type: 2}
|
||||||
- {fileID: 2100000, guid: 98166ed003d332e488319f662c3b4429, type: 2}
|
- {fileID: 2100000, guid: 98166ed003d332e488319f662c3b4429, type: 2}
|
||||||
- {fileID: 2100000, guid: c5d2a6b0c3904c747b937dd142cbb480, type: 2}
|
- {fileID: 2100000, guid: c5d2a6b0c3904c747b937dd142cbb480, type: 2}
|
||||||
|
- {fileID: 2100000, guid: d1244b908a4cccd4397cc9cad45fe846, type: 2}
|
||||||
- {fileID: 2100000, guid: 53b84df3db050264db8132d12d59ac74, type: 2}
|
- {fileID: 2100000, guid: 53b84df3db050264db8132d12d59ac74, type: 2}
|
||||||
|
- {fileID: 2100000, guid: e53b90b5a4f1c3048b28024a40b455e7, type: 2}
|
||||||
- {fileID: 2100000, guid: 9d4baac78c2042b47b42fc9c92d87767, type: 2}
|
- {fileID: 2100000, guid: 9d4baac78c2042b47b42fc9c92d87767, type: 2}
|
||||||
- {fileID: 2100000, guid: db9b2b735115eb248a189b1fdc721a50, type: 2}
|
- {fileID: 2100000, guid: db9b2b735115eb248a189b1fdc721a50, type: 2}
|
||||||
- {fileID: 2100000, guid: cc8e36941dd3f2c42a157650e05b9242, type: 2}
|
- {fileID: 2100000, guid: cc8e36941dd3f2c42a157650e05b9242, type: 2}
|
||||||
- {fileID: 2100000, guid: 885429151ec5f6a4a926f6aaabd7e001, type: 2}
|
|
||||||
- {fileID: 2100000, guid: 348ff3cc54305654d9eeebbbb385c262, type: 2}
|
- {fileID: 2100000, guid: 348ff3cc54305654d9eeebbbb385c262, type: 2}
|
||||||
- {fileID: 2100000, guid: a94d8fe1854504e47a64e023cecaa130, type: 2}
|
- {fileID: 2100000, guid: a94d8fe1854504e47a64e023cecaa130, type: 2}
|
||||||
- {fileID: 2100000, guid: 51b03d257a738e6468f623865f31dbec, type: 2}
|
|
||||||
- {fileID: 2100000, guid: e45d02bbf7268504ca58513c548a58e7, type: 2}
|
- {fileID: 2100000, guid: e45d02bbf7268504ca58513c548a58e7, type: 2}
|
||||||
- {fileID: 2100000, guid: 35c2a316ece610b4b963e047e5238337, type: 2}
|
|
||||||
- {fileID: 2100000, guid: 1eb2f964062497347b887d2c940e79c5, type: 2}
|
|
||||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
- {fileID: 2100000, guid: 672c36f6dbb36b5439cc0fdd2f74c531, type: 2}
|
|
||||||
- {fileID: 2100000, guid: bc5888e576e9cb34bab7b7af42d2b63f, type: 2}
|
|
||||||
- {fileID: 2100000, guid: cac39def7281c5c488b6a3465ec1951b, type: 2}
|
- {fileID: 2100000, guid: cac39def7281c5c488b6a3465ec1951b, type: 2}
|
||||||
- {fileID: 2100000, guid: 80746b095abb6ce41a1c737df3649172, type: 2}
|
- {fileID: 2100000, guid: 80746b095abb6ce41a1c737df3649172, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 885429151ec5f6a4a926f6aaabd7e001, type: 2}
|
||||||
- {fileID: 2100000, guid: 332daba92d0976f4d86bdcdc1a94179e, type: 2}
|
- {fileID: 2100000, guid: 332daba92d0976f4d86bdcdc1a94179e, type: 2}
|
||||||
|
- {fileID: 2100000, guid: 35c2a316ece610b4b963e047e5238337, type: 2}
|
||||||
- {fileID: 2100000, guid: dba163de40c568b48ae2ffa7c83c66b9, type: 2}
|
- {fileID: 2100000, guid: dba163de40c568b48ae2ffa7c83c66b9, type: 2}
|
||||||
- {fileID: 2100000, guid: 483ceb65615010745bde1d5ff9fd9dd6, type: 2}
|
- {fileID: 2100000, guid: 483ceb65615010745bde1d5ff9fd9dd6, type: 2}
|
||||||
- {fileID: 2100000, guid: c10453b4aa0c864458b74f3797cb611e, type: 2}
|
- {fileID: 2100000, guid: c10453b4aa0c864458b74f3797cb611e, type: 2}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using UdonSharp;
|
using UdonSharp;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Components.Video;
|
using VRC.SDK3.Components.Video;
|
||||||
@ -22,10 +21,7 @@ public enum ClueScreenType
|
|||||||
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
||||||
public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private GameManagerRound1 _GameManager;
|
|
||||||
|
|
||||||
[SerializeField] private BaseVRCVideoPlayer _VideoPlayer;
|
[SerializeField] private BaseVRCVideoPlayer _VideoPlayer;
|
||||||
//[SerializeField] private float _SyncFrequency = 5.0f;
|
|
||||||
|
|
||||||
[Header("Meshes")]
|
[Header("Meshes")]
|
||||||
[SerializeField] private MeshRenderer _BlankScreenMesh;
|
[SerializeField] private MeshRenderer _BlankScreenMesh;
|
||||||
@ -43,8 +39,8 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
[UdonSynced, FieldChangeCallback(nameof(ShowScreen))] private ClueScreenType _ShowScreen = ClueScreenType.Blank;
|
[UdonSynced, FieldChangeCallback(nameof(ShowScreen))] private ClueScreenType _ShowScreen = ClueScreenType.Blank;
|
||||||
[UdonSynced, FieldChangeCallback(nameof(FlashCorrectAnswer))] private bool _FlashCorrectAnswer = false;
|
[UdonSynced, FieldChangeCallback(nameof(FlashCorrectAnswer))] private bool _FlashCorrectAnswer = false;
|
||||||
|
|
||||||
[UdonSynced, FieldChangeCallback(nameof(VideoIndex))] private int _VideoIndex = -1;
|
[UdonSynced] private int _VideoIndex = -1;
|
||||||
[UdonSynced, FieldChangeCallback(nameof(TimeAndOffset))] private Vector2 _TimeAndOffset;
|
private int _OldVideoIndex = -1;
|
||||||
|
|
||||||
[UdonSynced, FieldChangeCallback(nameof(PlayVideo))] private bool _VideoIsPlaying;
|
[UdonSynced, FieldChangeCallback(nameof(PlayVideo))] private bool _VideoIsPlaying;
|
||||||
|
|
||||||
@ -66,6 +62,8 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
private int _VideoLoadAttemptCounter = 0;
|
private int _VideoLoadAttemptCounter = 0;
|
||||||
private bool _UseFallback = false;
|
private bool _UseFallback = false;
|
||||||
|
|
||||||
|
private bool _FirstDeserialisationComplete = false;
|
||||||
|
|
||||||
private const int IMAGES_PER_MAP_ATLAS = 6;
|
private const int IMAGES_PER_MAP_ATLAS = 6;
|
||||||
private const int MAX_VIDEO_LOAD_ATTEMPTS = 5;
|
private const int MAX_VIDEO_LOAD_ATTEMPTS = 5;
|
||||||
|
|
||||||
@ -77,7 +75,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
|
|
||||||
_MapScreenMesh.sharedMaterial = _MapScreenMaterial;
|
_MapScreenMesh.sharedMaterial = _MapScreenMaterial;
|
||||||
|
|
||||||
UpdateMap(false);
|
_UpdateMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
@ -90,11 +88,8 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
{ // Map syncing and redownloading
|
{ // Map syncing and redownloading
|
||||||
_ReloadMapList();
|
_ReloadMapList();
|
||||||
|
|
||||||
if (_MapDownloadsInProgress)
|
if (!_MapDownloadsInProgress)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MapsNeedLoading = false;
|
bool MapsNeedLoading = false;
|
||||||
if (_LoadedMaps.Length == _CachedMapIndices.Length)
|
if (_LoadedMaps.Length == _CachedMapIndices.Length)
|
||||||
{
|
{
|
||||||
@ -117,15 +112,16 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
QueueMapDownloads(_CachedMapIndices);
|
QueueMapDownloads(_CachedMapIndices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{ // Video syncing and redownloading
|
{ // Video list syncing
|
||||||
_ReloadVideoList();
|
_ReloadVideoList();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnDeserialization(Result);
|
base.OnDeserialization(Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNewLists(VRCUrl[] Maps, VRCUrl[] Videos)
|
public void InitialiseLists(VRCUrl[] Maps, VRCUrl[] Videos)
|
||||||
{
|
{
|
||||||
_CaseMapsList = Maps;
|
_CaseMapsList = Maps;
|
||||||
_ReloadMapList();
|
_ReloadMapList();
|
||||||
@ -148,8 +144,13 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
{
|
{
|
||||||
if (_IsUrlListDifferent(_CaseVideoList, _CaseVideoListCache))
|
if (_IsUrlListDifferent(_CaseVideoList, _CaseVideoListCache))
|
||||||
{
|
{
|
||||||
|
_OldVideoIndex = -1;
|
||||||
_CaseVideoListCache = (VRCUrl[])_CaseVideoList.Clone();
|
_CaseVideoListCache = (VRCUrl[])_CaseVideoList.Clone();
|
||||||
_GameManager.TryIntroVideoLoad();
|
}
|
||||||
|
|
||||||
|
if (_VideoIndex != _OldVideoIndex)
|
||||||
|
{
|
||||||
|
_LoadNewVideoIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +209,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
int MapPage = SubMapIndex / IMAGES_PER_MAP_ATLAS;
|
int MapPage = SubMapIndex / IMAGES_PER_MAP_ATLAS;
|
||||||
if (MapPage == _MapDownloadIndex)
|
if (MapPage == _MapDownloadIndex)
|
||||||
{
|
{
|
||||||
_MapScreenMaterial.SetTexture("_EmissionMap", _MapImages[MapPage]);
|
_UpdateSubMap(MapPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
_MapDownloadIndex++;
|
_MapDownloadIndex++;
|
||||||
@ -235,7 +236,10 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
{
|
{
|
||||||
if (FlashCorrectAnswer)
|
if (FlashCorrectAnswer)
|
||||||
{
|
{
|
||||||
|
Debug.Log("[CaseVideoSyncPlayer] Flashing correct answer.");
|
||||||
SubMapIndex = (SubMapIndex == 4) ? 3 : 4;
|
SubMapIndex = (SubMapIndex == 4) ? 3 : 4;
|
||||||
|
Debug.Log("[CaseVideoSyncPlayer] New submap is " + SubMapIndex);
|
||||||
|
_UpdateMap(false);
|
||||||
SendCustomEventDelayedSeconds(nameof(NextCorrectAnswerFrame), 0.2f);
|
SendCustomEventDelayedSeconds(nameof(NextCorrectAnswerFrame), 0.2f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -248,13 +252,28 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMap(bool SyncResult = true)
|
private void _UpdateMap(bool Sync = true)
|
||||||
{
|
{
|
||||||
|
Debug.Log("[CaseVideoSyncPlayer] Now inside _UpdateMap()");
|
||||||
int MapPage = SubMapIndex / IMAGES_PER_MAP_ATLAS;
|
int MapPage = SubMapIndex / IMAGES_PER_MAP_ATLAS;
|
||||||
int SubmapIndexWrapped = SubMapIndex % IMAGES_PER_MAP_ATLAS;
|
Debug.Log("[CaseVideoSyncPlayer] Map page: " + MapPage);
|
||||||
|
|
||||||
if (MapPage < _MapImages.Length)
|
if (MapPage < _MapImages.Length)
|
||||||
{
|
{
|
||||||
|
Debug.Log("[CaseVideoSyncPlayer] Updating submap.");
|
||||||
|
_UpdateSubMap(MapPage);
|
||||||
|
ShowScreen = ClueScreenType.Map;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Sync)
|
||||||
|
{
|
||||||
|
RequestSerialization();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void _UpdateSubMap(int MapPage = -1)
|
||||||
|
{
|
||||||
|
Debug.Log("[CaseVideoSyncPlayer] Now inside _UpdateSubMap()");
|
||||||
|
int SubmapIndexWrapped = SubMapIndex % IMAGES_PER_MAP_ATLAS;
|
||||||
|
Debug.Log("[CaseVideoSyncPlayer] Wrapped submap index: " + SubmapIndexWrapped);
|
||||||
switch (SubmapIndexWrapped)
|
switch (SubmapIndexWrapped)
|
||||||
{
|
{
|
||||||
case 0: _MapScreenMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.66666666f)); break;
|
case 0: _MapScreenMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.0f, 0.66666666f)); break;
|
||||||
@ -265,27 +284,30 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
case 5: _MapScreenMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.0f)); break;
|
case 5: _MapScreenMaterial.SetVector("_MainTex_ST", new Vector4(0.5f, 0.33333333f, 0.5f, 0.0f)); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_MapScreenMaterial.SetTexture("_EmissionMap", _MapImages[MapPage]);
|
if (MapPage >= 0)
|
||||||
ShowScreen = ClueScreenType.Map;
|
|
||||||
|
|
||||||
if (SyncResult)
|
|
||||||
{
|
{
|
||||||
|
_MapScreenMaterial.SetTexture("_EmissionMap", _MapImages[MapPage]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SetVideoIndex(int Index)
|
||||||
|
{
|
||||||
|
if (Index != _OldVideoIndex)
|
||||||
|
{
|
||||||
|
_VideoIndex = Index;
|
||||||
|
_LoadNewVideoIndex();
|
||||||
RequestSerialization();
|
RequestSerialization();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
private void _LoadNewVideoIndex()
|
||||||
|
|
||||||
|
|
||||||
public void SetVideoIndexLocal(int Index)
|
|
||||||
{
|
{
|
||||||
_VideoIndex = Index;
|
_OldVideoIndex = _VideoIndex;
|
||||||
_VideoLoadAttemptCounter = 0;
|
_VideoLoadAttemptCounter = 0;
|
||||||
if (_VideoIndex >= 0)
|
|
||||||
{
|
|
||||||
_UseFallback = false;
|
_UseFallback = false;
|
||||||
_LoadVideo_Private();
|
_LoadVideo_Private();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void _LoadVideo_Private()
|
private void _LoadVideo_Private()
|
||||||
{
|
{
|
||||||
@ -293,27 +315,11 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
}
|
}
|
||||||
public void TryLoadURL()
|
public void TryLoadURL()
|
||||||
{
|
{
|
||||||
if (VideoIndex >= 0 && VideoIndex < _CaseVideoList.Length)
|
if (_VideoIndex >= 0 && _VideoIndex < _CaseVideoList.Length)
|
||||||
{
|
{
|
||||||
_VideoPlayer.LoadURL(_CaseVideoList[VideoIndex]);
|
_VideoPlayer.LoadURL(_CaseVideoList[_VideoIndex]);
|
||||||
SetVideoLoadStatus(IndicationStatus.Loading);
|
SetVideoLoadStatus(IndicationStatus.Loading);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_VideoLoadAttemptCounter >= MAX_VIDEO_LOAD_ATTEMPTS)
|
|
||||||
{
|
|
||||||
Debug.LogError("[CaseVideoSyncPlayer] Index " + VideoIndex + " is out of range. Out of retry attempts. Something is wrong.");
|
|
||||||
SetVideoLoadStatus(IndicationStatus.LoadFailure);
|
|
||||||
_VideoLoadAttemptCounter = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning("[CaseVideoSyncPlayer] Index " + VideoIndex + " is out of range. Checking range again in 1 second...");
|
|
||||||
SetVideoLoadStatus(IndicationStatus.Loading);
|
|
||||||
_VideoLoadAttemptCounter++;
|
|
||||||
SendCustomEventDelayedSeconds(nameof(TryLoadURL), 1.1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _PlayVideo_Private()
|
private void _PlayVideo_Private()
|
||||||
@ -325,7 +331,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
{
|
{
|
||||||
_VideoPlayer.Stop();
|
_VideoPlayer.Stop();
|
||||||
_UseFallback = false;
|
_UseFallback = false;
|
||||||
VideoIndex = -1;
|
_VideoIndex = -1;
|
||||||
|
|
||||||
SetVideoLoadStatus(IndicationStatus.Idle);
|
SetVideoLoadStatus(IndicationStatus.Idle);
|
||||||
}
|
}
|
||||||
@ -374,7 +380,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
// SendCustomEventDelayedSeconds(nameof(TryLoadFallbackURL), 5.5f);
|
// SendCustomEventDelayedSeconds(nameof(TryLoadFallbackURL), 5.5f);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//SetVideoLoadStatus(IndicationStatus.LoadFailure);
|
SetVideoLoadStatus(IndicationStatus.LoadFailure);
|
||||||
|
|
||||||
base.OnVideoError(VideoError);
|
base.OnVideoError(VideoError);
|
||||||
}
|
}
|
||||||
@ -400,7 +406,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
if (_VideoIsPlaying)
|
if (_VideoIsPlaying)
|
||||||
{
|
{
|
||||||
ShowScreen = ClueScreenType.Video;
|
ShowScreen = ClueScreenType.Video;
|
||||||
//UpdateTimeAndOffset();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -415,8 +420,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
PlayVideo = false;
|
PlayVideo = false;
|
||||||
ShowScreen = ClueScreenType.Blank;
|
ShowScreen = ClueScreenType.Blank;
|
||||||
|
|
||||||
RequestSerialization();
|
|
||||||
|
|
||||||
base.OnVideoEnd();
|
base.OnVideoEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,30 +434,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void UpdateTimeAndOffset()
|
|
||||||
//{
|
|
||||||
// if (Networking.IsOwner(gameObject))
|
|
||||||
// {
|
|
||||||
// TimeAndOffset = new Vector2(_VideoPlayer.GetTime(), (float)Networking.GetServerTimeInSeconds());
|
|
||||||
|
|
||||||
// if (_SyncFrequency > 0.0f)
|
|
||||||
// {
|
|
||||||
// SendCustomEventDelayedSeconds(nameof(UpdateTimeAndOffset), _SyncFrequency);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// Resync();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// RequestSerialization();
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void Resync()
|
|
||||||
{
|
|
||||||
_VideoPlayer.SetTime(TimeAndOffset.x + ((float)Networking.GetServerTimeInSeconds() - TimeAndOffset.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[NetworkCallable]
|
[NetworkCallable]
|
||||||
public void ClearScreen()
|
public void ClearScreen()
|
||||||
@ -496,8 +475,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestSerialization();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _IsUrlListDifferent(VRCUrl[] New, VRCUrl[] Cached)
|
private bool _IsUrlListDifferent(VRCUrl[] New, VRCUrl[] Cached)
|
||||||
@ -526,9 +503,9 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_SubMapIndex = value;
|
_SubMapIndex = value;
|
||||||
if (_SubMapIndex >= 0)
|
if (_SubMapIndex >= 0 && !FlashCorrectAnswer)
|
||||||
{
|
{
|
||||||
UpdateMap(!FlashCorrectAnswer);
|
_UpdateMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get => _SubMapIndex;
|
get => _SubMapIndex;
|
||||||
@ -555,19 +532,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
get => _FlashCorrectAnswer;
|
get => _FlashCorrectAnswer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int VideoIndex
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_VideoIndex != value)
|
|
||||||
{
|
|
||||||
SetVideoIndexLocal(value);
|
|
||||||
RequestSerialization();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get => _VideoIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool PlayVideo
|
public bool PlayVideo
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -576,17 +540,4 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
}
|
}
|
||||||
get => _VideoIsPlaying;
|
get => _VideoIsPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 TimeAndOffset
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_TimeAndOffset = value;
|
|
||||||
if (!Networking.IsOwner(gameObject))
|
|
||||||
{
|
|
||||||
Resync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get => _TimeAndOffset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,8 +116,6 @@ public class CaseManager : UdonSharpBehaviour
|
|||||||
_CaseFileVideosFallback = CaseFile.FallbackVideoFiles;
|
_CaseFileVideosFallback = CaseFile.FallbackVideoFiles;
|
||||||
_CaseFileClueImages = CaseFile.ClueImages;
|
_CaseFileClueImages = CaseFile.ClueImages;
|
||||||
|
|
||||||
_Round1Manager.SetNewVideoPlayerLists(_CaseFileMaps, _CaseFileVideos);
|
|
||||||
|
|
||||||
VRCStringDownloader.LoadUrl(_CaseFileCluesURL, (IUdonEventReceiver)this);
|
VRCStringDownloader.LoadUrl(_CaseFileCluesURL, (IUdonEventReceiver)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,6 +266,10 @@ public class CaseManager : UdonSharpBehaviour
|
|||||||
return CrookToString(_AccusedCrook);
|
return CrookToString(_AccusedCrook);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VRCUrl[] GetMaps()
|
||||||
|
{
|
||||||
|
return _CaseFileMaps;
|
||||||
|
}
|
||||||
public VRCUrl GetMap(int MapIndex)
|
public VRCUrl GetMap(int MapIndex)
|
||||||
{
|
{
|
||||||
return _CaseFileMaps[MapIndex];
|
return _CaseFileMaps[MapIndex];
|
||||||
@ -282,6 +284,10 @@ public class CaseManager : UdonSharpBehaviour
|
|||||||
return _CaseFileLootImage;
|
return _CaseFileLootImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VRCUrl[] GetVideos()
|
||||||
|
{
|
||||||
|
return _CaseFileVideos;
|
||||||
|
}
|
||||||
public int GetIntroVideo()
|
public int GetIntroVideo()
|
||||||
{
|
{
|
||||||
return _CaseIntroVideo;
|
return _CaseIntroVideo;
|
||||||
|
|||||||
@ -140,25 +140,9 @@ public class GameManagerRound1 : GameManagerBase
|
|||||||
Interface.CommentUI.text = _CaseManager.GetCaseDescription();
|
Interface.CommentUI.text = _CaseManager.GetCaseDescription();
|
||||||
|
|
||||||
_GameHasBegun = false;
|
_GameHasBegun = false;
|
||||||
}
|
|
||||||
|
|
||||||
|
_VideoPlayer.InitialiseLists(_CaseManager.GetMaps(), _CaseManager.GetVideos());
|
||||||
public void SetNewVideoPlayerLists(VRCUrl[] Maps, VRCUrl[] Videos)
|
_VideoPlayer.SetVideoIndex(_CaseManager.GetIntroVideo());
|
||||||
{
|
|
||||||
_VideoPlayer.SetNewLists(Maps, Videos);
|
|
||||||
}
|
|
||||||
public void TryIntroVideoLoad()
|
|
||||||
{
|
|
||||||
int IntroVideoIndex = _CaseManager.GetIntroVideo();
|
|
||||||
if (IntroVideoIndex >= 0)
|
|
||||||
{
|
|
||||||
_VideoPlayer.SetVideoIndexLocal(IntroVideoIndex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning("[GameManagerRound1] Intro video index is currently invalid. Retrying...");
|
|
||||||
SendCustomEventDelayedSeconds(nameof(TryIntroVideoLoad), 1.0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1802,7 +1786,7 @@ public class GameManagerRound1 : GameManagerBase
|
|||||||
if (Presentation.ContainsKey("Videos"))
|
if (Presentation.ContainsKey("Videos"))
|
||||||
{
|
{
|
||||||
DataList Videos = Presentation["Videos"].DataList;
|
DataList Videos = Presentation["Videos"].DataList;
|
||||||
_VideoPlayer.VideoIndex = (int)Videos[_QuestionSubstage].Number;
|
_VideoPlayer.SetVideoIndex((int)Videos[_QuestionSubstage].Number);
|
||||||
|
|
||||||
VideosAvailable = true;
|
VideosAvailable = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user