Commit 6245cea9 authored by Yousef Sameh's avatar Yousef Sameh

CS Edited for phone layout

parent b54c2e6e
fileFormatVersion: 2
guid: f4227764308e84f89a765fbf315e2945
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 41e59f562b69648719f2424c438758f3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -589,10 +589,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 6526277751377335439}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 1650.7, y: -20.6}
m_SizeDelta: {x: 158.7438, y: 46.802}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -183.50012, y: 27.100069}
m_SizeDelta: {x: 133.7, y: 46.802}
m_Pivot: {x: 0, y: 1}
--- !u!222 &8980969202422458305
CanvasRenderer:
......@@ -629,7 +629,7 @@ MonoBehaviour:
baseDirection: 2
wordWrap: 1
horizontalAlignment: 0
verticalAlignment: 0
verticalAlignment: 1
overEdge: 0
underEdge: 0
leadingDistribution: 0
......@@ -685,10 +685,10 @@ RectTransform:
- {fileID: 7338536414205531451}
m_Father: {fileID: 4905701994688567912}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.25, y: 1}
m_AnchorMax: {x: 0.75, y: 1}
m_AnchoredPosition: {x: 0, y: -121}
m_SizeDelta: {x: 719.2881, y: 10}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -138}
m_SizeDelta: {x: 0, y: 10}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &1734913730316605427
CanvasRenderer:
......@@ -811,10 +811,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 6526277751377335439}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 522.6, y: 25.967}
m_SizeDelta: {x: 197.23248, y: 52.179413}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 92.1, y: 26.0895}
m_SizeDelta: {x: 84.24701, y: 52.179}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &2030891740133995929
CanvasRenderer:
......@@ -2488,10 +2488,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 6526277751377335439}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 1520.5, y: -20.599976}
m_SizeDelta: {x: 130.2, y: 46.802}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -288.078, y: 27.1}
m_SizeDelta: {x: 104.577, y: 46.802}
m_Pivot: {x: 0, y: 1}
--- !u!222 &7920660751121994183
CanvasRenderer:
......@@ -2678,8 +2678,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 25.967}
m_SizeDelta: {x: 141.7234, y: 51.934}
m_AnchoredPosition: {x: -6.6, y: 25.967}
m_SizeDelta: {x: 76.011, y: 51.934}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &4274779150537200741
CanvasRenderer:
......
......@@ -208,7 +208,6 @@ GameObject:
m_Component:
- component: {fileID: 1049087476}
- component: {fileID: 1049087475}
- component: {fileID: 1049087477}
- component: {fileID: 1049087472}
m_Layer: 0
m_Name: CinemachineCamera
......@@ -229,15 +228,15 @@ MonoBehaviour:
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.5}
FramingMode: 2
FramingSize: 0.9
CenterOffset: {x: 0, y: -0.7}
Damping: 1
SizeAdjustment: 2
LateralAdjustment: 0
FovRange: {x: 1, y: 100}
DollyRange: {x: -100, y: 100}
OrthoSizeRange: {x: 5, y: 11.82}
OrthoSizeRange: {x: 7, y: 15}
--- !u!114 &1049087475
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -290,31 +289,12 @@ Transform:
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_LocalPosition: {x: 0, y: 0, z: -10}
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
......@@ -385,6 +365,7 @@ MonoBehaviour:
arabicTextAppearance: {fileID: 11400000, guid: 3a559cf5d653f05ea807e1be5655df92, type: 2}
arabicFontStack: {fileID: 11400000, guid: 0029e5efb4c7a12f1ac9136de794e6dc, type: 2}
arabicTextPrefab: {fileID: 4670452904442138041, guid: d8881dd8fc8b73a2f9fac60499ce92bc, type: 3}
RoundedRect: {fileID: 21300000, guid: b94ad4425888548039a8c69d289a39d6, type: 3}
buildType: scistreet
gradeId: 0
questionCount: 8
......@@ -407,7 +388,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 3.99733, y: 0}
m_AnchoredPosition: {x: 2.19, y: -0.49}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1145369049
......@@ -540,7 +521,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
orthographic size: 7
m_Depth: -1
m_CullingMask:
serializedVersion: 2
......@@ -565,7 +546,7 @@ Transform:
m_GameObject: {fileID: 1677846864}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 2.5, z: -15}
m_LocalPosition: {x: 0, y: 4.9, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
......
......@@ -79,6 +79,7 @@ namespace com.al_arcade.cs
bool showHint = true;
CinemachineTargetGroup _targetGroup;
CinemachineGroupFraming _groupFraming;
private void Awake()
{
......@@ -90,6 +91,7 @@ namespace com.al_arcade.cs
Instance = this;
_targetGroup = FindFirstObjectByType<CinemachineTargetGroup>();
_groupFraming = FindFirstObjectByType<CinemachineGroupFraming>();
}
private void Update()
......@@ -323,7 +325,7 @@ namespace com.al_arcade.cs
}
else
{
yield return WrongOptionFeedback();
StartCoroutine(WrongOptionFeedback());
}
}
else
......@@ -380,7 +382,7 @@ namespace com.al_arcade.cs
if (_deltaChangeInSize == 5)
{
// Win
// Win
_state = CsGameState.Complete;
yield return VictorySequence();
yield break;
......@@ -430,56 +432,58 @@ namespace com.al_arcade.cs
return;
ClearWordButtons();
int wordCount = question.words.Length;
float padding = 0.1f;
float charWidth = 0.32f;
float[] wordWidths = new float[wordCount];
float totalWidth = 0;
for (int i = 0; i < wordCount; i++)
{
float w = question.words[i].word_text.Length * charWidth + padding;
w = Mathf.Max(w, 1.0f);
wordWidths[i] = w;
totalWidth += w;
}
float maxAllowedWidth = 14f;
float scaleFactor = 1f;
if (totalWidth > maxAllowedWidth)
{
scaleFactor = maxAllowedWidth / totalWidth;
for (int i = 0; i < wordCount; i++)
wordWidths[i] *= scaleFactor;
}
// Arc centre = camera position
Camera cam = Camera.main;
Vector3 arcCenter =
cam != null ? cam.transform.position + Vector3.up * 0.5f : Vector3.zero;
// Total arc-length consumed by words + gaps between them
float totalArcLength = 0f;
for (int i = 0; i < wordCount; i++)
totalArcLength += wordWidths[i];
totalArcLength += (wordCount - 1) * wordGap;
// Convert arc-length to angle: arcLength = radius * angleInRadians
float totalAngleRad = totalArcLength / arcRadius;
float totalAngleDeg = totalAngleRad * Mathf.Rad2Deg;
// Clamp to the configured arc span
float usedSpanDeg = Mathf.Min(totalAngleDeg, arcSpanDegrees);
float spanScale = usedSpanDeg / totalAngleDeg;
// Start from the right edge, centered on 90° (straight ahead in XZ)
float startAngleDeg = 90f - usedSpanDeg * 0.5f;
// Running arc-length cursor (from the start edge)
float cursorArcLength = 0f;
// Spawn Full Sentence
_groupFraming.CenterOffset = new Vector2(0f, -0.1f);
// int wordCount = question.words.Length;
// float padding = 0.1f;
// float charWidth = 0.32f;
// float[] wordWidths = new float[wordCount];
// float totalWidth = 0;
// for (int i = 0; i < wordCount; i++)
// {
// float w = question.words[i].word_text.Length * charWidth + padding;
// w = Mathf.Max(w, 1.0f);
// wordWidths[i] = w;
// totalWidth += w;
// }
// float maxAllowedWidth = 14f;
// float scaleFactor = 1f;
// if (totalWidth > maxAllowedWidth)
// {
// scaleFactor = maxAllowedWidth / totalWidth;
// for (int i = 0; i < wordCount; i++)
// wordWidths[i] *= scaleFactor;
// }
// // Arc centre = camera position
// Camera cam = Camera.main;
// Vector3 arcCenter =
// cam != null ? cam.transform.position + Vector3.up * 0.5f : Vector3.zero;
// // Total arc-length consumed by words + gaps between them
// float totalArcLength = 0f;
// for (int i = 0; i < wordCount; i++)
// totalArcLength += wordWidths[i];
// totalArcLength += (wordCount - 1) * wordGap;
// // Convert arc-length to angle: arcLength = radius * angleInRadians
// float totalAngleRad = totalArcLength / arcRadius;
// float totalAngleDeg = totalAngleRad * Mathf.Rad2Deg;
// // Clamp to the configured arc span
// float usedSpanDeg = Mathf.Min(totalAngleDeg, arcSpanDegrees);
// float spanScale = usedSpanDeg / totalAngleDeg;
// // Start from the right edge, centered on 90° (straight ahead in XZ)
// float startAngleDeg = 90f - usedSpanDeg * 0.5f;
// // Running arc-length cursor (from the start edge)
// float cursorArcLength = 0f;
// Spawn Full Sentence
var sentenceObj = new GameObject("FullQuestion");
sentenceObj.transform.SetParent(wordContainer);
......@@ -488,41 +492,40 @@ namespace com.al_arcade.cs
return;
for (int i = 0; i < wordCount; i++)
{
// Center of this word along the arc
float wordCenterArc = cursorArcLength + wordWidths[i] * 0.5f;
// Scale arc-length to fit within the allowed span
float arcFraction = totalArcLength > 0 ? wordCenterArc / totalArcLength : 0.5f;
float angleDeg = startAngleDeg + arcFraction * usedSpanDeg;
float angleRad = angleDeg * Mathf.Deg2Rad;
Vector3 pos =
arcCenter
+ new Vector3(
Mathf.Cos(angleRad) * arcRadius,
0f,
Mathf.Sin(angleRad) * arcRadius
);
var word = question.words[i];
var wordObj = new GameObject($"Word_{i}_{word.word_text}");
if (wordContainer != null)
wordObj.transform.SetParent(wordContainer);
wordObj.transform.position = pos;
var wb = wordObj.AddComponent<CsWordButton>();
wb.Setup(word.word_text, word.is_wrong, i, wordWidths[i], scaleFactor);
_wordButtons.Add(wb);
wordObj.transform.localScale = Vector3.zero;
wordObj
.transform.DOScale(Vector3.one, 0.4f)
.SetDelay(i * 0.08f)
.SetEase(Ease.OutBack);
cursorArcLength += wordWidths[i] + wordGap;
}
// for (int i = 0; i < wordCount; i++) {
// // Center of this word along the arc
// float wordCenterArc = cursorArcLength + wordWidths[i] * 0.5f;
// // Scale arc-length to fit within the allowed span
// float arcFraction = totalArcLength > 0 ? wordCenterArc / totalArcLength : 0.5f;
// float angleDeg = startAngleDeg + arcFraction * usedSpanDeg;
// float angleRad = angleDeg * Mathf.Deg2Rad;
// Vector3 pos =
// arcCenter
// + new Vector3(
// Mathf.Cos(angleRad) * arcRadius,
// 0f,
// Mathf.Sin(angleRad) * arcRadius
// );
// var word = question.words[i];
// var wordObj = new GameObject($"Word_{i}_{word.word_text}");
// if (wordContainer != null)
// wordObj.transform.SetParent(wordContainer);
// wordObj.transform.position = pos;
// var wb = wordObj.AddComponent<CsWordButton>();
// wb.Setup(word.word_text, word.is_wrong, i, wordWidths[i], scaleFactor);
// _wordButtons.Add(wb);
// wordObj.transform.localScale = Vector3.zero;
// wordObj
// .transform.DOScale(Vector3.one, 0.4f)
// .SetDelay(i * 0.08f)
// .SetEase(Ease.OutBack);
// cursorArcLength += wordWidths[i] + wordGap;
// }
}
private void ShowOptions()
......@@ -553,7 +556,10 @@ namespace com.al_arcade.cs
{
_targetGroup.RemoveMember(_targetGroup.Targets[1].Object);
_targetGroup.RemoveMember(_targetGroup.Targets[1].Object);
_targetGroup.RemoveMember(_targetGroup.Targets[1].Object);
}
_groupFraming.CenterOffset = new Vector2(0f, -0.7f);
}
private IEnumerator UnlockAfterCooldown()
......
......@@ -92,6 +92,7 @@ namespace com.al_arcade.cs
[SerializeField] public UniTextAppearance arabicTextAppearance;
[SerializeField] public UniTextFontStack arabicFontStack;
[SerializeField] public GameObject arabicTextPrefab;
[SerializeField] public Sprite RoundedRect;
[Header("Game Settings")]
[SerializeField] private string buildType = "scistreet";
......
<Solution>
<Project Path="Assembly-CSharp.csproj" />
<Project Path="LightSide.UniText.csproj" />
<Project Path="Unity.RenderPipelines.Universal.Runtime.csproj" />
<Project Path="FlatKit.Utils.Editor.csproj" />
<Project Path="ExternAttributes.Editor.csproj" />
<Project Path="LightSide.UniText.Editor.csproj" />
<Project Path="Assembly-CSharp-firstpass.csproj" />
<Project Path="Assembly-CSharp-Editor.csproj" />
</Solution>
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 61
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: de02f9e1d18f588468e474319d09a723, type: 3}
m_Name:
m_EditorClassIdentifier:
shaderVariantLimit: 128
overrideShaderVariantLimit: 0
customInterpolatorErrorThreshold: 32
customInterpolatorWarningThreshold: 16
customHeatmapValues: {fileID: 0}
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