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