Submap index is now properly synced when a player joins mid-clue.
This commit is contained in:
parent
563d44f980
commit
e96941060f
@ -39,7 +39,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
[Header("Video Status")]
|
[Header("Video Status")]
|
||||||
[SerializeField] private VideoLoadIndicator[] _VideoLoadIndicators;
|
[SerializeField] private VideoLoadIndicator[] _VideoLoadIndicators;
|
||||||
|
|
||||||
[UdonSynced, FieldChangeCallback(nameof(SubMapIndex))] private int _SubMapIndex = 0;
|
[UdonSynced, FieldChangeCallback(nameof(SubMapIndex))] private int _SubMapIndex = -1;
|
||||||
[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;
|
||||||
|
|
||||||
@ -114,7 +114,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
|
|
||||||
if (MapsNeedLoading)
|
if (MapsNeedLoading)
|
||||||
{
|
{
|
||||||
Debug.Log("[CaseVideoSyncPlayer] Redownloading old maps...");
|
|
||||||
QueueMapDownloads(_CachedMapIndices);
|
QueueMapDownloads(_CachedMapIndices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,7 +186,6 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
_MapImages[i] = _PlaceholderMapTexture;
|
_MapImages[i] = _PlaceholderMapTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SubMapIndex = 0;
|
|
||||||
_MapDownloadIndex = 0;
|
_MapDownloadIndex = 0;
|
||||||
LoadMapFromIndex(_CachedMapIndices[_MapDownloadIndex]);
|
LoadMapFromIndex(_CachedMapIndices[_MapDownloadIndex]);
|
||||||
}
|
}
|
||||||
@ -210,7 +208,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]);
|
UpdateMap(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_MapDownloadIndex++;
|
_MapDownloadIndex++;
|
||||||
@ -268,10 +266,10 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
_MapScreenMaterial.SetTexture("_EmissionMap", _MapImages[MapPage]);
|
_MapScreenMaterial.SetTexture("_EmissionMap", _MapImages[MapPage]);
|
||||||
ShowScreen = ClueScreenType.Map;
|
|
||||||
|
|
||||||
if (SyncResult)
|
if (SyncResult)
|
||||||
{
|
{
|
||||||
|
ShowScreen = ClueScreenType.Map;
|
||||||
RequestSerialization();
|
RequestSerialization();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,18 +422,12 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
|
|
||||||
public void SetVideoLoadStatus(IndicationStatus Status)
|
public void SetVideoLoadStatus(IndicationStatus Status)
|
||||||
{
|
{
|
||||||
//Debug.Log("[CaseVideoSyncPlayer] Checking video load indicators for " + Networking.LocalPlayer.displayName + "...");
|
|
||||||
foreach (VideoLoadIndicator Indicator in _VideoLoadIndicators)
|
foreach (VideoLoadIndicator Indicator in _VideoLoadIndicators)
|
||||||
{
|
{
|
||||||
if (Indicator.GetOwner() == Networking.LocalPlayer.displayName)
|
if (Indicator.GetOwner() == Networking.LocalPlayer.displayName)
|
||||||
{
|
{
|
||||||
//Debug.Log("[CaseVideoSyncPlayer] " + Indicator.GetOwner() + "'s video load indicator was found. Setting status to " + Status + "...");
|
|
||||||
Indicator.IndicateStatus = Status;
|
Indicator.IndicateStatus = Status;
|
||||||
}
|
}
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// Debug.Log("[CaseVideoSyncPlayer] This one is owned by " + Indicator.GetOwner() + ". Not what we want.");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +526,10 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_SubMapIndex = value;
|
_SubMapIndex = value;
|
||||||
UpdateMap(!FlashCorrectAnswer);
|
if (_SubMapIndex >= 0)
|
||||||
|
{
|
||||||
|
UpdateMap(!FlashCorrectAnswer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
get => _SubMapIndex;
|
get => _SubMapIndex;
|
||||||
}
|
}
|
||||||
@ -554,7 +549,7 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_FlashCorrectAnswer = value;
|
_FlashCorrectAnswer = value;
|
||||||
SendCustomNetworkEvent(NetworkEventTarget.Self, nameof(NextCorrectAnswerFrame));
|
if (_FlashCorrectAnswer) NextCorrectAnswerFrame();
|
||||||
RequestSerialization();
|
RequestSerialization();
|
||||||
}
|
}
|
||||||
get => _FlashCorrectAnswer;
|
get => _FlashCorrectAnswer;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user