From f229cc1d3887629972c9cd9c7f9d3aca08298f70 Mon Sep 17 00:00:00 2001 From: Vinay Valson Date: Wed, 10 Mar 2021 17:36:10 +0530 Subject: [PATCH] Added States Counter States Counter will show at which state the ARgorithm is running at. --- Assets/Scenes/ARStage.unity | 140 +++++++++++++++++++++++++++++++++++- Assets/Scripts/ARStage.cs | 14 ++++ 2 files changed, 152 insertions(+), 2 deletions(-) diff --git a/Assets/Scenes/ARStage.unity b/Assets/Scenes/ARStage.unity index 20ff409..280588a 100644 --- a/Assets/Scenes/ARStage.unity +++ b/Assets/Scenes/ARStage.unity @@ -312,7 +312,7 @@ GameObject: - component: {fileID: 218829093} - component: {fileID: 218829092} m_Layer: 5 - m_Name: CommentsBox + m_Name: InfoBox m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -329,6 +329,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: + - {fileID: 926064522} - {fileID: 703624899} m_Father: {fileID: 1149782917} m_RootOrder: 2 @@ -1044,7 +1045,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 218829091} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1343,6 +1344,140 @@ Camera: m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 +--- !u!1 &926064519 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 926064522} + - component: {fileID: 926064521} + - component: {fileID: 926064520} + m_Layer: 5 + m_Name: StatesCounter + m_TagString: CommentBox + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &926064520 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 926064519} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: db8e5d852fafb3f4ab85b612e8d470ce, type: 2} + m_sharedMaterial: {fileID: 8963545961531463164, guid: db8e5d852fafb3f4ab85b612e8d470ce, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 50 + m_fontSizeBase: 50 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 65 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 1 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &926064521 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 926064519} + m_CullTransparentMesh: 0 +--- !u!224 &926064522 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 926064519} + 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_Children: [] + m_Father: {fileID: 218829091} + m_RootOrder: 0 + 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: -108.953354} + m_Pivot: {x: 0.5, y: 1} --- !u!1 &981664036 GameObject: m_ObjectHideFlags: 0 @@ -2537,4 +2672,5 @@ MonoBehaviour: placementIndicator: {fileID: 543700799} cube: {fileID: 39518484157928013, guid: 40a3700af4216614b8336f12ca407fad, type: 3} CommentBox: {fileID: 703624896} + StatesCounterGameObject: {fileID: 926064519} ARgorithmHeading: {fileID: 1545845627} diff --git a/Assets/Scripts/ARStage.cs b/Assets/Scripts/ARStage.cs index ab51797..5a27025 100644 --- a/Assets/Scripts/ARStage.cs +++ b/Assets/Scripts/ARStage.cs @@ -24,6 +24,7 @@ public class ARStage : MonoBehaviour public GameObject placementIndicator; public GameObject cube; public GameObject CommentBox; + public GameObject StatesCounterGameObject; public GameObject ARgorithmHeading; private StageData stageData; @@ -62,6 +63,10 @@ void FixedUpdate() UpdatePlacementPose(); UpdatePlacementIndicator(); } + if(index+1 > 0 && index+1<=stageData.size) + { + ChangeStateCounter(index+1, stageData.size); + } } private void OnApplicationQuit() @@ -69,12 +74,21 @@ private void OnApplicationQuit() PlayerPrefs.DeleteKey("CloudMenuEnabled"); } + //function to change UI comments. Display states comments private void ChangeComments(string text) { // called in updates based on EventList contents with "comments" key CommentBox.GetComponent().SetText(text); } + //function to change UI states counter. Display states at which the stage is running + private void ChangeStateCounter(int step,int totalSteps) + { + string stepString = step.ToString(); + string totalStepsString = totalSteps.ToString(); + StatesCounterGameObject.GetComponent().SetText(stepString+"/"+totalStepsString); + } + //Dont Change the code below this comment private void UpdatePlacementIndicator() {