- Interaction changes for the host card has been converted to a function.

- Interaction text for the host card can now change at every stage.
This commit is contained in:
Jamie Greunbaum 2025-06-01 03:11:44 -04:00
parent 1ed65dba3c
commit 6aa533d6a6

View File

@ -9,7 +9,6 @@ using VRC.SDKBase;
using VRC.SDK3.StringLoading; using VRC.SDK3.StringLoading;
using TMPro; using TMPro;
using VRC.SDK3.Components; using VRC.SDK3.Components;
using HarmonyLib;
public enum QuestionType public enum QuestionType
@ -132,7 +131,7 @@ public class GameManager : UdonSharpBehaviour
_QuestionCorrectResponse = (int)_CurrentQuestion["Correct Response"].Number; _QuestionCorrectResponse = (int)_CurrentQuestion["Correct Response"].Number;
_Answer.text = Choices[_QuestionCorrectResponse].ToString(); _Answer.text = Choices[_QuestionCorrectResponse].ToString();
DisableInteractive = false; EnableInteraction("Reveal Choices");
} }
private void MultipleChoiceRevealChoices() private void MultipleChoiceRevealChoices()
@ -178,7 +177,7 @@ public class GameManager : UdonSharpBehaviour
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.All, "SetCardChoices", ChoiceStrings, ChoiceOrder); NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.All, "SetCardChoices", ChoiceStrings, ChoiceOrder);
} }
DisableInteractive = false; EnableInteraction("Lock Answers");
} }
private void MultipleChoiceLockAnswers() private void MultipleChoiceLockAnswers()
@ -202,10 +201,10 @@ public class GameManager : UdonSharpBehaviour
} }
} }
DisableInteractive = false; EnableInteraction("Reveal Answers And Assign Points");
} }
private void MultipleChoiceConfirmAnswers() private void MultipleChoiceRevealAnswersAndAssignPoints()
{ {
_InfoHeader.text = "ANSWER REVEALED"; _InfoHeader.text = "ANSWER REVEALED";
@ -214,7 +213,7 @@ public class GameManager : UdonSharpBehaviour
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.All, "VerifyResponse", _QuestionCorrectResponse); NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.All, "VerifyResponse", _QuestionCorrectResponse);
} }
DisableInteractive = false; EnableInteraction("Next Question");
} }
@ -233,9 +232,9 @@ public class GameManager : UdonSharpBehaviour
_QuestionCorrectResponse = (int)_CurrentQuestion["Correct Response"].Number; _QuestionCorrectResponse = (int)_CurrentQuestion["Correct Response"].Number;
_QuestionStage = 0; _QuestionStage = 0;
ResetInfoCard("Next Question"); ResetInfoCard();
DisableInteractive = false; EnableInteraction("Show Next Question");
} }
private void ResetInfoCard(string Header = "") private void ResetInfoCard(string Header = "")
@ -327,7 +326,7 @@ public class GameManager : UdonSharpBehaviour
private void AdvanceQuestion() private void AdvanceQuestion()
{ {
// Disable interaction until we unlock it again later. // Disable interaction until we unlock it again later.
DisableInteractive = true; DisableInteraction();
_QuestionStage++; _QuestionStage++;
@ -350,11 +349,11 @@ public class GameManager : UdonSharpBehaviour
{ {
switch(_QuestionStage) switch(_QuestionStage)
{ {
case 1: NewMultipleChoiceQuestion(); break; case 1: NewMultipleChoiceQuestion(); break;
case 2: MultipleChoiceRevealChoices(); break; case 2: MultipleChoiceRevealChoices(); break;
case 3: MultipleChoiceLockAnswers(); break; case 3: MultipleChoiceLockAnswers(); break;
case 4: MultipleChoiceConfirmAnswers(); break; case 4: MultipleChoiceRevealAnswersAndAssignPoints(); break;
case 5: AdvanceToNextQuestion(); break; case 5: AdvanceToNextQuestion(); break;
default: return; default: return;
} }
} }
@ -395,10 +394,29 @@ public class GameManager : UdonSharpBehaviour
public override void OnPickupUseDown() public override void OnPickupUseDown()
{ {
if (DisableInteractive) { return; } if (IsInteractionDisabled()) { return; }
AdvanceQuestion(); AdvanceQuestion();
base.OnPickupUseDown(); base.OnPickupUseDown();
} }
private void EnableInteraction(string InteractionText = "Advance")
{
DisableInteractive = false;
VRCPickup Pickup = GetComponent<VRCPickup>();
if (Pickup != null)
{
Pickup.InteractionText = InteractionText;
}
}
private void DisableInteraction()
{
DisableInteractive = true;
}
private bool IsInteractionDisabled()
{
return DisableInteractive;
}
} }