Text Issues
This commit is contained in:
parent
33aeb3b742
commit
b4ff6148ed
91
Assets/CreateScrollableText.cs
Normal file
91
Assets/CreateScrollableText.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using ArabicSupport;
|
||||
|
||||
|
||||
public class CreateScrollableText : MonoBehaviour
|
||||
{
|
||||
public Font fallbackFont; // Optional fallback for TMP
|
||||
|
||||
[Header("Localization")]
|
||||
public string localizationKey = "example.key";
|
||||
public Canvas canvas;
|
||||
void Start()
|
||||
{
|
||||
|
||||
// Create Scroll View
|
||||
GameObject scrollViewGO = new GameObject("ScrollView", typeof(RectTransform), typeof(ScrollRect), typeof(Image));
|
||||
scrollViewGO.transform.SetParent(canvas.transform, false);
|
||||
RectTransform scrollViewRT = scrollViewGO.GetComponent<RectTransform>();
|
||||
scrollViewRT.sizeDelta = new Vector2(500, 300);
|
||||
scrollViewRT.anchoredPosition = Vector2.zero;
|
||||
|
||||
// Background image
|
||||
scrollViewGO.GetComponent<Image>().color = new Color(0.9f, 0.9f, 0.9f, 0.5f);
|
||||
|
||||
// Viewport
|
||||
GameObject viewportGO = new GameObject("Viewport", typeof(RectTransform), typeof(Image), typeof(Mask));
|
||||
viewportGO.transform.SetParent(scrollViewGO.transform, false);
|
||||
RectTransform viewportRT = viewportGO.GetComponent<RectTransform>();
|
||||
viewportRT.anchorMin = Vector2.zero;
|
||||
viewportRT.anchorMax = Vector2.one;
|
||||
viewportRT.offsetMin = Vector2.zero;
|
||||
viewportRT.offsetMax = Vector2.zero;
|
||||
viewportGO.GetComponent<Image>().color = Color.white;
|
||||
viewportGO.GetComponent<Mask>().showMaskGraphic = false;
|
||||
|
||||
// Content
|
||||
GameObject contentGO = new GameObject("Content", typeof(RectTransform), typeof(ContentSizeFitter), typeof(VerticalLayoutGroup));
|
||||
contentGO.transform.SetParent(viewportGO.transform, false);
|
||||
RectTransform contentRT = contentGO.GetComponent<RectTransform>();
|
||||
contentRT.anchorMin = new Vector2(0, 1);
|
||||
contentRT.anchorMax = new Vector2(1, 1);
|
||||
contentRT.pivot = new Vector2(0.5f, 1);
|
||||
contentRT.anchoredPosition = Vector2.zero;
|
||||
|
||||
var scrollRect = scrollViewGO.GetComponent<ScrollRect>();
|
||||
scrollRect.viewport = viewportRT;
|
||||
scrollRect.content = contentRT;
|
||||
scrollRect.horizontal = false;
|
||||
scrollRect.vertical = true;
|
||||
scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
||||
|
||||
// Content Sizing
|
||||
var csf = contentGO.GetComponent<ContentSizeFitter>();
|
||||
csf.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
|
||||
var layoutGroup = contentGO.GetComponent<VerticalLayoutGroup>();
|
||||
layoutGroup.childControlHeight = true;
|
||||
layoutGroup.childForceExpandHeight = false;
|
||||
layoutGroup.childAlignment = TextAnchor.UpperLeft;
|
||||
|
||||
// Text Element with LocalizedTextComponent
|
||||
GameObject textGO = new GameObject("LocalizedText", typeof(RectTransform), typeof(TextMeshProUGUI), typeof(LocalizedTextComponent));
|
||||
textGO.transform.SetParent(contentGO.transform, false);
|
||||
|
||||
RectTransform textRT = textGO.GetComponent<RectTransform>();
|
||||
textRT.anchorMin = new Vector2(0, 1);
|
||||
textRT.anchorMax = new Vector2(1, 1);
|
||||
textRT.pivot = new Vector2(0.5f, 1);
|
||||
textRT.offsetMin = new Vector2(10, 0); // Padding
|
||||
textRT.offsetMax = new Vector2(-10, 0);
|
||||
|
||||
// Configure TMP
|
||||
var tmp = textGO.GetComponent<TextMeshProUGUI>();
|
||||
tmp.fontSize = 24;
|
||||
tmp.enableWordWrapping = true;
|
||||
tmp.overflowMode = TextOverflowModes.Overflow;
|
||||
|
||||
if (fallbackFont)
|
||||
tmp.font = TMP_FontAsset.CreateFontAsset(fallbackFont);
|
||||
|
||||
// LocalizedTextComponent setup
|
||||
var localizedText = textGO.GetComponent<LocalizedTextComponent>();
|
||||
localizedText.localizationKey = localizationKey;
|
||||
|
||||
// Trigger the update manually if LanguageManager is ready
|
||||
if (LanguageManager.Instance != null)
|
||||
localizedText.UpdateText();
|
||||
}
|
||||
}
|
11
Assets/CreateScrollableText.cs.meta
Normal file
11
Assets/CreateScrollableText.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44d9bed5e8fcef54c9eb9224d3be4d5e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -3734,6 +3734,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: Mismatched Sender
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &48612848
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -11665,6 +11666,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: compose
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &152581993 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4837329652793204, guid: 88498815dea432045b6eaa9875ec268a, type: 3}
|
||||
@ -17469,6 +17471,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: mail
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &232780965 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4245025388696848, guid: d6ede9f320f63de4f8bd9626df44ed6f, type: 3}
|
||||
@ -29917,7 +29920,7 @@ MonoBehaviour:
|
||||
languageDB: {fileID: 11400000, guid: a0995cee7b744cd49b66a13a828a98d1, type: 2}
|
||||
currentLanguage: English
|
||||
fontEnglish: {fileID: 11400000, guid: 9f7cb4b53799717478f208258f1af701, type: 2}
|
||||
fontArabic: {fileID: 11400000, guid: 5d7d7d6271e9ff04b99c8a2c50c4f464, type: 2}
|
||||
fontArabic: {fileID: 11400000, guid: 12edf91a1789477408db5a46077c3e5b, type: 2}
|
||||
languageLabel: {fileID: 694310787}
|
||||
languageSetBool: 0
|
||||
--- !u!4 &401603027
|
||||
@ -31799,6 +31802,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: start
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &426522969 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4527185568398708, guid: 66924574c80a24a44bdf782e3e7635d0, type: 3}
|
||||
@ -36329,6 +36333,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: All of the above
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &489090763
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -36768,6 +36773,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: newEmail
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &490893920
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -38452,6 +38458,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: WHY ITS DANGEROUS!
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &520169784
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -40604,6 +40611,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: Mini Quiz
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &552026572 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4270791331071568, guid: f0bfb58546547264682d6066f7947e72, type: 3}
|
||||
@ -49663,6 +49671,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: Typos in the subject
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &662615422
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -50823,6 +50832,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: draft
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &681179751
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -53719,6 +53729,113 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 07959b3ef64efdd41b4b8022c923f37e, type: 3}
|
||||
--- !u!1 &729222737
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 729222738}
|
||||
- component: {fileID: 729222741}
|
||||
- component: {fileID: 729222740}
|
||||
- component: {fileID: 729222739}
|
||||
m_Layer: 0
|
||||
m_Name: Scroll View
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &729222738
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 729222737}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0.0000002386515}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 993485511}
|
||||
m_Father: {fileID: 991103584}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0.0000011920929, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &729222739
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 729222737}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 1163356059}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 993485511}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 0}
|
||||
m_HorizontalScrollbarVisibility: 2
|
||||
m_VerticalScrollbarVisibility: 2
|
||||
m_HorizontalScrollbarSpacing: -3
|
||||
m_VerticalScrollbarSpacing: -3
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &729222740
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 729222737}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &729222741
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 729222737}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1001 &729393983
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -54563,6 +54680,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: hacked
|
||||
forceRightAlignment: 0
|
||||
--- !u!1 &737073898
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -64598,6 +64716,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: whyphishing
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &876342790
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -70274,6 +70393,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: poweredby
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &936568817
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -73200,6 +73320,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: How to be safe?
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &972988250
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -74651,6 +74772,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 980819049}
|
||||
- {fileID: 1321582752}
|
||||
- {fileID: 729222738}
|
||||
m_Father: {fileID: 893706589}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@ -74891,6 +75013,111 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4845638997353936, guid: d23919b5d832ca141b8fd634308b2ad9, type: 3}
|
||||
m_PrefabInstance: {fileID: 247545245}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &993485510
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 993485511}
|
||||
- component: {fileID: 993485514}
|
||||
- component: {fileID: 993485513}
|
||||
- component: {fileID: 993485512}
|
||||
- component: {fileID: 993485515}
|
||||
m_Layer: 0
|
||||
m_Name: Viewport
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &993485511
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 993485510}
|
||||
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:
|
||||
- {fileID: 1163356059}
|
||||
m_Father: {fileID: 729222738}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: -17}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &993485512
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 993485510}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ShowMaskGraphic: 0
|
||||
--- !u!114 &993485513
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 993485510}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &993485514
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 993485510}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &993485515
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 993485510}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 0}
|
||||
--- !u!4 &993935550 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4723061090103880, guid: 5879de80c73768e4db2376bc8f83006a, type: 3}
|
||||
@ -77260,6 +77487,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: more
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1030425952 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4270791331071568, guid: f0bfb58546547264682d6066f7947e72, type: 3}
|
||||
@ -78650,6 +78878,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: starred
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1053586557 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4560637100612226, guid: 5d6857de3de39ce469a62ba9dc765d25, type: 3}
|
||||
@ -78891,6 +79120,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: What Were The Clues?
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1059813799 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4742576163013064, guid: 68acf050fd2a7d7438895bae4b02b1b0, type: 3}
|
||||
@ -85539,6 +85769,41 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4396830430441872, guid: 2b93fb3144d47524d8b9a2c5f31b5c1b, type: 3}
|
||||
m_PrefabInstance: {fileID: 1163055825}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1163356058
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1163356059}
|
||||
m_Layer: 0
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1163356059
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1163356058}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0.000000040745334}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 993485511}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0.0000005066395, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1001 &1163596090
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -88353,6 +88618,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: notsuspicious
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1197210934 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4598856690569718, guid: 3ec74bf586541a64386d798159775c05, type: 3}
|
||||
@ -97012,17 +97278,17 @@ RectTransform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1321582751}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0.00000036864856}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 991103584}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0.014999986, y: 0}
|
||||
m_SizeDelta: {x: -0.03, y: 0.35}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -0.024998665}
|
||||
m_SizeDelta: {x: -0.02, y: -0.04999733}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1321582753
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -97052,8 +97318,8 @@ MonoBehaviour:
|
||||
user instead of your name.\n\nUnusual Requests\nIt asked for sensitive info like
|
||||
passwords \u2014 companies don\u2019t do this by email."
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 1b7bc6f8d1e1a594ea77f76cabc9a9be, type: 2}
|
||||
m_sharedMaterial: {fileID: 4094059608530178792, guid: 1b7bc6f8d1e1a594ea77f76cabc9a9be, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: 12edf91a1789477408db5a46077c3e5b, type: 2}
|
||||
m_sharedMaterial: {fileID: 3375452501589232566, guid: 12edf91a1789477408db5a46077c3e5b, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
@ -97083,13 +97349,13 @@ MonoBehaviour:
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 0.0165
|
||||
m_fontSizeMax: 0.05
|
||||
m_fontStyle: 0
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 256
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_characterSpacing: -10
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacing: -39.49
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
@ -97140,6 +97406,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: whatwerethecluessummary
|
||||
forceRightAlignment: 1
|
||||
--- !u!1001 &1321965012
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -103371,6 +103638,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: phishingawareness
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1406236233 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4598856690569718, guid: 3ec74bf586541a64386d798159775c05, type: 3}
|
||||
@ -103524,6 +103792,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: sent
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &1407036543
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -122194,6 +122463,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: inbox
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &1665812592
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -122670,6 +122940,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: inbox
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &1674054030
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -124524,6 +124795,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: search
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1701751480 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4204627924666460, guid: 7e3a842bda3e7424e9fede8bc029c9fa, type: 3}
|
||||
@ -132773,6 +133045,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: alwaysreport
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1832389832 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4808176449061188, guid: 6fcbb7c2744bf764f9c7f6f46767b77f, type: 3}
|
||||
@ -139229,6 +139502,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: What was the biggest red flag in this phishing email?
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &1934084553 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4429576471617264, guid: e1b7acc66a1570041b8dee59003c793d, type: 3}
|
||||
@ -147885,6 +148159,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: TIMELINE OF ACTIONS
|
||||
forceRightAlignment: 0
|
||||
--- !u!1001 &2055927760
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -148164,7 +148439,7 @@ RectTransform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2060503199}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0.00000036864856}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -148172,8 +148447,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0.014999986, y: 0}
|
||||
m_SizeDelta: {x: -0.03, y: 0.35}
|
||||
m_AnchoredPosition: {x: 0.014999986, y: 0.0108}
|
||||
m_SizeDelta: {x: -0.03, y: 0.353}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!114 &2060503201
|
||||
MonoBehaviour:
|
||||
@ -148195,22 +148470,22 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: "\u2022 <b>Verify the sender\u2019s email address carefully</b>\nPhishing
|
||||
m_text: "\u2022 <b>Verify the sender\u2019s email address carefully</b> Phishing
|
||||
emails often use addresses that look legit but contain subtle misspellings. Always
|
||||
check if the domain matches the official source.\n\n\u2022 <b>Report suspicious
|
||||
emails instead of ignoring them</b>\nDon't delete sketchy emails \u2014 report
|
||||
them to IT. This helps protect others from falling for the same trick.\n\n\u2022
|
||||
<b>Be cautious of urgent or threatening messages</b>\nScammers use pressure tactics
|
||||
like account warnings to rush you. Always pause and think before clicking.\n\n\u2022
|
||||
<b>Never click on links without checking them first</b>\nHover over links to
|
||||
see where they lead. If the URL looks odd or unrelated, don't click.\n\n\u2022
|
||||
<b>Avoid entering sensitive info through email links</b>\nReal companies won\u2019t
|
||||
ask for passwords or private details via email. Go to the official website instead.\n\n\u2022
|
||||
<b>Look out for bad grammar or typos</b>\nPoor grammar, weird formatting, or
|
||||
obvious typos can signal a phishing attempt."
|
||||
check if the domain matches the official source.\\n\r\n\u2022 <b>Report suspicious
|
||||
emails instead of ignoring them</b> Don't delete sketchy emails \u2014 report
|
||||
them to IT. This helps protect others from falling for the same trick.\\n\r\n\u2022
|
||||
<b>Be cautious of urgent or threatening messages</b> Scammers use pressure tactics
|
||||
like account warnings to rush you. Always pause and think before clicking.\\n\r\n\u2022
|
||||
<b>Never click on links without checking them first</b> Hover over links to see
|
||||
where they lead. If the URL looks odd or unrelated, don't click.\\n\r\n\u2022
|
||||
<b>Avoid entering sensitive info through email links</b> Real companies won\u2019t
|
||||
ask for passwords or private details via email. Go to the official website instead.\\n\r\n\u2022
|
||||
<b>Look out for bad grammar or typos</b> Poor grammar, weird formatting, or obvious
|
||||
typos can signal a phishing attempt.\r"
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 1b7bc6f8d1e1a594ea77f76cabc9a9be, type: 2}
|
||||
m_sharedMaterial: {fileID: 4094059608530178792, guid: 1b7bc6f8d1e1a594ea77f76cabc9a9be, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: 12edf91a1789477408db5a46077c3e5b, type: 2}
|
||||
m_sharedMaterial: {fileID: 3375452501589232566, guid: 12edf91a1789477408db5a46077c3e5b, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
@ -148246,7 +148521,7 @@ MonoBehaviour:
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacing: -40
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
@ -148297,6 +148572,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: howtobesafesummary
|
||||
forceRightAlignment: 1
|
||||
--- !u!1001 &2060737185
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -149231,6 +149507,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
localizationKey: Urgent Language
|
||||
forceRightAlignment: 0
|
||||
--- !u!4 &2069515845 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4285425695655684, guid: f5e290f6142a51a42a0a9b85f2c115a5, type: 3}
|
||||
|
@ -14,6 +14,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
senderName: Accure Bank
|
||||
senderEmail: support@accure-bank-ank.com
|
||||
otherSenderEmails: []
|
||||
subject: "ob1ink a update now \u2013 Avoid Suspension"
|
||||
subjectAr: "\u0642\u064F\u0645 \u0628\u062A\u062D\u062F1\u062B \u0627\u0644\u0622\u0646
|
||||
\u2013 \u0644\u062A\u062C\u0646\u0628 \u0627\u0644\u0625\u064A\u0642\u0627\u0641"
|
||||
@ -42,3 +43,6 @@ MonoBehaviour:
|
||||
isPhishing: 1
|
||||
timeOrDate: Today
|
||||
timeOrDateAr: "\u0627\u0644\u064A\u0648\u0645"
|
||||
toRecipients:
|
||||
- self@cybercompanion.com
|
||||
sentDate: Today
|
||||
|
@ -48,7 +48,12 @@ public class BodyLinkHandler : MonoBehaviour, IPointerClickHandler, IPointerExit
|
||||
if (email != null)
|
||||
{
|
||||
SceneOutcomeManager.Instance?.Clicked(email);
|
||||
UserActionLogger.Instance?.Log($"Clicked link '{linkID}' in email from '{email.senderName}'");
|
||||
//UserActionLogger.Instance?.Log($"Clicked link '{linkID}' in email from '{email.senderName}'");
|
||||
string englishLog = $"Clicked link '{linkID}' in email from '{email.senderName}'";
|
||||
string arabicLog = $"تم الضغط على الرابط '{linkID}' في البريد من '{email.senderName}'";
|
||||
|
||||
UserActionLogger.Instance?.Log(englishLog, arabicLog);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5,6 +5,8 @@ public class EmailData : ScriptableObject
|
||||
{
|
||||
public string senderName;
|
||||
public string senderEmail;
|
||||
public string[] otherSenderEmails; // NEW: Aliases or spoofed variants
|
||||
|
||||
public string subject;
|
||||
public string subjectAr;
|
||||
|
||||
@ -15,6 +17,33 @@ public class EmailData : ScriptableObject
|
||||
|
||||
public bool hasAttachment;
|
||||
public bool isPhishing;
|
||||
|
||||
public string timeOrDate;
|
||||
public string timeOrDateAr;
|
||||
|
||||
// NEW: Info panel fields
|
||||
public string[] toRecipients = new string[] { "self@cybercompanion.com" }; // Typically fixed
|
||||
public string sentDate;
|
||||
}
|
||||
|
||||
|
||||
//using UnityEngine;
|
||||
|
||||
//[CreateAssetMenu(fileName = "EmailData", menuName = "Inbox/Email Data", order = 1)]
|
||||
//public class EmailData : ScriptableObject
|
||||
//{
|
||||
// public string senderName;
|
||||
// public string senderEmail;
|
||||
// public string subject;
|
||||
// public string subjectAr;
|
||||
|
||||
// [TextArea(5, 20)] public string fullBodyText;
|
||||
// [TextArea(5, 20)] public string fullBodyTextAr;
|
||||
|
||||
// public string linkPreview;
|
||||
|
||||
// public bool hasAttachment;
|
||||
// public bool isPhishing;
|
||||
// public string timeOrDate;
|
||||
// public string timeOrDateAr;
|
||||
//}
|
||||
|
@ -5,6 +5,7 @@ using ArabicSupport;
|
||||
|
||||
public class EmailOpenPanel : MonoBehaviour
|
||||
{
|
||||
[Header("Main Email View")]
|
||||
public TextMeshProUGUI senderName;
|
||||
public TextMeshProUGUI senderEmail;
|
||||
public TextMeshProUGUI subject;
|
||||
@ -17,18 +18,27 @@ public class EmailOpenPanel : MonoBehaviour
|
||||
|
||||
public Button reportBtn;
|
||||
public Button ignoreBtn;
|
||||
public Button infoButton;
|
||||
|
||||
private EmailData emailData;
|
||||
public EmailData Email => emailData;
|
||||
|
||||
[Header("Info Panel")]
|
||||
public GameObject infoPanel;
|
||||
public TextMeshProUGUI infoFrom;
|
||||
public TextMeshProUGUI infoTo;
|
||||
public TextMeshProUGUI infoDate;
|
||||
public TextMeshProUGUI infoSubject;
|
||||
public Button closeInfoButton;
|
||||
|
||||
public void Setup(EmailData data, string initial, Sprite iconSprite)
|
||||
{
|
||||
emailData = data;
|
||||
senderName.text = data.senderName;
|
||||
// senderEmail.text = data.senderEmail;
|
||||
|
||||
LocalizeTMP(subject, data.subject, data.subjectAr);
|
||||
LocalizeTMP(bodyText, data.fullBodyText, data.fullBodyTextAr);
|
||||
//linkPreview.text=data.linkPreview;
|
||||
|
||||
if (phishingIcon != null)
|
||||
phishingIcon.SetActive(data.isPhishing);
|
||||
|
||||
@ -41,22 +51,72 @@ public class EmailOpenPanel : MonoBehaviour
|
||||
|
||||
ignoreBtn?.onClick.RemoveAllListeners();
|
||||
ignoreBtn?.onClick.AddListener(() => OnAction("ignore"));
|
||||
|
||||
infoButton?.onClick.RemoveAllListeners();
|
||||
infoButton?.onClick.AddListener(ShowInfoPanel);
|
||||
|
||||
closeInfoButton?.onClick.RemoveAllListeners();
|
||||
closeInfoButton?.onClick.AddListener(() => infoPanel.SetActive(false));
|
||||
}
|
||||
|
||||
void ShowInfoPanel()
|
||||
{
|
||||
bool isArabic = LanguageManager.Instance.currentLanguage == "Arabic";
|
||||
|
||||
// Compose 'From'
|
||||
string from = $"{emailData.senderName} <{emailData.senderEmail}>";
|
||||
if (emailData.otherSenderEmails != null && emailData.otherSenderEmails.Length > 0)
|
||||
from += $", {string.Join(", ", emailData.otherSenderEmails)}";
|
||||
|
||||
// Compose 'To'
|
||||
string to = emailData.toRecipients != null && emailData.toRecipients.Length > 0
|
||||
? string.Join(", ", emailData.toRecipients)
|
||||
: "self@cybercompanion.com";
|
||||
|
||||
// Subject & Date
|
||||
string subj = isArabic ? emailData.subjectAr : emailData.subject;
|
||||
string date = isArabic ? emailData.timeOrDateAr : emailData.sentDate;
|
||||
|
||||
// Set localized text
|
||||
infoFrom.text = from;
|
||||
infoTo.text = to;
|
||||
infoSubject.text = subj;
|
||||
infoDate.text = date;
|
||||
//SetLocalizedTMP(infoFrom, from, isArabic);
|
||||
//SetLocalizedTMP(infoTo, to, isArabic);
|
||||
//SetLocalizedTMP(infoSubject, subj, isArabic);
|
||||
//SetLocalizedTMP(infoDate, date, isArabic);
|
||||
|
||||
infoPanel.SetActive(true);
|
||||
}
|
||||
|
||||
void SetLocalizedTMP(TextMeshProUGUI tmp, string text, bool isArabic)
|
||||
{
|
||||
if (tmp == null) return;
|
||||
|
||||
tmp.text = isArabic ? ArabicFixer.Fix(text) : text;
|
||||
tmp.font = LanguageManager.Instance.GetCurrentFont();
|
||||
// tmp.alignment = isArabic ? TextAlignmentOptions.Right : TextAlignmentOptions.Left;
|
||||
//tmp.isRightToLeftText = isArabic;
|
||||
}
|
||||
|
||||
void OnAction(string action)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
|
||||
string summary = $"{action.ToUpper()} clicked on email from '{emailData.senderName}' with subject '{emailData.subject}'";
|
||||
UserActionLogger.Instance?.Log(summary);
|
||||
//string summary = $"{action.ToUpper()} clicked on email from '{emailData.senderName}' with subject '{emailData.subject}'";
|
||||
//UserActionLogger.Instance?.Log(summary);
|
||||
string englishLog = $"{action.ToUpper()} clicked on email from '{emailData.senderName}' with subject '{emailData.subject}'";
|
||||
string arabicAction = action == "report" ? "الإبلاغ" : "تجاهل";
|
||||
string arabicLog = $"تم الضغط على زر {arabicAction} للبريد من '{emailData.senderName}' بعنوان '{emailData.subjectAr}'";
|
||||
|
||||
UserActionLogger.Instance?.Log(englishLog, arabicLog);
|
||||
bool isCorrect =
|
||||
(action == "report" && emailData.isPhishing) ||
|
||||
(action == "ignore" && !emailData.isPhishing);
|
||||
|
||||
if (isCorrect)
|
||||
{
|
||||
// ✅ Correct choice → Show instruction
|
||||
InstructionManager.Instance?.ShowScreenInstruction("correct_choice", 3f);
|
||||
}
|
||||
|
||||
@ -71,16 +131,6 @@ public class EmailOpenPanel : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//void LocalizeTMP(TextMeshProUGUI tmp, string english, string arabic)
|
||||
//{
|
||||
// if (tmp == null) return;
|
||||
|
||||
// bool isArabic = LanguageManager.Instance != null && LanguageManager.Instance.currentLanguage == "Arabic";
|
||||
// tmp.text = isArabic ? ArabicFixer.Fix(arabic) : english;
|
||||
// tmp.font = LanguageManager.Instance?.GetCurrentFont();
|
||||
// //tmp.isRightToLeftText = isArabic;
|
||||
// //tmp.alignment = isArabic ? TextAlignmentOptions.Right : TextAlignmentOptions.Left;
|
||||
//}
|
||||
void LocalizeTMP(TextMeshProUGUI tmp, string english, string arabic)
|
||||
{
|
||||
if (tmp == null) return;
|
||||
@ -89,8 +139,105 @@ public class EmailOpenPanel : MonoBehaviour
|
||||
|
||||
tmp.text = isArabic ? ArabicFixerHelper.FixPreservingTags(arabic) : english;
|
||||
tmp.font = LanguageManager.Instance.GetCurrentFont();
|
||||
// tmp.alignment = isArabic ? TextAlignmentOptions.Right : TextAlignmentOptions.Left;
|
||||
// tmp.isRightToLeftText = isArabic;
|
||||
//tmp.alignment = isArabic ? TextAlignmentOptions.Right : TextAlignmentOptions.Left;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//using UnityEngine;
|
||||
//using TMPro;
|
||||
//using UnityEngine.UI;
|
||||
//using ArabicSupport;
|
||||
|
||||
//public class EmailOpenPanel : MonoBehaviour
|
||||
//{
|
||||
// public TextMeshProUGUI senderName;
|
||||
// public TextMeshProUGUI senderEmail;
|
||||
// public TextMeshProUGUI subject;
|
||||
// public TextMeshProUGUI bodyText;
|
||||
// public TextMeshProUGUI linkPreview;
|
||||
// public GameObject phishingIcon;
|
||||
|
||||
// public TextMeshProUGUI senderInitial;
|
||||
// public Image senderBg;
|
||||
|
||||
// public Button reportBtn;
|
||||
// public Button ignoreBtn;
|
||||
|
||||
// private EmailData emailData;
|
||||
// public EmailData Email => emailData;
|
||||
|
||||
// public void Setup(EmailData data, string initial, Sprite iconSprite)
|
||||
// {
|
||||
// emailData = data;
|
||||
// senderName.text = data.senderName;
|
||||
// // senderEmail.text = data.senderEmail;
|
||||
// LocalizeTMP(subject, data.subject, data.subjectAr);
|
||||
// LocalizeTMP(bodyText, data.fullBodyText, data.fullBodyTextAr);
|
||||
// //linkPreview.text=data.linkPreview;
|
||||
// if (phishingIcon != null)
|
||||
// phishingIcon.SetActive(data.isPhishing);
|
||||
|
||||
// senderInitial?.SetText(initial);
|
||||
// if (senderBg != null)
|
||||
// senderBg.sprite = iconSprite;
|
||||
|
||||
// reportBtn?.onClick.RemoveAllListeners();
|
||||
// reportBtn?.onClick.AddListener(() => OnAction("report"));
|
||||
|
||||
// ignoreBtn?.onClick.RemoveAllListeners();
|
||||
// ignoreBtn?.onClick.AddListener(() => OnAction("ignore"));
|
||||
// }
|
||||
|
||||
// void OnAction(string action)
|
||||
// {
|
||||
// gameObject.SetActive(false);
|
||||
|
||||
// string summary = $"{action.ToUpper()} clicked on email from '{emailData.senderName}' with subject '{emailData.subject}'";
|
||||
// UserActionLogger.Instance?.Log(summary);
|
||||
|
||||
// bool isCorrect =
|
||||
// (action == "report" && emailData.isPhishing) ||
|
||||
// (action == "ignore" && !emailData.isPhishing);
|
||||
|
||||
// if (isCorrect)
|
||||
// {
|
||||
// // ✅ Correct choice → Show instruction
|
||||
// InstructionManager.Instance?.ShowScreenInstruction("correct_choice", 3f);
|
||||
// }
|
||||
|
||||
// switch (action)
|
||||
// {
|
||||
// case "report":
|
||||
// SceneOutcomeManager.Instance.Reported(emailData);
|
||||
// break;
|
||||
// case "ignore":
|
||||
// SceneOutcomeManager.Instance.Ignored(emailData);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //void LocalizeTMP(TextMeshProUGUI tmp, string english, string arabic)
|
||||
// //{
|
||||
// // if (tmp == null) return;
|
||||
|
||||
// // bool isArabic = LanguageManager.Instance != null && LanguageManager.Instance.currentLanguage == "Arabic";
|
||||
// // tmp.text = isArabic ? ArabicFixer.Fix(arabic) : english;
|
||||
// // tmp.font = LanguageManager.Instance?.GetCurrentFont();
|
||||
// // //tmp.isRightToLeftText = isArabic;
|
||||
// // //tmp.alignment = isArabic ? TextAlignmentOptions.Right : TextAlignmentOptions.Left;
|
||||
// //}
|
||||
// void LocalizeTMP(TextMeshProUGUI tmp, string english, string arabic)
|
||||
// {
|
||||
// if (tmp == null) return;
|
||||
|
||||
// bool isArabic = LanguageManager.Instance.currentLanguage == "Arabic";
|
||||
|
||||
// tmp.text = isArabic ? ArabicFixerHelper.FixPreservingTags(arabic) : english;
|
||||
// tmp.font = LanguageManager.Instance.GetCurrentFont();
|
||||
// // tmp.isRightToLeftText = isArabic;
|
||||
// //tmp.alignment = isArabic ? TextAlignmentOptions.Right : TextAlignmentOptions.Left;
|
||||
// }
|
||||
|
||||
//}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using ArabicSupport;
|
||||
@ -63,7 +63,11 @@ public class EmailUIController : MonoBehaviour
|
||||
WorldTimelineManager.Instance.OpenedEmailPanel = panel;
|
||||
EmailOpenPanel controller = panel.GetComponent<EmailOpenPanel>();
|
||||
controller.Setup(data, cachedInitial, cachedSprite);
|
||||
string englishLog = $"Opened email from '{data.senderName}' with subject '{data.subject}'";
|
||||
string arabicLog = $"تم فتح البريد من '{data.senderName}' بعنوان '{data.subjectAr}'";
|
||||
|
||||
UserActionLogger.Instance?.Log($"Opened email from '{data.senderName}' with subject '{data.subject}'");
|
||||
UserActionLogger.Instance?.Log(englishLog, arabicLog);
|
||||
|
||||
//UserActionLogger.Instance?.Log($"Opened email from '{data.senderName}' with subject '{data.subject}'");
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ public class LocalizedTextComponent : MonoBehaviour
|
||||
{
|
||||
public string localizationKey;
|
||||
private TextMeshProUGUI tmp;
|
||||
public bool forceRightAlignment = false;
|
||||
private void Start()
|
||||
{
|
||||
tmp = GetComponent<TextMeshProUGUI>();
|
||||
@ -67,7 +68,8 @@ public class LocalizedTextComponent : MonoBehaviour
|
||||
{
|
||||
tmp.text = rawText.Replace("\\n", "\n"); // Handle escaped newline
|
||||
}
|
||||
|
||||
if (forceRightAlignment && isArabic)
|
||||
tmp.alignment = TextAlignmentOptions.Right;
|
||||
tmp.font = LanguageManager.Instance.GetCurrentFont();
|
||||
tmp.ForceMeshUpdate();
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using ArabicSupport;
|
||||
|
||||
public class MiniQuizManager : MonoBehaviour
|
||||
{
|
||||
public Button[] answerButtons; // Assign in order: A, B, C, D
|
||||
public TextMeshProUGUI[] answerLabels; // Same order as buttons
|
||||
public Button[] answerButtons; // A, B, C, D
|
||||
public TextMeshProUGUI[] answerLabels; // Corresponding TMP labels
|
||||
public TextMeshProUGUI feedbackText;
|
||||
|
||||
private string[] answerTexts = new string[]
|
||||
@ -16,30 +17,96 @@ public class MiniQuizManager : MonoBehaviour
|
||||
"All of the above"
|
||||
};
|
||||
|
||||
private string[] answerTextsAr = new string[]
|
||||
{
|
||||
"أخطاء مطبعية في العنوان",
|
||||
"لغة مستعجلة",
|
||||
"عنوان بريد مرسل غير متطابق",
|
||||
"جميع ما سبق"
|
||||
};
|
||||
|
||||
private int correctIndex = 3;
|
||||
|
||||
public void SubmitAnswer(int selectedIndex)
|
||||
{
|
||||
string selectedAnswer = answerTexts[selectedIndex];
|
||||
UserActionLogger.Instance?.LogQuizAnswer(selectedAnswer);
|
||||
bool isArabic = LanguageManager.Instance != null &&
|
||||
LanguageManager.Instance.currentLanguage == "Arabic";
|
||||
|
||||
// Feedback
|
||||
string selectedAnswer = answerTexts[selectedIndex];
|
||||
string selectedAnswerAr = answerTextsAr[selectedIndex];
|
||||
|
||||
// Log the selected answer
|
||||
UserActionLogger.Instance?.LogQuizAnswer(selectedAnswer, selectedAnswerAr);
|
||||
|
||||
// Show feedback
|
||||
if (selectedIndex == correctIndex)
|
||||
{
|
||||
feedbackText.text = "✅ Correct! All of those were red flags.";
|
||||
feedbackText.text = isArabic
|
||||
? ArabicFixer.Fix("✅ إجابة صحيحة! جميعها كانت إشارات خطر.")
|
||||
: "✅ Correct! All of those were red flags.";
|
||||
}
|
||||
else
|
||||
{
|
||||
feedbackText.text = $"❌ Not quite. The correct answer was: {answerTexts[correctIndex]}";
|
||||
string correctAnswer = answerTexts[correctIndex];
|
||||
string correctAnswerAr = answerTextsAr[correctIndex];
|
||||
|
||||
feedbackText.text = isArabic
|
||||
? ArabicFixer.Fix($"❌ ليست الإجابة الصحيحة. الإجابة الصحيحة هي: {correctAnswerAr}")
|
||||
: $"❌ Not quite. The correct answer was: {correctAnswer}";
|
||||
}
|
||||
|
||||
// Lock all buttons
|
||||
// Disable all buttons
|
||||
foreach (var btn in answerButtons)
|
||||
{
|
||||
btn.interactable = false;
|
||||
}
|
||||
|
||||
// Mark selected
|
||||
// Prepend a ✅ to the selected label
|
||||
answerLabels[selectedIndex].text = "✅ " + answerLabels[selectedIndex].text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.UI;
|
||||
//using TMPro;
|
||||
|
||||
//public class MiniQuizManager : MonoBehaviour
|
||||
//{
|
||||
// public Button[] answerButtons; // Assign in order: A, B, C, D
|
||||
// public TextMeshProUGUI[] answerLabels; // Same order as buttons
|
||||
// public TextMeshProUGUI feedbackText;
|
||||
|
||||
// private string[] answerTexts = new string[]
|
||||
// {
|
||||
// "Typos in the subject",
|
||||
// "Urgent language",
|
||||
// "Mismatched sender email",
|
||||
// "All of the above"
|
||||
// };
|
||||
|
||||
// private int correctIndex = 3;
|
||||
|
||||
// public void SubmitAnswer(int selectedIndex)
|
||||
// {
|
||||
// string selectedAnswer = answerTexts[selectedIndex];
|
||||
// UserActionLogger.Instance?.LogQuizAnswer(selectedAnswer);
|
||||
|
||||
// // Feedback
|
||||
// if (selectedIndex == correctIndex)
|
||||
// {
|
||||
// feedbackText.text = "✅ Correct! All of those were red flags.";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// feedbackText.text = $"❌ Not quite. The correct answer was: {answerTexts[correctIndex]}";
|
||||
// }
|
||||
|
||||
// // Lock all buttons
|
||||
// foreach (var btn in answerButtons)
|
||||
// {
|
||||
// btn.interactable = false;
|
||||
// }
|
||||
|
||||
// // Mark selected
|
||||
// answerLabels[selectedIndex].text = "✅ " + answerLabels[selectedIndex].text;
|
||||
// }
|
||||
//}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using UnityEngine;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using ArabicSupport;
|
||||
|
||||
public class UserActionLogger : MonoBehaviour
|
||||
{
|
||||
@ -17,17 +18,39 @@ public class UserActionLogger : MonoBehaviour
|
||||
else
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
public void Log(string action)
|
||||
public void Log(string englishLog, string arabicLog = null)
|
||||
{
|
||||
logs.Add(action);
|
||||
Debug.Log($"📜 Action Logged: {logs.Count}. {action}");
|
||||
bool isArabic = LanguageManager.Instance != null &&
|
||||
LanguageManager.Instance.currentLanguage == "Arabic";
|
||||
|
||||
string logToUse = isArabic && !string.IsNullOrEmpty(arabicLog)
|
||||
? ArabicFixer.Fix(arabicLog)
|
||||
: englishLog;
|
||||
|
||||
logs.Add(logToUse);
|
||||
Debug.Log($"📜 Action Logged: {logs.Count}. {logToUse}");
|
||||
}
|
||||
|
||||
public void LogQuizAnswer(string answerText)
|
||||
//public void Log(string action)
|
||||
//{
|
||||
// logs.Add(action);
|
||||
// Debug.Log($"📜 Action Logged: {logs.Count}. {action}");
|
||||
//}
|
||||
public void LogQuizAnswer(string answerEnglish, string answerArabic = null)
|
||||
{
|
||||
Log($"Answered quiz: {answerText}");
|
||||
string englishLog = $"Answered quiz: {answerEnglish}";
|
||||
string arabicLog = answerArabic != null ? $"أجاب على السؤال: {answerArabic}" : null;
|
||||
|
||||
Log(englishLog, arabicLog);
|
||||
}
|
||||
//public void LogQuizAnswer(string answerText)
|
||||
//{
|
||||
// //Log($"Answered quiz: {answerText}");
|
||||
// string englishLog = $"Answered quiz: {answerEnglish}";
|
||||
// string arabicLog = answerArabic != null ? $"أجاب على السؤال: {answerArabic}" : null;
|
||||
|
||||
// Log(englishLog, arabicLog);
|
||||
//}
|
||||
|
||||
public string GetFullLog()
|
||||
{
|
||||
@ -43,7 +66,18 @@ public class UserActionLogger : MonoBehaviour
|
||||
public void ShowSummary()
|
||||
{
|
||||
if (summaryText != null)
|
||||
summaryText.text = GetFullLog();
|
||||
{
|
||||
|
||||
bool isArabic = LanguageManager.Instance != null &&
|
||||
LanguageManager.Instance.currentLanguage == "Arabic";
|
||||
string logs = GetFullLog();
|
||||
if (isArabic)
|
||||
{
|
||||
summaryText.text = ArabicFixer.Fix(logs);
|
||||
summaryText.font = LanguageManager.Instance.fontArabic;
|
||||
summaryText.ForceMeshUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearLog()
|
||||
|
5099
Assets/TextMesh Pro/Fonts/NotoNaskhArabic-Bold SDF.asset
Normal file
5099
Assets/TextMesh Pro/Fonts/NotoNaskhArabic-Bold SDF.asset
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12edf91a1789477408db5a46077c3e5b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/TextMesh Pro/Fonts/NotoNaskhArabic-Bold.ttf
Normal file
BIN
Assets/TextMesh Pro/Fonts/NotoNaskhArabic-Bold.ttf
Normal file
Binary file not shown.
21
Assets/TextMesh Pro/Fonts/NotoNaskhArabic-Bold.ttf.meta
Normal file
21
Assets/TextMesh Pro/Fonts/NotoNaskhArabic-Bold.ttf.meta
Normal file
@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dc59ace99a1d5a4c8cb7061d9d59b33
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Noto Naskh Arabic
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user