fix: proposition counter

This commit is contained in:
Morgan - 6 Freedom 2024-01-28 01:03:16 +01:00
parent e994fd7f4e
commit 64596bcb9e
3 changed files with 490 additions and 61 deletions

View File

@ -749,7 +749,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 157938956} - component: {fileID: 157938956}
- component: {fileID: 157938958} - component: {fileID: 157938958}
- component: {fileID: 157938957} - component: {fileID: 157938959}
m_Layer: 5 m_Layer: 5
m_Name: Timer m_Name: Timer
m_TagString: Untagged m_TagString: Untagged
@ -775,9 +775,17 @@ RectTransform:
m_AnchorMin: {x: 1, y: 1} m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -43, y: -51} m_AnchoredPosition: {x: -43, y: -51}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 1, y: 1} m_Pivot: {x: 1, y: 1}
--- !u!114 &157938957 --- !u!222 &157938958
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 157938955}
m_CullTransparentMesh: 1
--- !u!114 &157938959
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -786,7 +794,7 @@ MonoBehaviour:
m_GameObject: {fileID: 157938955} m_GameObject: {fileID: 157938955}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
@ -797,21 +805,16 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Texture: {fileID: 0} m_Sprite: {fileID: 21300000, guid: 141de4e4cebc12c489ea471b0df36fd8, type: 3}
m_UVRect: m_Type: 0
serializedVersion: 2 m_PreserveAspect: 0
x: 0 m_FillCenter: 1
y: 0 m_FillMethod: 4
width: 1 m_FillAmount: 1
height: 1 m_FillClockwise: 1
--- !u!222 &157938958 m_FillOrigin: 0
CanvasRenderer: m_UseSpriteMesh: 0
m_ObjectHideFlags: 0 m_PixelsPerUnitMultiplier: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 157938955}
m_CullTransparentMesh: 1
--- !u!1 &183264014 --- !u!1 &183264014
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1377,8 +1380,12 @@ MonoBehaviour:
- {fileID: 340074661} - {fileID: 340074661}
promptList: {fileID: 0} promptList: {fileID: 0}
explanationPage: {fileID: 45150984} explanationPage: {fileID: 45150984}
counter: {fileID: 1798182259} explanationCounter: {fileID: 1798182259}
explanationTime: 4
counterSFX: {fileID: 8300000, guid: 3beaa7f0d20a77649ba21959c91856f8, type: 3}
waitingForPropositionsPage: {fileID: 1730465902} waitingForPropositionsPage: {fileID: 1730465902}
propositionCounter: {fileID: 1996258852}
propositionTime: 60
waitingForPropositionsLabels: waitingForPropositionsLabels:
- {fileID: 972471162} - {fileID: 972471162}
- {fileID: 1374681049} - {fileID: 1374681049}
@ -1388,8 +1395,6 @@ MonoBehaviour:
- {fileID: 1854893636} - {fileID: 1854893636}
- {fileID: 2065109614} - {fileID: 2065109614}
- {fileID: 1197279072} - {fileID: 1197279072}
propositionTime: 59.8
timerGUI: {fileID: 0}
votingTime: 20 votingTime: 20
--- !u!114 &375256413 --- !u!114 &375256413
MonoBehaviour: MonoBehaviour:
@ -4125,6 +4130,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1117928115} - component: {fileID: 1117928115}
- component: {fileID: 1117928116}
m_Layer: 5 m_Layer: 5
m_Name: WaitingForPlayersPage m_Name: WaitingForPlayersPage
m_TagString: Untagged m_TagString: Untagged
@ -4160,6 +4166,102 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!82 &1117928116
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1117928114}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 7ac3efdb5c840704aafbf19188b3e61e, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 1
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &1141337195 --- !u!1 &1141337195
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5431,6 +5533,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1451481718} - component: {fileID: 1451481718}
- component: {fileID: 1451481719}
m_Layer: 5 m_Layer: 5
m_Name: ScorePictureState m_Name: ScorePictureState
m_TagString: Untagged m_TagString: Untagged
@ -5461,6 +5564,102 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!82 &1451481719
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1451481717}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: e1135788bf319bd42b6ca512976f9028, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 1
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &1452182575 --- !u!1 &1452182575
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6089,6 +6288,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1730465903} - component: {fileID: 1730465903}
- component: {fileID: 1730465904}
m_Layer: 5 m_Layer: 5
m_Name: WaitingForPropositionPage m_Name: WaitingForPropositionPage
m_TagString: Untagged m_TagString: Untagged
@ -6120,6 +6320,102 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!82 &1730465904
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1730465902}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 0e86c0433979a2d4c884b368808d3cdf, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 1
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &1730898850 --- !u!1 &1730898850
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6921,8 +7217,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: 0000 m_text: 0000
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@ -6952,7 +7248,7 @@ MonoBehaviour:
m_enableAutoSizing: 0 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 1
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 256
m_textAlignment: 65535 m_textAlignment: 65535
@ -7702,7 +7998,7 @@ GameObject:
- component: {fileID: 1996258853} - component: {fileID: 1996258853}
- component: {fileID: 1996258852} - component: {fileID: 1996258852}
m_Layer: 5 m_Layer: 5
m_Name: Text (TMP) m_Name: Timer.Counter
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -7722,11 +8018,11 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 157938956} m_Father: {fileID: 157938956}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 128, y: -30} m_AnchoredPosition: {x: -2.5, y: -12.5}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: -5, y: -25}
m_Pivot: {x: 1, y: 1} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1996258852 --- !u!114 &1996258852
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7774,15 +8070,15 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 36 m_fontSize: 52
m_fontSizeBase: 36 m_fontSizeBase: 52
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 0 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 1
m_HorizontalAlignment: 1 m_HorizontalAlignment: 2
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
m_wordSpacing: 0 m_wordSpacing: 0
@ -7810,7 +8106,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 157.45232, w: 8.397432} m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0

View File

@ -20,16 +20,19 @@ public class RoomManager : MonoBehaviour
[Header("Explanation Page")] [Header("Explanation Page")]
public GameObject explanationPage; public GameObject explanationPage;
public TextMeshProUGUI counter; public TextMeshProUGUI explanationCounter;
public float explanationTime;
private DateTime endOfExplanationDate = DateTime.MinValue; private DateTime endOfExplanationDate = DateTime.MinValue;
public AudioClip counterSFX;
[Header("Waiting For Proposition Page")] [Header("Waiting For Proposition Page")]
public GameObject waitingForPropositionsPage; public GameObject waitingForPropositionsPage;
public List<TextMeshProUGUI> waitingForPropositionsLabels = new List<TextMeshProUGUI>(); public TextMeshProUGUI propositionCounter;
public float propositionTime = 60; public float propositionTime = 60;
private float propositionCurrentTime = 0; public List<TextMeshProUGUI> waitingForPropositionsLabels = new List<TextMeshProUGUI>();
public TextMeshProUGUI timerGUI; private DateTime endOfPropositionDate = DateTime.MinValue;
[Header("Other")]
private Room myRoom = null; private Room myRoom = null;
public float votingTime = 20; public float votingTime = 20;
@ -54,14 +57,12 @@ private void Awake()
FirebaseInitializer.Instance.onFirebaseReady += Initialize; FirebaseInitializer.Instance.onFirebaseReady += Initialize;
} }
private void Start() private void Start()
{ {
explanationPage.SetActive(false); explanationPage.SetActive(false);
waitingForPropositionsPage.SetActive(false); waitingForPropositionsPage.SetActive(false);
waitingForPlayersPage.SetActive(true); waitingForPlayersPage.SetActive(true);
propositionCurrentTime = propositionTime;
votingCurrentTime = votingTime; votingCurrentTime = votingTime;
ResetAllPlayerLabels(); ResetAllPlayerLabels();
} }
@ -74,7 +75,8 @@ private void Update()
if (myRoom.currentState == (int)GameState.Explanation && endOfExplanationDate != DateTime.MinValue) if (myRoom.currentState == (int)GameState.Explanation && endOfExplanationDate != DateTime.MinValue)
{ {
TimeSpan duration = endOfExplanationDate - DateTime.Now; TimeSpan duration = endOfExplanationDate - DateTime.Now;
counter.text = ((int)duration.TotalSeconds).ToString("D1"); explanationCounter.text = ((int)duration.TotalSeconds).ToString("D1");
if (duration.TotalMilliseconds <= 0) if (duration.TotalMilliseconds <= 0)
{ {
@ -82,6 +84,13 @@ private void Update()
SendRoomState(GameState.MakeProposition); SendRoomState(GameState.MakeProposition);
} }
} }
if (myRoom.currentState == (int)GameState.MakeProposition && endOfPropositionDate != DateTime.MinValue)
{
TimeSpan duration = endOfPropositionDate - DateTime.Now;
propositionCounter.text = ((int)duration.TotalSeconds).ToString("D1");
}
} }
private void SendRoomState(GameState _newState) private void SendRoomState(GameState _newState)
@ -217,7 +226,8 @@ public void HostStartGame()
{ {
waitingForPropositionsPage.SetActive(true); waitingForPropositionsPage.SetActive(true);
waitingForPlayersPage.SetActive(false); waitingForPlayersPage.SetActive(false);
propositionCurrentTime = propositionTime; endOfPropositionDate = DateTime.Now.AddSeconds(propositionTime);
AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero);
} }
/// <summary> /// <summary>
@ -339,7 +349,7 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
case (int)GameState.Explanation: case (int)GameState.Explanation:
waitingForPlayersPage.SetActive(false); waitingForPlayersPage.SetActive(false);
explanationPage.SetActive(true); explanationPage.SetActive(true);
endOfExplanationDate = DateTime.Now.AddSeconds(3); endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);
break; break;
case (int)GameState.MakeProposition: case (int)GameState.MakeProposition:
HostStartGame(); HostStartGame();

File diff suppressed because one or more lines are too long