Commit d72fc280 authored by saad's avatar saad

save

parent e615eb0b
fileFormatVersion: 2
guid: 89874a04686bb5153a50e0bff088576c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
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: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
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: 2
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
This diff is collapsed.
fileFormatVersion: 2
guid: bc40c601e49e0504c8b9ba560ae80806
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -7,33 +7,61 @@ using ALArcade.ArabicTMP;
namespace com.al_arcade.cs
{
using System.Collections;
using System.Linq;
using LightSide;
using shared;
public class CsUIManager : MonoBehaviour
{
[SerializeField] protected Canvas _canvas;
[SerializeField] protected CanvasGroup _gameUI, _loadingUI, _errorUI, _resultsUI;
[SerializeField] protected CanvasGroup _gameUI, _loadingUI, _errorUI, _resultsUI, _countDownGroup;
[SerializeField] protected CanvasGroup _optionsPanel, _feedbackGroup;
[SerializeField] protected UniText _progressText;
[SerializeField] protected UniText _hintText, _scoreText, _streakText;
[SerializeField] protected UniText _feedbackText;
[SerializeField] protected Image _feedbackBg, _progressFill;
[SerializeField] protected Image _feedbackBg, _timerFill;
[SerializeField] protected ArabicTextMeshProUGUI _loadingText, _errorText;
[SerializeField] protected UniText _resultTitle, _resultScore, _resultStats;
[SerializeField] protected UniText _resultTitle, _resultScore, _resultStats, _countDownText, _timerText, _timerUpdateText;
[SerializeField] protected Transform _optionsContainer;
[SerializeField] protected Button _restartButton;
[SerializeField] protected Slider _timerSlider;
[SerializeField] protected Transform _pointsContainer;
[SerializeField] protected Color _activePointColor, _inactivePointColor;
[SerializeField] protected RawImage _speaker;
[SerializeField] protected Transform _slash;
private Color _timerDefaultColor;
List<Image> _pointImages;
protected List<CsOptionDraggable> _activeOptions = new();
private Color _speakerColor;
private float timeLeft;
private bool isTweening;
public bool isMusicOn = true;
[Header("Events")]
public UnityEvent onRestartClicked;
void Start()
{
_restartButton.onClick.AddListener(() => CsGameManager.Instance.ResetGame());
_pointImages = _pointsContainer.GetComponentsInChildren<Image>().ToList();
_speakerColor = _speaker.color;
_timerDefaultColor = _timerFill.color;
_speaker.GetComponent<Button>().onClick.AddListener(ToggleMusic);
_restartButton.onClick.AddListener(() =>
{
CsGameManager.Instance.ResetGame();
CsGameManager.Instance.StartGame();
});
isMusicOn = true;
}
public virtual void BuildUI()
......@@ -298,12 +326,12 @@ namespace com.al_arcade.cs
public void SetProgress(int current, int total)
{
if (_progressText != null) _progressText.Text = $"{current} / {total}";
if (_progressFill != null && total > 0)
{
DOTween.Kill(_progressFill.rectTransform, "pFill");
_progressFill.rectTransform.DOAnchorMax(new Vector2((float)current / total, 1f), 0.5f)
.SetEase(Ease.OutQuad).SetId("pFill");
}
// if (_progressFill != null && total > 0)
// {
// DOTween.Kill(_progressFill.rectTransform, "pFill");
// _progressFill.rectTransform.DOAnchorMax(new Vector2((float)current / total, 1f), 0.5f)
// .SetEase(Ease.OutQuad).SetId("pFill");
// }
}
public void ShowHint(string hint)
......@@ -311,10 +339,17 @@ namespace com.al_arcade.cs
if (_hintText == null) return;
_hintText.Text = hint;
DOTween.Kill(_hintText, "hintFade");
// _hintText.alp = 0;
_hintText.rectTransform.DOPunchScale(Vector3.one * 0.1f, 0.4f, 6, 0.3f).SetId("hintFade");
_hintText.DOFade(1, 0.4f).SetId("hintFade");
}
public void HideHint()
{
if (_hintText == null) return;
DOTween.Kill(_hintText, "hintFade");
_hintText.DOFade(0, 0.3f).SetId("hintFade");
}
public void ShowFeedback(string message, bool isCorrect)
{
if (_feedbackText != null) _feedbackText.Text = message;
......@@ -403,14 +438,38 @@ namespace com.al_arcade.cs
public void ShowError(string msg)
{ _errorUI.gameObject.SetActive(true); if (_errorText != null) _errorText.arabicText = msg; _errorUI.DOFade(1f, 0.3f); }
public void ShowResults(int score, int correct, int wrong, int total, int bestStreak)
public IEnumerator ShowCountDown()
{
_countDownGroup.gameObject.SetActive(true);
_countDownGroup.DOFade(1f, 0.3f);
int count = 3;
while (count > 0)
{
SSAudioManager.Instance.PlayPop();
_countDownText.transform.DOScale(1f, 0.2f).From(0).SetEase(Ease.OutBack);
_countDownText.Text = count.ToString();
yield return new WaitForSeconds(1f);
count--;
}
SSAudioManager.Instance.PlayPop();
_countDownText.transform.DOScale(1f, 0.2f).From(0).SetEase(Ease.OutBack);
_countDownText.Text = "ابدأ!";
yield return new WaitForSeconds(0.1f);
_countDownGroup.DOFade(0f, 0.3f).OnComplete(() => _countDownGroup.gameObject.SetActive(false));
}
public void ShowResults(int score, int correct, int wrong, int total, int bestStreak, bool win = true)
{
_resultsUI.gameObject.SetActive(true);
_resultsUI.alpha = 0;
float pct = total > 0 ? (float)correct / total * 100f : 0;
if (_resultTitle != null)
_resultTitle.Text = pct >= 70 ? "أحسنت!" : "عمل جيد!";
_resultTitle.Text = win ? pct >= 70 ? "أحسنت!" : "عمل جيد!" : "حظ اوفر";
if (_resultScore != null) _resultScore.Text = score.ToString("N0");
if (_resultStats != null)
_resultStats.Text = $"صحيح: {correct} / {total} | " +
......@@ -434,6 +493,40 @@ namespace com.al_arcade.cs
}
}
public void SetTimer(float time)
{
if (isTweening) return;
_timerSlider.value = time / 30f;
_timerFill.color = time > 4f ? _timerDefaultColor : SSColorPalette.Danger;
}
public void UpdateTimer(float time, bool pos)
{
isTweening = true;
var color = pos ? SSColorPalette.CorrectWord : SSColorPalette.Danger;
_timerSlider.transform.DOPunchScale(Vector3.one * 0.1f, 0.3f, 8, 0.3f);
_timerFill.DOColor(color, 0.2f).SetEase(Ease.OutQuad).OnComplete(() =>
{
_timerFill.DOColor(_timerDefaultColor, 0.2f).SetEase(Ease.OutQuad);
});
var targetTime = time;
// Account for tween time
if (!pos)
{
targetTime -= 0.3f;
}
_timerSlider.DOValue(targetTime / 30f, 0.3f).SetEase(Ease.OutQuad).OnComplete(() =>
{
isTweening = false;
});
}
public void ResetUI()
{
if (_gameUI != null) { _gameUI.alpha = 0; _gameUI.gameObject.SetActive(false); }
......@@ -442,9 +535,39 @@ namespace com.al_arcade.cs
if (_resultsUI != null) { _resultsUI.alpha = 0; _resultsUI.gameObject.SetActive(false); }
if (_optionsPanel != null) { _optionsPanel.alpha = 0; _optionsPanel.gameObject.SetActive(false); }
if (_feedbackGroup != null) _feedbackGroup.alpha = 0;
_timerSlider.value = 1f;
_timerFill.color = _timerDefaultColor;
TickPoints(0);
SetStreak(0);
ClearOptions();
}
public void TickPoints(int count)
{
for (int i = 0; i < _pointImages.Count; i++)
{
var img = _pointImages[i];
if (i < count)
{
img.color = _activePointColor;
img.transform.DOPunchScale(Vector3.one * 0.4f, 0.4f).SetEase(Ease.OutElastic).SetDelay(0.1f * i);
}
else
{
img.color = SSColorPalette.WithAlpha(_inactivePointColor, 0.3f);
img.transform.localScale = Vector3.one;
}
}
}
public void ToggleMusic()
{
isMusicOn = !isMusicOn;
/*if (isMusicOn) SSAudioManager.Instance.PlayMusic();
else SSAudioManager.Instance.StopMusic();*/
_slash.gameObject.SetActive(!isMusicOn);
}
protected GameObject MkFull(Transform p, string n)
{
......
......@@ -16,17 +16,28 @@ namespace com.al_arcade.tf
[SerializeField] private CanvasGroup _gameUI, _loadingUI, _errorUI, _resultsUI;
[SerializeField] private UniText _scoreText, _streakText;
[SerializeField] private ArabicTextMeshProUGUI _loadingText, _errorText;
[SerializeField] private Image _progressFill;
[SerializeField] private UniText _progressLabel;
[SerializeField] private UniText _resultTitle, _resultScore, _resultStats;
[SerializeField] private Button _restartButton;
[SerializeField] private Slider _timerSlider;
[SerializeField] private Image _timerFill;
[SerializeField] private UniText _timerText;
[SerializeField] private float _maxTime = 30f;
private bool _isTweening;
private Color _timerDefaultColor;
[Header("Events")]
public UnityEvent onRestartClicked;
private void Start()
{
_restartButton.onClick.AddListener(RestartButton);
if (_timerFill != null)
_timerDefaultColor = _timerFill.color;
}
void RestartButton()
......@@ -116,8 +127,6 @@ namespace com.al_arcade.tf
fr.offsetMin = Vector2.zero;
fr.offsetMax = Vector2.zero;
_progressFill = fill.AddComponent<Image>();
_progressFill.color = SSColorPalette.Accent;
var hintObj = new GameObject("HintBg");
hintObj.transform.SetParent(go.transform, false);
......@@ -305,18 +314,6 @@ namespace com.al_arcade.tf
if (_progressLabel != null)
_progressLabel.Text = $"{cur} / {total}";
if (_progressFill != null && total > 0)
{
DOTween.Kill(_progressFill.rectTransform, "pf");
_progressFill.rectTransform
.DOAnchorMax(
new Vector2((float)cur / total, 1),
0.4f
)
.SetEase(Ease.OutQuad)
.SetId("pf");
}
}
public void ShowLoading(string m)
......
......@@ -27,16 +27,16 @@ EditorUserSettings:
value: 000305555d01595a5c5d082143700911134e1c737b2b7763782c1962b5b3666d
flags: 0
RecentlyUsedSceneGuid-6:
value: 5304575f5c0c51035d5a5e771271594417154e7c2d7b70647b7b4c35bbe1646d
value: 5305555052020c5a0f5758701670074444151b7c7e7b7164747e4a66bbb6603c
flags: 0
RecentlyUsedSceneGuid-7:
value: 5305555052020c5a0f5758701670074444151b7c7e7b7164747e4a66bbb6603c
value: 5304575f5c0c51035d5a5e771271594417154e7c2d7b70647b7b4c35bbe1646d
flags: 0
RecentlyUsedSceneGuid-8:
value: 0003525055055d020e0b0a7216755d444215417e787d27362e2f4866b2e1323e
value: 5701055506000a030f5c542744260844404f4d73797975367c2c1e6ab7e2653d
flags: 0
RecentlyUsedSceneGuid-9:
value: 5701055506000a030f5c542744260844404f4d73797975367c2c1e6ab7e2653d
value: 0003525055055d020e0b0a7216755d444215417e787d27362e2f4866b2e1323e
flags: 0
UnityEditor.ShaderGraph.Blackboard:
value: 18135939215a0a5004000b0e15254b524c030a3f2964643d120d1230e9e93a3fd6e826abbd2e2d293c4ead313b08042de6030a0afa240c0d020be94c4ba75e435d8715fa32c70d15d11612dacc11fee5d3c5d1fe9ab1bf968e93e2ffcbc3e7e2f0b3ffe0e8b0be9af8ffaeffff8e85dd8390e3949c8899daa7
......
......@@ -24,7 +24,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 112}
m_MaxSize: {x: 32384, y: 16192}
vertical: 0
controlID: 175520
controlID: 179236
draggingID: 0
--- !u!114 &2
MonoBehaviour:
......@@ -153,7 +153,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 112}
m_MaxSize: {x: 24288, y: 16192}
vertical: 1
controlID: 175521
controlID: 179237
draggingID: 0
--- !u!114 &4
MonoBehaviour:
......@@ -180,7 +180,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 56}
m_MaxSize: {x: 24288, y: 8096}
vertical: 0
controlID: 175522
controlID: 179238
draggingID: 0
--- !u!114 &5
MonoBehaviour:
......@@ -201,8 +201,8 @@ MonoBehaviour:
y: 0
width: 271.2
height: 436.8
m_MinSize: {x: 201, y: 226}
m_MaxSize: {x: 4001, y: 4026}
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 6}
m_Panes:
- {fileID: 6}
......@@ -250,10 +250,17 @@ MonoBehaviour:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
- m_Data: 274798
- m_Data: 334866
m_LastClickedID:
m_Data: 274798
m_Data: 334866
m_ExpandedIDs:
- m_Data: -544946
- m_Data: -542138
- m_Data: -530734
- m_Data: -530452
- m_Data: -524174
- m_Data: -508882
- m_Data: -508274
- m_Data: -483572
- m_Data: -483566
- m_Data: -457616
......@@ -937,6 +944,20 @@ MonoBehaviour:
layout: 4
size: {x: 0, y: 0}
sizeOverridden: 0
- dockPosition: 1
containerId: overlay-container--right
displayed: 0
id: unity-spline-inspector
index: 16
contents: '{"m_Layout":4,"m_Collapsed":false,"m_Folded":false,"m_Floating":false,"m_FloatingSnapOffset":{"x":0.0,"y":0.0},"m_SnapOffsetDelta":{"x":0.0,"y":0.0},"m_FloatingSnapCorner":0,"m_Size":{"x":0.0,"y":0.0},"m_SizeOverridden":false}'
floating: 0
collapsed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
layout: 4
size: {x: 0, y: 0}
sizeOverridden: 0
m_ContainerData:
- containerId: overlay-toolbar__top
scrollOffset: 0
......@@ -974,15 +995,15 @@ MonoBehaviour:
m_OverrideSceneCullingMask: 6917529027641081856
m_SceneIsLit: 1
m_SceneLighting: 1
m_2DMode: 0
m_2DMode: 1
m_isRotationLocked: 0
m_PlayAudio: 0
m_AudioPlay: 0
m_DebugDrawModesUseInteractiveLightBakingData: 0
m_Position:
m_Target: {x: -6.3179355, y: 24.631266, z: -25.44367}
m_Target: {x: 913.6812, y: 469.23666, z: -30.375166}
speed: 2
m_Value: {x: -6.3179355, y: 24.631266, z: -25.44367}
m_Value: {x: 913.6812, y: 469.23666, z: -30.375166}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
......@@ -1010,17 +1031,17 @@ MonoBehaviour:
m_Size: {x: 2, y: 2}
yGrid:
m_Fade:
m_Target: 1
m_Target: 0
speed: 2
m_Value: 1
m_Value: 0
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 2, y: 2}
zGrid:
m_Fade:
m_Target: 0
m_Target: 1
speed: 2
m_Value: 0
m_Value: 1
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 2, y: 2}
......@@ -1028,17 +1049,17 @@ MonoBehaviour:
m_GridAxis: 1
m_gridOpacity: 0.5
m_Rotation:
m_Target: {x: 0.25157583, y: 0.56257, z: -0.18475792, w: 0.7657122}
m_Target: {x: 0, y: 0, z: 0, w: 1}
speed: 2
m_Value: {x: 0.25157586, y: 0.56257004, z: -0.18475793, w: 0.76571226}
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 4.3906
m_Target: 610.95966
speed: 2
m_Value: 4.3906
m_Value: 610.95966
m_Ortho:
m_Target: 0
m_Target: 1
speed: 2
m_Value: 0
m_Value: 1
m_CameraSettings:
m_Speed: 1.9400301
m_SpeedNormalized: 0.97
......@@ -1052,7 +1073,7 @@ MonoBehaviour:
m_FarClip: 10000
m_DynamicClip: 1
m_OcclusionCulling: 0
m_LastSceneViewRotation: {x: 0.10358317, y: -0.89522, z: 0.28105867, w: 0.3299364}
m_LastSceneViewRotation: {x: 0.029967543, y: 0.043167114, z: -0.0012954315, w: 0.9986187}
m_LastSceneViewOrtho: 0
m_Viewpoint:
m_SceneView: {fileID: 8}
......@@ -1189,7 +1210,7 @@ MonoBehaviour:
m_IsLocked: 0
m_LastLocalAssetsSearchArea: 1
m_FolderTreeState:
scrollPos: {x: 0, y: 404.04156}
scrollPos: {x: 0, y: 324.88855}
m_SelectedIDs:
- m_Data: 52244
m_LastClickedID:
......@@ -1211,8 +1232,8 @@ MonoBehaviour:
- m_Data: 91042
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
m_OriginalName:
m_Name: Prefabs
m_OriginalName: Prefabs
m_EditFieldRect:
serializedVersion: 2
x: 0
......@@ -1220,10 +1241,10 @@ MonoBehaviour:
width: 0
height: 0
m_UserData:
m_Data: 0
m_Data: 51864
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 11
m_OriginalEventType: 0
m_IsRenamingFilename: 1
m_TrimLeadingAndTrailingWhitespace: 0
m_ClientGUIView: {fileID: 10}
......@@ -1281,9 +1302,9 @@ MonoBehaviour:
m_ResourceFile:
m_ListAreaState:
m_SelectedInstanceIDs:
- m_Data: 274798
m_LastClickedInstanceID: 274798
m_HadKeyboardFocusLastEvent: 0
- m_Data: 334866
m_LastClickedInstanceID: 334866
m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs:
- m_Data: 55308
- m_Data: 82478
......@@ -1430,7 +1451,7 @@ MonoBehaviour:
m_DynamicPanelBehavior: 0
m_LockTracker:
m_IsLocked: 0
m_LastSelectedObjectID: 274798
m_LastSelectedObjectID: 0
--- !u!114 &14
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -1454,7 +1475,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 516
width: 1147.8
width: 1167.8
height: 254
m_SerializedDataModeController:
m_DataMode: 0
......@@ -1488,8 +1509,8 @@ MonoBehaviour:
y: 0
width: 367.19995
height: 716.8
m_MinSize: {x: 276, y: 76}
m_MaxSize: {x: 4001, y: 4026}
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 16}
......@@ -1540,7 +1561,7 @@ MonoBehaviour:
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_LastInspectedObjectInstanceID: -1
m_LastVerticalScrollValue: 422
m_LastVerticalScrollValue: 372
m_GlobalObjectId:
m_InspectorMode: 0
m_LockTracker:
......
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