Commit 5d4a6d38 authored by Yousef Sameh's avatar Yousef Sameh

camera fix

parent 11bdacfd
......@@ -47,6 +47,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Assembly-CSharp::com.al_arcade.cs.CsBotController
animator: {fileID: 2979089725986339314}
fadeDuration: 0.05
sizeMultiplier: 1.2
neutral: {r: 0, g: 1, b: 1, a: 0.7607843}
happy: {r: 0.32417583, g: 1, b: 0, a: 0.7176471}
sad: {r: 0.8679245, g: 0, b: 0, a: 0.7294118}
......@@ -61,7 +62,6 @@ MonoBehaviour:
corneaMaterial: {fileID: 2100000, guid: f5da68cd484f44ced9e11ab1ad6a9c1a, type: 2}
eyeBackToNeutralDelay: 0.8
sizeChanagePerQuestion: 2
sizeChangeDuration: 0.65
--- !u!1001 &2883850800454280294
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -136,7 +136,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4431084402279646, guid: 8e0f285c21cdcf14e8d5c06c57ba936b, type: 3}
propertyPath: m_LocalPosition.x
value: 0.13084604
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4431084402279646, guid: 8e0f285c21cdcf14e8d5c06c57ba936b, type: 3}
propertyPath: m_LocalPosition.y
......@@ -144,7 +144,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4431084402279646, guid: 8e0f285c21cdcf14e8d5c06c57ba936b, type: 3}
propertyPath: m_LocalPosition.z
value: 0.10280333
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4431084402279646, guid: 8e0f285c21cdcf14e8d5c06c57ba936b, type: 3}
propertyPath: m_LocalRotation.w
......
This diff is collapsed.
......@@ -567,7 +567,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4788729921527788, guid: e9a4f67b7f329ca4abf5de824f66db82, type: 3}
propertyPath: m_LocalPosition.x
value: 0.23
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4788729921527788, guid: e9a4f67b7f329ca4abf5de824f66db82, type: 3}
propertyPath: m_LocalPosition.y
......
......@@ -188,7 +188,7 @@ Material:
- _ColorDimSteps: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056}
- _ColorGradient: {r: 0.85023, g: 0.85034, b: 0.85045, a: 0.85056}
- _DetailMapColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 12.830189, b: 11.991371, a: 1}
- _EmissionColor: {r: 0.23865911, g: 1.0943396, b: 0, a: 1}
- _FlatRimColor: {r: 0.85023, g: 0.85034, b: 0.85045, a: 0.85056}
- _FlatSpecularColor: {r: 0.85023, g: 0.85034, b: 0.85045, a: 0.85056}
- _LightmapDirection: {r: 0, g: 1, b: 0, a: 0}
......
......@@ -196,7 +196,7 @@ Material:
- _XRMotionVectorsPass: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0, g: 1, b: 1, a: 0.7607843}
- _BaseColor: {r: 0.32417583, g: 1, b: 0, a: 0.7176471}
- _Color: {r: 0, g: 1, b: 1, a: 0.7607843}
- _ColorDim: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056}
- _ColorDimCurve: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056}
......
fileFormatVersion: 2
guid: 6ebbdbecd03ddaa109a6d3ac5749c01a
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 6071a30660adac1569fedd36e11f7c5e
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fa30cf9366c623cf795ee26e47453187
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 78845f555d2b8e2518447ced6c112540
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9396d4286c7fc06fdbe6047dc57ea221
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
......@@ -198,6 +198,123 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1049087471
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1049087476}
- component: {fileID: 1049087475}
- component: {fileID: 1049087477}
- component: {fileID: 1049087472}
m_Layer: 0
m_Name: CinemachineCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1049087472
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1049087471}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4eb4843bae7d24943842ea23130dcd55, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineGroupFraming
FramingMode: 0
FramingSize: 0.2
CenterOffset: {x: 0, y: -0.63}
Damping: 1
SizeAdjustment: 2
LateralAdjustment: 0
FovRange: {x: 1, y: 100}
DollyRange: {x: -100, y: 100}
OrthoSizeRange: {x: 5, y: 11.82}
--- !u!114 &1049087475
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1049087471}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineCamera
Priority:
Enabled: 0
m_Value: 0
OutputChannel: 1
StandbyUpdate: 2
m_StreamingVersion: 20241001
m_LegacyPriority: 0
Target:
TrackingTarget: {fileID: 1559015525}
LookAtTarget: {fileID: 0}
CustomLookAtTarget: 0
Lens:
FieldOfView: 60
OrthographicSize: 6
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
ModeOverride: 0
PhysicalProperties:
GateFit: 2
SensorSize: {x: 21.946, y: 16.002}
LensShift: {x: 0, y: 0}
FocusDistance: 10
Iso: 200
ShutterSpeed: 0.005
Aperture: 16
BladeCount: 5
Curvature: {x: 2, y: 11}
BarrelClipping: 0.25
Anamorphism: 0
BlendHint: 0
--- !u!4 &1049087476
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1049087471}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 3, z: -15}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1049087477
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1049087471}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineFollow
TrackerSettings:
BindingMode: 4
PositionDamping: {x: 1, y: 1, z: 1}
AngularDampingMode: 0
RotationDamping: {x: 1, y: 1, z: 1}
QuaternionDamping: 1
FollowOffset: {x: 0, y: 3, z: -15}
--- !u!1 &1145369046
GameObject:
m_ObjectHideFlags: 0
......@@ -245,8 +362,8 @@ MonoBehaviour:
startTime: 30
correctAnswerBonusTime: 3
wrongAnswerPenaltyTime: 2
sfxCorrect: {fileID: 8300000, guid: 8067fa6881479862782460be69fa2a01, type: 3}
sfxWrong: {fileID: 8300000, guid: f28bc95b0eb4d15169412171b5f884ec, type: 3}
sfxCorrect: {fileID: 8300000, guid: 6ebbdbecd03ddaa109a6d3ac5749c01a, type: 3}
sfxWrong: {fileID: 8300000, guid: 9396d4286c7fc06fdbe6047dc57ea221, type: 3}
sfxClick: {fileID: 8300000, guid: 6f0b59c15f55cf15d9156d7f012c2e4f, type: 3}
sfxVictory: {fileID: 8300000, guid: 1137cc434209c9f1f97b943755d641ce, type: 3}
sfxDefeat: {fileID: 8300000, guid: d7b054e9e1118f1639d0bc6e684737c6, type: 3}
......@@ -254,6 +371,8 @@ MonoBehaviour:
sfxPop: {fileID: 8300000, guid: 6f0b59c15f55cf15d9156d7f012c2e4f, type: 3}
sfxSlam: {fileID: 8300000, guid: c0e0d2f315c14608eb08741fe5f55a1d, type: 3}
sfxCheer: {fileID: 8300000, guid: 4295ade796f65ddac8f070e8fddcb347, type: 3}
sfxGrow: {fileID: 8300000, guid: 6071a30660adac1569fedd36e11f7c5e, type: 3}
sfxShrink: {fileID: 8300000, guid: 78845f555d2b8e2518447ced6c112540, type: 3}
music: {fileID: 8300000, guid: 35e247fe8003f9730a5afdc547918e69, type: 3}
tickingLoop: {fileID: 8300000, guid: 4bdea37bc3bdb6bf49f77065b8a15376, type: 3}
correctBurstParticle: {fileID: 1449242181322416604, guid: 052d5f6cf7d3ebc44bba49fbe653f9a8, type: 3}
......@@ -308,6 +427,55 @@ MonoBehaviour:
classCode:
arabicFont: {fileID: 0}
useOfflineTestData: 0
--- !u!1 &1559015523
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1559015525}
- component: {fileID: 1559015524}
m_Layer: 0
m_Name: Target Group
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1559015524
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1559015523}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e5eb80d8e62d9d145bb50fb783c0f731, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineTargetGroup
PositionMode: 1
RotationMode: 0
UpdateMethod: 2
Targets: []
m_LegacyTargets: []
--- !u!4 &1559015525
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1559015523}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1677846864
GameObject:
m_ObjectHideFlags: 0
......@@ -320,6 +488,7 @@ GameObject:
- component: {fileID: 1677846866}
- component: {fileID: 1677846865}
- component: {fileID: 1677846868}
- component: {fileID: 1677846869}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
......@@ -370,7 +539,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 6
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
......@@ -395,12 +564,12 @@ Transform:
m_GameObject: {fileID: 1677846864}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 3, z: -7}
m_LocalPosition: {x: 0, y: 3.15, z: -15}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: -1.146, z: 0}
--- !u!114 &1677846868
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -445,6 +614,38 @@ MonoBehaviour:
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0
m_Version: 2
--- !u!114 &1677846869
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1677846864}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineBrain
ShowDebugText: 0
ShowCameraFrustum: 1
IgnoreTimeScale: 0
WorldUpOverride: {fileID: 0}
ChannelMask: -1
UpdateMethod: 2
BlendUpdateMethod: 1
LensModeOverride:
Enabled: 0
DefaultMode: 2
DefaultBlend:
Style: 1
Time: 2
CustomCurve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
CustomBlends: {fileID: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
......@@ -452,3 +653,5 @@ SceneRoots:
- {fileID: 1677846867}
- {fileID: 878368485}
- {fileID: 1145369048}
- {fileID: 1049087476}
- {fileID: 1559015525}
using System.Collections;
using com.al_arcade.shared;
using DG.Tweening;
using Unity.Cinemachine;
using UnityEngine;
namespace com.al_arcade.cs
......@@ -8,6 +10,7 @@ namespace com.al_arcade.cs
{
[SerializeField] private Animator animator;
[SerializeField] private float fadeDuration = 0.5f;
[SerializeField] private float sizeMultiplier = 1.5f;
[Header("Eye Material")]
[SerializeField] private Color neutral;
......@@ -31,7 +34,7 @@ namespace com.al_arcade.cs
[SerializeField] private float eyeBackToNeutralDelay = 0.8f;
[SerializeField] private float sizeChanagePerQuestion = 0.1f;
[SerializeField] private float sizeChangeDuration = 0.5f;
[SerializeField] public static float sizeChangeDuration = 0.5f;
private Vector3 _initialPosition;
private Quaternion _initialRotation;
......@@ -48,10 +51,22 @@ namespace com.al_arcade.cs
eyeMaterial.color = neutral;
corneaMaterial.SetColor("_EmissionColor", neutralGlowCornea);
robotMaterial.color = neutralRobot;
var _targetGroup = FindFirstObjectByType<CinemachineTargetGroup>();
_targetGroup.AddMember(transform, 1f, 2f);
}
public void PlayHappy()
{
StartCoroutine(PlayHappyCo());
}
IEnumerator PlayHappyCo()
{
AnimateSizeChange(true);
UpdateRobotColor(true);
yield return new WaitForSeconds(sizeChangeDuration - 0.1f);
if (animator != null)
{
animator.CrossFade("Happy", fadeDuration);
......@@ -60,42 +75,43 @@ namespace com.al_arcade.cs
eyeMaterial.color = happy;
corneaMaterial.SetColor("_EmissionColor", happyCornea);
StartCoroutine(DelayedAction(eyeBackToNeutralDelay, () =>
{
eyeMaterial.color = neutral;
corneaMaterial.SetColor("_EmissionColor", neutralGlowCornea);
}));
yield return new WaitForSeconds(eyeBackToNeutralDelay);
eyeMaterial.color = neutral;
corneaMaterial.SetColor("_EmissionColor", neutralGlowCornea);
UpdateRobotColor(true);
AnimateSizeChange(true);
}
public void PlaySad()
{
StartCoroutine(PlaySadCo());
}
public void PlayVictoryDance()
{
if (animator != null)
{
animator.CrossFade("Sad", fadeDuration);
animator.CrossFade("Happy", fadeDuration);
}
eyeMaterial.color = sad;
corneaMaterial.SetColor("_EmissionColor", sadCornea);
StartCoroutine(DelayedAction(eyeBackToNeutralDelay, () =>
{
eyeMaterial.color = neutral;
corneaMaterial.SetColor("_EmissionColor", neutralGlowCornea);
}));
UpdateRobotColor(false);
AnimateSizeChange(false);
}
public void PlayVictoryDance()
IEnumerator PlaySadCo()
{
AnimateSizeChange(false);
UpdateRobotColor(false);
yield return new WaitForSeconds(sizeChangeDuration - 0.1f);
if (animator != null)
{
animator.CrossFade("Happy", fadeDuration);
animator.CrossFade("Sad", fadeDuration);
}
eyeMaterial.color = sad;
corneaMaterial.SetColor("_EmissionColor", sadCornea);
yield return new WaitForSeconds(eyeBackToNeutralDelay);
eyeMaterial.color = neutral;
corneaMaterial.SetColor("_EmissionColor", neutralGlowCornea);
}
public void ShowSpeechBubble()
......@@ -109,9 +125,18 @@ namespace com.al_arcade.cs
private void AnimateSizeChange(bool pos)
{
var targetScale = _robotTransform.localScale.x + (pos ? 1 : -1) * sizeChanagePerQuestion;
targetScale = Mathf.Clamp(targetScale, _initialScale, _initialScale + sizeChanagePerQuestion * 6);
var currentSize = _robotTransform.localScale.x;
float targetScale = _robotTransform.localScale.x * (pos ? sizeMultiplier : 1f / sizeMultiplier);
targetScale = Mathf.Clamp(targetScale, _initialScale, _initialScale * 8);
_robotTransform.DOScale(targetScale, sizeChangeDuration).SetEase(Ease.OutElastic);
if (currentSize == targetScale) return;
if (pos)
SSAudioManager.Instance.PlayGrow();
else
SSAudioManager.Instance.PlayShrink();
}
public void ResetBot()
......@@ -120,6 +145,8 @@ namespace com.al_arcade.cs
transform.rotation = _initialRotation;
transform.localScale = Vector3.one;
_robotTransform.localScale = Vector3.one * _initialScale;
if (animator != null)
{
animator.Rebind();
......
......@@ -7,7 +7,9 @@ using UnityEngine.Events;
namespace com.al_arcade.cs
{
using System.Linq;
using shared;
using Unity.Cinemachine;
public enum CsGameState
{
......@@ -76,6 +78,8 @@ namespace com.al_arcade.cs
int _deltaChangeInSize;
bool showHint = true;
CinemachineTargetGroup _targetGroup;
private void Awake()
{
if (Instance != null && Instance != this)
......@@ -84,6 +88,8 @@ namespace com.al_arcade.cs
return;
}
Instance = this;
_targetGroup = FindFirstObjectByType<CinemachineTargetGroup>();
}
private void Update()
......@@ -210,7 +216,10 @@ namespace com.al_arcade.cs
var session = SSGameSession.EnsureInstance();
var api = SSApiManager.EnsureInstance();
SSAudioManager.EnsureInstance().PlayMusic();
if (uiManager.isMusicOn)
SSAudioManager.EnsureInstance().PlayMusic();
string error = null;
yield return api.FetchCs(
......@@ -336,13 +345,6 @@ namespace com.al_arcade.cs
_deltaChangeInSize++;
UpdateTimer(CsPrefabBuilder.Instance.correctAnswerBonusTime);
if (_deltaChangeInSize == 5)
{
// Win
_state = CsGameState.Complete;
yield return VictorySequence();
yield break;
}
int points = Mathf.Max(100 - _wrongClicks * 15, 25);
if (_streak >= 3)
......@@ -359,12 +361,12 @@ namespace com.al_arcade.cs
uiManager.SetStreak(_streak);
}
SSAudioManager.Instance.PlayCorrect();
yield return new WaitForSeconds(0.4f);
if (bot != null)
bot.PlayHappy();
var audio = SSAudioManager.Instance;
audio.PlayCorrect();
uiManager.HideHint();
var particles = SSParticleManager.Instance;
......@@ -374,7 +376,15 @@ namespace com.al_arcade.cs
uiManager.TickPoints(_deltaChangeInSize);
onAnswerGiven?.Invoke(true);
yield return new WaitForSeconds(feedbackDuration);
yield return new WaitForSeconds(0.8f);
if (_deltaChangeInSize == 5)
{
// Win
_state = CsGameState.Complete;
yield return VictorySequence();
yield break;
}
}
private IEnumerator WrongOptionFeedback()
......@@ -394,12 +404,12 @@ namespace com.al_arcade.cs
uiManager.SetStreak(_streak);
}
SSAudioManager.Instance.PlayWrong();
yield return new WaitForSeconds(0.4f);
if (bot != null)
bot.PlaySad();
var audio = SSAudioManager.Instance;
audio.PlayWrongBeep();
if (Camera.main != null)
{
DOTween.Kill(Camera.main.transform, "csShake");
......@@ -407,7 +417,6 @@ namespace com.al_arcade.cs
}
uiManager.TickPoints(_deltaChangeInSize);
yield return new WaitForSeconds(0.8f);
}
......@@ -540,15 +549,11 @@ namespace com.al_arcade.cs
});
}
// foreach (var wb in _wordButtons)
// {
// if (wb != null && wb.gameObject != null)
// {
// DOTween.Kill(wb.transform);
// Destroy(wb.gameObject);
// }
// }
// _wordButtons.Clear();
if (_targetGroup.Targets.Count > 2)
{
_targetGroup.RemoveMember(_targetGroup.Targets[1].Object);
_targetGroup.RemoveMember(_targetGroup.Targets[1].Object);
}
}
private IEnumerator UnlockAfterCooldown()
......@@ -591,6 +596,12 @@ namespace com.al_arcade.cs
ClearWordButtons();
}
private IEnumerator DelayedAction(float delay, Action action)
{
yield return new WaitForSeconds(delay);
action?.Invoke();
}
private IEnumerator LoseSequence()
{
var audio = SSAudioManager.Instance;
......
......@@ -72,7 +72,8 @@ namespace com.al_arcade.cs
[SerializeField] private AudioClip sfxPop;
[SerializeField] private AudioClip sfxSlam;
[SerializeField] private AudioClip sfxCheer;
[SerializeField] private AudioClip sfxGrow;
[SerializeField] private AudioClip sfxShrink;
[Header("Music")]
[SerializeField] private AudioClip music;
[SerializeField] private AudioClip tickingLoop;
......@@ -275,6 +276,8 @@ namespace com.al_arcade.cs
if (sfxCheer != null) audio.sfxCheer = sfxCheer;
if (music != null) audio.music = music;
if (tickingLoop != null) audio.tickingLoop = tickingLoop;
if (sfxGrow != null) audio.sfxGrow = sfxGrow;
if (sfxShrink != null) audio.sfxShrink = sfxShrink;
}
private void SetupParticleManager()
......
......@@ -8,12 +8,12 @@ using LightSide;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
using Unity.Cinemachine;
public class CsSentence : MonoBehaviour
{
private CsQuestion _question;
private GameObject _background;
private Camera _mainCamera;
......@@ -22,10 +22,14 @@ public class CsSentence : MonoBehaviour
private Vector2 eachWordPadding = new Vector2(8f, 4f);
private CinemachineTargetGroup _targetGroup;
public void Initialize(CsQuestion question)
{
_question = question;
_mainCamera = Camera.main;
_targetGroup = FindFirstObjectByType<CinemachineTargetGroup>();
StartCoroutine(SentenceToWords());
}
......@@ -39,8 +43,7 @@ public class CsSentence : MonoBehaviour
private IEnumerator ShowSentence()
{
_mainCamera = Camera.main;
Vector3 arcCenter = _mainCamera.transform.position + Vector3.up * 1.2f;
Vector3 arcCenter = Vector3.up * 5f;
transform.position = arcCenter + new Vector3(0f, 0f, 15f);
var words = _question.words;
......@@ -135,12 +138,6 @@ public class CsSentence : MonoBehaviour
var wordObj = new GameObject($"Word_{i}_{word.word_text}");
wordObj.transform.SetParent(transform.parent);
wordObj.transform.position = pos;
// var wb = wordObj.AddComponent<CsWordButton>();
// wb.Setup(word.word_text, word.is_wrong, i, wordWidths[i], scaleFactor);
// wordObj.transform.DOShakePosition(0.5f, 0.2f, 20);
// cursorArcLength += wordWidths[i] + wordGap;
}
}
......@@ -172,56 +169,69 @@ public class CsSentence : MonoBehaviour
return canvasObj;
}
private IEnumerator UpdateTextPositions(float gap = 0f)
private IEnumerator UpdateTextPositions(float gap = 0.5f, float offsetX = 0f)
{
// 1. Calculate the REAL total width (including padding and gaps)
float totalWidth = 0;
foreach (var t in _wordTexts)
{
float baseWidth = t.transform.parent.GetComponent<RectTransform>().rect.width;
// Padded width in world units (0.02 scale)
float paddedWidth = (baseWidth + eachWordPadding.x) * 0.02f;
totalWidth += paddedWidth;
}
totalWidth += (_wordTexts.Count - 1) * gap;
// 1. Calculate total width including gaps
// Total gaps = (number of items - 1) * gap size
float totalGaps = (_wordTexts.Count - 1) * gap;
float totalWidth = _wordTexts.Sum(t => t.transform.parent.GetComponent<RectTransform>().rect.width * 0.02f) + totalGaps;
// 2. Start at the right-most edge
float currentX = totalWidth / 2f;
// 2. Start at the Right Edge (+Half Total) and apply the manual offsetX
float currentX = (totalWidth / 2f) + offsetX;
yield return null;
for (int i = 0; i < _wordTexts.Count; i++)
{
RectTransform rect = _wordTexts[i].transform.parent.GetComponent<RectTransform>();
rect.DOSizeDelta(new Vector2(rect.sizeDelta.x + eachWordPadding.x, rect.sizeDelta.y + eachWordPadding.y), 0.15f).SetEase(Ease.OutCubic);
var image = rect.GetComponent<Image>();
// Apply size immediately for accurate math
rect.sizeDelta += eachWordPadding;
float elementWidth = rect.rect.width * 0.02f;
// 3. Center Pivot Math: Position = Right Edge - half of the card's width
// 3. Right-to-Left Math:
// Subtract half the element width to find the center point
float targetX = currentX - (elementWidth / 2f);
var target = new Vector3(
targetX,
rect.position.y,
rect.position.z
);
// Final Position (0 on Y and Z to keep it on the 'floor' of your lab)
Vector3 targetPos = new Vector3(targetX, 0, 0);
// 4. Move currentX by the card's width AND the gap for the next element
currentX -= elementWidth + gap;
// 4. Update the "cursor" for the next card (Move Left)
currentX -= (elementWidth + gap);
if (i != 0 || i != _wordTexts.Count - 1)
image.pixelsPerUnitMultiplier = 10f;
DOTween.To(() => image.pixelsPerUnitMultiplier, x => image.pixelsPerUnitMultiplier = x, 3, 0.15f).SetEase(Ease.OutCubic);
var csWord = rect.transform.AddComponent<CsWordButton>();
// --- Setup & Animation ---
if (!rect.gameObject.TryGetComponent<CsWordButton>(out var csWord))
{
csWord = rect.gameObject.AddComponent<CsWordButton>();
}
csWord.Setup(_question.words[i].word_text, _question.words[i].is_wrong, i, elementWidth, 1f);
rect.DOMove(target, 0.3f).SetEase(Ease.OutCubic).onComplete += () =>
// Animate to the locally offset position
rect.DOLocalMove(targetPos, 0.3f).SetEase(Ease.OutCubic).OnComplete(() =>
{
csWord.StartIdleAnimation();
};
});
// Optional: Reset image multiplier for the neon glow effect
var image = rect.GetComponent<Image>();
if (image != null)
{
image.pixelsPerUnitMultiplier = 5f;
DOTween.To(() => image.pixelsPerUnitMultiplier, x => image.pixelsPerUnitMultiplier = x, 3f, 0.15f);
}
}
Destroy(_background);
// Update Camera Group
_targetGroup.AddMember(_wordTexts[0].transform.parent, 0.2f, _wordTexts[0].transform.parent.GetComponent<RectTransform>().rect.width * 0.5f * 0.02f);
_targetGroup.AddMember(_wordTexts[_wordTexts.Count - 1].transform.parent, 0.2f, _wordTexts[_wordTexts.Count - 1].transform.parent.GetComponent<RectTransform>().rect.width * 0.5f * 0.02f);
if (_background != null) Destroy(_background);
}
private IEnumerator AnimateTextIn()
......@@ -301,9 +311,9 @@ public class CsSentence : MonoBehaviour
var cnvRt = canvasObj.GetComponent<RectTransform>();
cnvRt.localScale = Vector3.one * 0.02f;
cnvRt.sizeDelta = new Vector2(totalWidth - 40f, neededHeight);
cnvRt.sizeDelta = new Vector2(totalWidth - 30f, neededHeight);
canvasObj.transform.SetLocalPositionAndRotation(new Vector3(-0.3f, 0, 0), Quaternion.identity);
canvasObj.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
var _backgroundImage = canvasObj.AddComponent<Image>();
_backgroundImage.color = SSColorPalette.NeutralWord;
_canvas.transform.SetSiblingIndex(0);
......
......@@ -11,7 +11,6 @@ namespace com.al_arcade.cs
using System.Linq;
using LightSide;
using shared;
using Unity.VisualScripting;
public class CsUIManager : MonoBehaviour
{
......@@ -43,7 +42,7 @@ namespace com.al_arcade.cs
private float timeLeft;
private bool isTweening;
private bool isMusicOn;
public bool isMusicOn = true;
[Header("Events")]
public UnityEvent onRestartClicked;
......@@ -61,6 +60,8 @@ namespace com.al_arcade.cs
CsGameManager.Instance.ResetGame();
CsGameManager.Instance.StartGame();
});
isMusicOn = true;
}
public virtual void BuildUI()
......@@ -536,6 +537,8 @@ namespace com.al_arcade.cs
if (_feedbackGroup != null) _feedbackGroup.alpha = 0;
_timerSlider.value = 1f;
_timerFill.color = _timerDefaultColor;
TickPoints(0);
SetStreak(0);
ClearOptions();
}
......
......@@ -26,6 +26,8 @@ namespace com.al_arcade.shared
public AudioClip sfxExplosion;
public AudioClip sfxCheer;
public AudioClip sfxCountdown;
public AudioClip sfxGrow;
public AudioClip sfxShrink;
public AudioClip music;
public AudioClip tickingLoop;
......@@ -72,7 +74,7 @@ namespace com.al_arcade.shared
_musicSource.clip = music;
_musicSource.loop = true;
_musicSource.volume = masterVolume * 0.1f;
_musicSource.volume = masterVolume * 0.025f;
_musicSource.Play();
}
......@@ -84,7 +86,6 @@ namespace com.al_arcade.shared
{
_tickingSource.Stop();
}
_tickingSource.clip = tickingLoop;
_tickingSource.Play();
}
......@@ -148,6 +149,8 @@ namespace com.al_arcade.shared
public void PlayExplosion(float vol = 1f) => Play(sfxExplosion, vol);
public void PlayCheer(float vol = 1f) => Play(sfxCheer, vol);
public void PlayCountdown(float vol = 0.8f) => Play(sfxCountdown, vol);
public void PlayGrow(float vol = 0.8f) => Play(sfxGrow, vol);
public void PlayShrink(float vol = 0.8f) => Play(sfxShrink, vol);
public void PlayProceduralBeep(float frequency = 440f, float duration = 0.1f,
......
fileFormatVersion: 2
guid: afb2d1f1fe2c14131a77368c50a02f13
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3f1ed6bb8aee47dca922ab5ad4dec564
timeCreated: 1771209077
\ No newline at end of file
fileFormatVersion: 2
guid: 1709df1300fb648f287f7e4a40c742ab
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>{{{ PRODUCT_NAME }}}</title>
<!-- ═══ ANTI-CACHE ═══ -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<!-- ═══ PRECONNECT TO CDN — speeds up HLS chunk fetching ═══ -->
<!-- Replace with your actual PeerTube domain -->
<link rel="preconnect" href="https://your-peertube-instance.com" crossorigin>
<link rel="dns-prefetch" href="https://your-peertube-instance.com">
<!-- ═══ PRELOAD HLS.js — starts downloading before Unity even loads ═══ -->
<link rel="preload" href="https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js" as="script" crossorigin>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
overflow: hidden;
background: #000;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
/* Prevent pull-to-refresh on mobile */
overscroll-behavior: none;
touch-action: none;
}
#unity-container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: #000;
}
#unity-canvas {
background: #000;
/* Prevent blurry scaling */
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
/* ═══ LOADING SCREEN ═══ */
#loading-screen {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
background: #000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 1000;
transition: opacity 0.5s ease;
}
#loading-screen.fade-out {
opacity: 0;
pointer-events: none;
}
#loading-logo {
max-width: 200px;
max-height: 200px;
margin-bottom: 40px;
animation: logoPulse 2s ease-in-out infinite;
}
@keyframes logoPulse {
0%, 100% { transform: scale(1); opacity: 0.9; }
50% { transform: scale(1.05); opacity: 1; }
}
#loading-bar-container {
width: 280px;
height: 6px;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
overflow: hidden;
margin-bottom: 16px;
}
#loading-bar {
width: 0%;
height: 100%;
background: #FED700;
border-radius: 3px;
transition: width 0.3s ease;
box-shadow: 0 0 10px rgba(254, 215, 0, 0.4);
}
#loading-text {
color: rgba(255, 255, 255, 0.5);
font-size: 13px;
letter-spacing: 0.5px;
}
</style>
</head>
<body>
<div id="unity-container">
<canvas id="unity-canvas" tabindex="-1"></canvas>
</div>
<div id="loading-screen">
<img id="loading-logo" src="logo.png" alt="Loading">
<div id="loading-bar-container">
<div id="loading-bar"></div>
</div>
<div id="loading-text">Loading...</div>
</div>
<script>
// ═══ 16:9 ASPECT RATIO LOCK ═══
function resizeCanvas() {
var container = document.getElementById('unity-container');
var canvas = document.getElementById('unity-canvas');
var windowW = window.innerWidth;
var windowH = window.innerHeight;
var targetAspect = 16 / 9;
var windowAspect = windowW / windowH;
var canvasW, canvasH;
if (windowAspect > targetAspect) {
canvasH = windowH;
canvasW = Math.floor(windowH * targetAspect);
} else {
canvasW = windowW;
canvasH = Math.floor(windowW / targetAspect);
}
canvas.style.width = canvasW + 'px';
canvas.style.height = canvasH + 'px';
canvas.width = canvasW;
canvas.height = canvasH;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// ═══ PRELOAD HLS.js INTO CACHE BEFORE UNITY BOOTS ═══
// This way when the jslib calls ensureHls(), it's already loaded
(function() {
var hlsScript = document.createElement('script');
hlsScript.src = 'https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js';
hlsScript.async = true;
document.head.appendChild(hlsScript);
})();
// ═══ UNITY LOADER ═══
var loadingBar = document.getElementById('loading-bar');
var loadingText = document.getElementById('loading-text');
var loadingScreen = document.getElementById('loading-screen');
// Cache-bust the loader URL in development
// Remove the timestamp parameter for production
var buildUrl = "Build";
var cacheBust = ""; // Set to "?t=" + Date.now() during development
var loaderUrl = buildUrl + "/{{{ LOADER_FILENAME }}}" + cacheBust;
var config = {
dataUrl: buildUrl + "/{{{ DATA_FILENAME }}}",
frameworkUrl: buildUrl + "/{{{ FRAMEWORK_FILENAME }}}",
#if USE_WASM
codeUrl: buildUrl + "/{{{ CODE_FILENAME }}}",
#endif
#if MEMORY_FILENAME
memoryUrl: buildUrl + "/{{{ MEMORY_FILENAME }}}",
#endif
#if SYMBOLS_FILENAME
symbolsUrl: buildUrl + "/{{{ SYMBOLS_FILENAME }}}",
#endif
streamingAssetsUrl: "StreamingAssets",
companyName: "{{{ COMPANY_NAME }}}",
productName: "{{{ PRODUCT_NAME }}}",
productVersion: "{{{ PRODUCT_VERSION }}}",
// ═══ MEMORY SETTINGS ═══
// Match what you set in Player Settings
// These override if present
};
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = function () {
createUnityInstance(
document.getElementById("unity-canvas"),
config,
function (progress) {
var pct = Math.round(progress * 100);
loadingBar.style.width = pct + '%';
loadingText.textContent = pct < 100 ? 'Loading... ' + pct + '%' : 'Starting...';
}
).then(function (instance) {
loadingScreen.classList.add('fade-out');
setTimeout(function () {
loadingScreen.style.display = 'none';
}, 600);
resizeCanvas();
// ═══ PREVENT ACCIDENTAL NAVIGATION ═══
window.addEventListener('beforeunload', function(e) {
e.preventDefault();
e.returnValue = '';
});
}).catch(function (message) {
loadingText.textContent = 'Error: ' + message;
loadingBar.style.background = '#ff3333';
console.error(message);
});
};
document.body.appendChild(script);
// ═══ PREVENT CONTEXT MENU ON CANVAS ═══
document.getElementById('unity-canvas').addEventListener('contextmenu', function(e) {
e.preventDefault();
});
// ═══ FOCUS CANVAS ON CLICK (fixes keyboard input) ═══
document.addEventListener('click', function() {
document.getElementById('unity-canvas').focus();
});
</script>
</body>
</html>
\ No newline at end of file
fileFormatVersion: 2
guid: 02fd7fb55a304c218c3e0c8fc27670d9
timeCreated: 1771209097
\ No newline at end of file
fileFormatVersion: 2
guid: ee5f33db9f5a1464d90c9a9460cafb2e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 72e6684cb6b9fa04cb697c3f78b8b689
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Correct The Sentence</title>
<!-- ═══ ANTI-CACHE ═══ -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<!-- ═══ PRECONNECT TO CDN — speeds up HLS chunk fetching ═══ -->
<!-- Replace with your actual PeerTube domain -->
<link rel="preconnect" href="https://your-peertube-instance.com" crossorigin>
<link rel="dns-prefetch" href="https://your-peertube-instance.com">
<!-- ═══ PRELOAD HLS.js — starts downloading before Unity even loads ═══ -->
<link rel="preload" href="https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js" as="script" crossorigin>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
overflow: hidden;
background: #000;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
/* Prevent pull-to-refresh on mobile */
overscroll-behavior: none;
touch-action: none;
}
#unity-container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: #000;
}
#unity-canvas {
background: #000;
/* Prevent blurry scaling */
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
/* ═══ LOADING SCREEN ═══ */
#loading-screen {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
background: #000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 1000;
transition: opacity 0.5s ease;
}
#loading-screen.fade-out {
opacity: 0;
pointer-events: none;
}
#loading-logo {
max-width: 200px;
max-height: 200px;
margin-bottom: 40px;
animation: logoPulse 2s ease-in-out infinite;
}
@keyframes logoPulse {
0%, 100% { transform: scale(1); opacity: 0.9; }
50% { transform: scale(1.05); opacity: 1; }
}
#loading-bar-container {
width: 280px;
height: 6px;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
overflow: hidden;
margin-bottom: 16px;
}
#loading-bar {
width: 0%;
height: 100%;
background: #FED700;
border-radius: 3px;
transition: width 0.3s ease;
box-shadow: 0 0 10px rgba(254, 215, 0, 0.4);
}
#loading-text {
color: rgba(255, 255, 255, 0.5);
font-size: 13px;
letter-spacing: 0.5px;
}
</style>
</head>
<body>
<div id="unity-container">
<canvas id="unity-canvas" tabindex="-1"></canvas>
</div>
<div id="loading-screen">
<img id="loading-logo" src="logo.png" alt="Loading">
<div id="loading-bar-container">
<div id="loading-bar"></div>
</div>
<div id="loading-text">Loading...</div>
</div>
<script>
// ═══ 16:9 ASPECT RATIO LOCK ═══
function resizeCanvas() {
var container = document.getElementById('unity-container');
var canvas = document.getElementById('unity-canvas');
var windowW = window.innerWidth;
var windowH = window.innerHeight;
var targetAspect = 16 / 9;
var windowAspect = windowW / windowH;
var canvasW, canvasH;
if (windowAspect > targetAspect) {
canvasH = windowH;
canvasW = Math.floor(windowH * targetAspect);
} else {
canvasW = windowW;
canvasH = Math.floor(windowW / targetAspect);
}
canvas.style.width = canvasW + 'px';
canvas.style.height = canvasH + 'px';
canvas.width = canvasW;
canvas.height = canvasH;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// ═══ PRELOAD HLS.js INTO CACHE BEFORE UNITY BOOTS ═══
// This way when the jslib calls ensureHls(), it's already loaded
(function() {
var hlsScript = document.createElement('script');
hlsScript.src = 'https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js';
hlsScript.async = true;
document.head.appendChild(hlsScript);
})();
// ═══ UNITY LOADER ═══
var loadingBar = document.getElementById('loading-bar');
var loadingText = document.getElementById('loading-text');
var loadingScreen = document.getElementById('loading-screen');
// Cache-bust the loader URL in development
// Remove the timestamp parameter for production
var buildUrl = "Build";
var cacheBust = ""; // Set to "?t=" + Date.now() during development
var loaderUrl = buildUrl + "/CS Build.loader.js" + cacheBust;
var config = {
dataUrl: buildUrl + "/CS Build.data",
frameworkUrl: buildUrl + "/CS Build.framework.js",
codeUrl: buildUrl + "/CS Build.wasm",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "Correct The Sentence",
productVersion: "0.1.0",
// ═══ MEMORY SETTINGS ═══
// Match what you set in Player Settings
// These override if present
};
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = function () {
createUnityInstance(
document.getElementById("unity-canvas"),
config,
function (progress) {
var pct = Math.round(progress * 100);
loadingBar.style.width = pct + '%';
loadingText.textContent = pct < 100 ? 'Loading... ' + pct + '%' : 'Starting...';
}
).then(function (instance) {
loadingScreen.classList.add('fade-out');
setTimeout(function () {
loadingScreen.style.display = 'none';
}, 600);
resizeCanvas();
// ═══ PREVENT ACCIDENTAL NAVIGATION ═══
window.addEventListener('beforeunload', function(e) {
e.preventDefault();
e.returnValue = '';
});
}).catch(function (message) {
loadingText.textContent = 'Error: ' + message;
loadingBar.style.background = '#ff3333';
console.error(message);
});
};
document.body.appendChild(script);
// ═══ PREVENT CONTEXT MENU ON CANVAS ═══
document.getElementById('unity-canvas').addEventListener('contextmenu', function(e) {
e.preventDefault();
});
// ═══ FOCUS CANVAS ON CLICK (fixes keyboard input) ═══
document.addEventListener('click', function() {
document.getElementById('unity-canvas').focus();
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Correct The Sentence</title>
<!-- ═══ ANTI-CACHE ═══ -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<!-- ═══ PRECONNECT TO CDN — speeds up HLS chunk fetching ═══ -->
<!-- Replace with your actual PeerTube domain -->
<link rel="preconnect" href="https://your-peertube-instance.com" crossorigin>
<link rel="dns-prefetch" href="https://your-peertube-instance.com">
<!-- ═══ PRELOAD HLS.js — starts downloading before Unity even loads ═══ -->
<link rel="preload" href="https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js" as="script" crossorigin>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
overflow: hidden;
background: #000;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
/* Prevent pull-to-refresh on mobile */
overscroll-behavior: none;
touch-action: none;
}
#unity-container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: #000;
}
#unity-canvas {
background: #000;
/* Prevent blurry scaling */
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
/* ═══ LOADING SCREEN ═══ */
#loading-screen {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
background: #000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 1000;
transition: opacity 0.5s ease;
}
#loading-screen.fade-out {
opacity: 0;
pointer-events: none;
}
#loading-logo {
max-width: 200px;
max-height: 200px;
margin-bottom: 40px;
animation: logoPulse 2s ease-in-out infinite;
}
@keyframes logoPulse {
0%, 100% { transform: scale(1); opacity: 0.9; }
50% { transform: scale(1.05); opacity: 1; }
}
#loading-bar-container {
width: 280px;
height: 6px;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
overflow: hidden;
margin-bottom: 16px;
}
#loading-bar {
width: 0%;
height: 100%;
background: #FED700;
border-radius: 3px;
transition: width 0.3s ease;
box-shadow: 0 0 10px rgba(254, 215, 0, 0.4);
}
#loading-text {
color: rgba(255, 255, 255, 0.5);
font-size: 13px;
letter-spacing: 0.5px;
}
</style>
</head>
<body>
<div id="unity-container">
<canvas id="unity-canvas" tabindex="-1"></canvas>
</div>
<div id="loading-screen">
<img id="loading-logo" src="logo.png" alt="Loading">
<div id="loading-bar-container">
<div id="loading-bar"></div>
</div>
<div id="loading-text">Loading...</div>
</div>
<script>
// ═══ 16:9 ASPECT RATIO LOCK ═══
function resizeCanvas() {
var container = document.getElementById('unity-container');
var canvas = document.getElementById('unity-canvas');
var windowW = window.innerWidth;
var windowH = window.innerHeight;
var targetAspect = 16 / 9;
var windowAspect = windowW / windowH;
var canvasW, canvasH;
if (windowAspect > targetAspect) {
canvasH = windowH;
canvasW = Math.floor(windowH * targetAspect);
} else {
canvasW = windowW;
canvasH = Math.floor(windowW / targetAspect);
}
canvas.style.width = canvasW + 'px';
canvas.style.height = canvasH + 'px';
canvas.width = canvasW;
canvas.height = canvasH;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// ═══ PRELOAD HLS.js INTO CACHE BEFORE UNITY BOOTS ═══
// This way when the jslib calls ensureHls(), it's already loaded
(function() {
var hlsScript = document.createElement('script');
hlsScript.src = 'https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js';
hlsScript.async = true;
document.head.appendChild(hlsScript);
})();
// ═══ UNITY LOADER ═══
var loadingBar = document.getElementById('loading-bar');
var loadingText = document.getElementById('loading-text');
var loadingScreen = document.getElementById('loading-screen');
// Cache-bust the loader URL in development
// Remove the timestamp parameter for production
var buildUrl = "Build";
var cacheBust = ""; // Set to "?t=" + Date.now() during development
var loaderUrl = buildUrl + "/CS Build.loader.js" + cacheBust;
var config = {
dataUrl: buildUrl + "/CS Build.data",
frameworkUrl: buildUrl + "/CS Build.framework.js",
codeUrl: buildUrl + "/CS Build.wasm",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "Correct The Sentence",
productVersion: "0.1.0",
// ═══ MEMORY SETTINGS ═══
// Match what you set in Player Settings
// These override if present
};
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = function () {
createUnityInstance(
document.getElementById("unity-canvas"),
config,
function (progress) {
var pct = Math.round(progress * 100);
loadingBar.style.width = pct + '%';
loadingText.textContent = pct < 100 ? 'Loading... ' + pct + '%' : 'Starting...';
}
).then(function (instance) {
loadingScreen.classList.add('fade-out');
setTimeout(function () {
loadingScreen.style.display = 'none';
}, 600);
resizeCanvas();
// ═══ PREVENT ACCIDENTAL NAVIGATION ═══
window.addEventListener('beforeunload', function(e) {
e.preventDefault();
e.returnValue = '';
});
}).catch(function (message) {
loadingText.textContent = 'Error: ' + message;
loadingBar.style.background = '#ff3333';
console.error(message);
});
};
document.body.appendChild(script);
// ═══ PREVENT CONTEXT MENU ON CANVAS ═══
document.getElementById('unity-canvas').addEventListener('contextmenu', function(e) {
e.preventDefault();
});
// ═══ FOCUS CANVAS ON CLICK (fixes keyboard input) ═══
document.addEventListener('click', function() {
document.getElementById('unity-canvas').focus();
});
</script>
</body>
</html>
......@@ -2,6 +2,7 @@
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.ai.navigation": "2.0.10",
"com.unity.cinemachine": "3.1.6",
"com.unity.collab-proxy": "2.11.3",
"com.unity.ide.rider": "3.0.39",
"com.unity.ide.visualstudio": "2.0.26",
......
......@@ -25,6 +25,16 @@
},
"url": "https://packages.unity.com"
},
"com.unity.cinemachine": {
"version": "3.1.6",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.splines": "2.0.0",
"com.unity.modules.imgui": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "2.11.3",
"depth": 0,
......@@ -155,6 +165,13 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.settings-manager": {
"version": "2.1.1",
"depth": 2,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.shadergraph": {
"version": "17.3.0",
"depth": 0,
......@@ -164,6 +181,17 @@
"com.unity.searcher": "4.9.3"
}
},
"com.unity.splines": {
"version": "2.8.2",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.mathematics": "1.2.1",
"com.unity.modules.imgui": "1.0.0",
"com.unity.settings-manager": "1.0.3"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.6.0",
"depth": 0,
......
......@@ -13,11 +13,11 @@ PlayerSettings:
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
productName: My project
productName: Correct The Sentence
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
m_ShowUnitySplashScreen: 1
m_ShowUnitySplashScreen: 0
m_ShowUnitySplashLogo: 1
m_SplashScreenOverlayOpacity: 1
m_SplashScreenAnimation: 1
......@@ -44,8 +44,8 @@ PlayerSettings:
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1024
defaultScreenHeight: 768
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
defaultScreenWidthWeb: 1920
defaultScreenHeightWeb: 1080
m_StereoRenderingPath: 0
m_ActiveColorSpace: 1
unsupportedMSAAFallback: 0
......@@ -815,10 +815,10 @@ PlayerSettings:
webGLDebugSymbols: 0
webGLEmscriptenArgs:
webGLModulesDirectory:
webGLTemplate: APPLICATION:Default
webGLTemplate: PROJECT:InteractiveVideo
webGLAnalyzeBuildSize: 0
webGLUseEmbeddedResources: 0
webGLCompressionFormat: 0
webGLCompressionFormat: 2
webGLWasmArithmeticExceptions: 0
webGLLinkerTarget: 1
webGLThreadsSupport: 0
......
......@@ -9,34 +9,34 @@ EditorUserSettings:
value: 18134705175a055722080a3115371d4a0d55006876786860616b0471b8b2656eacb72ba5a52a362c3c0ee63201181433fe3e101bf3250b06144ca74c24f1190708e016c213c61a52f91c12cac80fd8edd298e1e4d1fde2cacddeacbcc1fee7eef0e3b6faa69af9ceaeaaec81a6d2c2c8c8c4b2e5dfd5ccd3f8cf
flags: 0
RecentlyUsedSceneGuid-0:
value: 0502565f000c0d5a0908597b43720f4443154f7d787d74337b7b1e60e1e4363b
value: 5706045655515e590859587b127b09444e15482f287f72347d704b66bae36d60
flags: 0
RecentlyUsedSceneGuid-1:
value: 5706045655515e590859587b127b09444e15482f287f72347d704b66bae36d60
value: 52530450570659030f0b0d751577064441154128742b23692f7d4a61e0b5623d
flags: 0
RecentlyUsedSceneGuid-2:
value: 52530450570659030f0b0d751577064441154128742b23692f7d4a61e0b5623d
value: 5a08575f5207595a0f5d59741173094444164f7d7d2a23317c7a4465bbe1646d
flags: 0
RecentlyUsedSceneGuid-3:
value: 5a08575f5207595a0f5d59741173094444164f7d7d2a23317c7a4465bbe1646d
value: 0003525055055d020e0b0a7216755d444215417e787d27362e2f4866b2e1323e
flags: 0
RecentlyUsedSceneGuid-4:
value: 0003525055055d020e0b0a7216755d444215417e787d27362e2f4866b2e1323e
value: 000305555d01595a5c5d082143700911134e1c737b2b7763782c1962b5b3666d
flags: 0
RecentlyUsedSceneGuid-5:
value: 000305555d01595a5c5d082143700911134e1c737b2b7763782c1962b5b3666d
value: 5304575f5c0c51035d5a5e771271594417154e7c2d7b70647b7b4c35bbe1646d
flags: 0
RecentlyUsedSceneGuid-6:
value: 5304575f5c0c51035d5a5e771271594417154e7c2d7b70647b7b4c35bbe1646d
value: 5701055506000a030f5c542744260844404f4d73797975367c2c1e6ab7e2653d
flags: 0
RecentlyUsedSceneGuid-7:
value: 5701055506000a030f5c542744260844404f4d73797975367c2c1e6ab7e2653d
value: 5a550c5151505d080f5a5b21442206444e161d7e2f2c7735297d1f64bab76c61
flags: 0
RecentlyUsedSceneGuid-8:
value: 5a550c5151505d080f5a5b21442206444e161d7e2f2c7735297d1f64bab76c61
value: 5301045250005d095b5e082315710e48474f1a787d2c25622b7e186bb5b4646f
flags: 0
RecentlyUsedSceneGuid-9:
value: 5301045250005d095b5e082315710e48474f1a787d2c25622b7e186bb5b4646f
value: 54035150530d5d580f580e7b16220f4415154e737b2b75367a711f6be0b66c61
flags: 0
UnityEditor.ShaderGraph.Blackboard:
value: 18135939215a0a5004000b0e15254b524c030a3f2964643d120d1230e9e93a3fd6e826abbd2e2d293c4ead313b08042de6030a0afa240c0d020be94c4ba75e435d8715fa32c70d15d11612dacc11fee5d3c5d1fe9ab1bf968e93e2ffcbc3e7e2f0b3ffe0e8b0be9af8ffaeffff8e85dd8390e3949c8899daa7
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment