diff --git a/Assets/Resources/Prefabs/GlobalObject.prefab b/Assets/Resources/Prefabs/GlobalObject.prefab index 52ff148bd1fb6124bb5e7bb623fbf0f573bc0fc2..88020dbeb28bb92cecccdbda895335ff67f6467f 100644 --- a/Assets/Resources/Prefabs/GlobalObject.prefab +++ b/Assets/Resources/Prefabs/GlobalObject.prefab @@ -47,8 +47,10 @@ MonoBehaviour: _hintAnimationStartColor: {r: 0.9716981, g: 0.9266228, b: 0.1054201, a: 1} _hintAnimationEndColor: {r: 0.972549, g: 0.6342677, b: 0.10588237, a: 0} _hintAnimationDuration: 3 + _AnimationLerpDuration: 1 _StageAccomplished: {r: 0.029236369, g: 0.6886792, b: 0.041520078, a: 0.39215687} _StageNotYetAccomplished: {r: 0.031372562, g: 0.4927269, b: 0.6901961, a: 0.39215687} _StageError: {r: 1, g: 0, b: 1, a: 0.39215687} _GadgetLaserDistance: 30 _GadgetPhysicalDistance: 2.5 + tryScrollListTimes: 2 diff --git a/Assets/Resources/Prefabs/UI/Facts/FactSpot.prefab b/Assets/Resources/Prefabs/UI/Facts/FactSpot.prefab index 1e76da5dcf6a3ec453a3b0c309f7b7e71c3515c6..2b12fa90bd63f909c8c1833699258a2d6e8313b5 100644 --- a/Assets/Resources/Prefabs/UI/Facts/FactSpot.prefab +++ b/Assets/Resources/Prefabs/UI/Facts/FactSpot.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 2492119118187225485} - component: {fileID: 3183854850668897353} - component: {fileID: 2474205050366502828} + - component: {fileID: 5552616159647438969} m_Layer: 0 m_Name: FactSpot m_TagString: Untagged @@ -76,3 +77,16 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5552616159647438969 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7124463502404826001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba6d0bde735420141a43a09a220c99d9, type: 3} + m_Name: + m_EditorClassIdentifier: + _URI: diff --git a/Assets/Resources/Prefabs/UI/FrameITUI.prefab b/Assets/Resources/Prefabs/UI/FrameITUI.prefab index 4d7c869efa025d9726d41aae318d3351624070a0..e570ddf7a13f5d0c5b183dc73e6280dbb6c15faa 100644 --- a/Assets/Resources/Prefabs/UI/FrameITUI.prefab +++ b/Assets/Resources/Prefabs/UI/FrameITUI.prefab @@ -406,12 +406,12 @@ PrefabInstance: - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} @@ -556,7 +556,7 @@ PrefabInstance: - target: {fileID: 6500467619489830996, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: 1080 objectReference: {fileID: 0} - target: {fileID: 7849991042685492731, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} @@ -606,7 +606,7 @@ PrefabInstance: - target: {fileID: 7989559431199338490, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_AnchoredPosition.y - value: 0.00047302246 + value: -59.999527 objectReference: {fileID: 0} - target: {fileID: 8004702056544321748, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} @@ -626,7 +626,7 @@ PrefabInstance: - target: {fileID: 8004702056565720365, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_AnchoredPosition.x - value: 0.0009765625 + value: 755.6751 objectReference: {fileID: 0} - target: {fileID: 8004702056618112982, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} @@ -646,12 +646,12 @@ PrefabInstance: - target: {fileID: 8004702056709666223, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_Size - value: 1 + value: 0.4705884 objectReference: {fileID: 0} - target: {fileID: 8004702056709666223, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_Value - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8004702057932254674, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} diff --git a/Assets/Resources/Prefabs/UI/Icons/FactIcons/DisplayAngle.prefab b/Assets/Resources/Prefabs/UI/Icons/FactIcons/DisplayAngle.prefab index dc6dc4782b2ce432a22a2ecba539c4fc65bcc7ae..c6c82ac336e6b984e769f2819fed532144fd0f93 100644 --- a/Assets/Resources/Prefabs/UI/Icons/FactIcons/DisplayAngle.prefab +++ b/Assets/Resources/Prefabs/UI/Icons/FactIcons/DisplayAngle.prefab @@ -515,6 +515,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: imageToChange: {fileID: 6643637775379894486} + imageToChangeDefaultColor: {r: 0, g: 0, b: 0, a: 0} --- !u!114 &114522817932931646 MonoBehaviour: m_ObjectHideFlags: 0 @@ -540,6 +541,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3} m_Name: m_EditorClassIdentifier: + _URI: FactText: - {fileID: 6643637774878492040} - {fileID: 6643637774014364123} diff --git a/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab b/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab index 5002055b548c8384dc2eac67ce0c51ac895978e0..91f203c0b9266e4db02ab1c840ac606ba1df1979 100644 --- a/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab +++ b/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab @@ -2349,8 +2349,8 @@ MonoBehaviour: m_PersistentCalls: m_Calls: - m_Target: {fileID: 8004702057798297438} - m_TargetAssemblyTypeName: - m_MethodName: magicButtonTrigger + m_TargetAssemblyTypeName: ScrollDetails, Assembly-CSharp + m_MethodName: MagicButtonTrigger m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -2464,8 +2464,8 @@ MonoBehaviour: type: 3} mmtAnswerPopUp: {fileID: 6618856106128302243} currentMmtAnswer: - dynamicScrollDescriptionsActive: 1 - automaticHintGenerationActive: 1 + DynamicScrollDescriptionsActive: 1 + AutomaticHintGenerationActive: 1 --- !u!114 &8004702057798297409 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3016,17 +3016,11 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: preferredStartScrollName: OppositeLen - tryScrollListTimes: 2 ScrollButtons: [] ScrollPrefab: {fileID: 3173330253721512196, guid: a6a9a3ebdb022e546a21d9f9ff148261, type: 3} DetailScreen: {fileID: 8004702057798297436} scrollscreenContent: {fileID: 6500467619489830996} - x_Start: -240 - y_Start: 200 - X_Pacece_Between_Items: 105 - y_Pacece_Between_Items: 105 - number_of_Column: 3 --- !u!114 &3490402746730127523 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay 1.prefab b/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay 1.prefab index ee11904f99f4ec3f3764dba08ca8b4acc6aef6e6..360e87bdebd00fa7b5786699aa04c1187568c4a4 100644 --- a/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay 1.prefab +++ b/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay 1.prefab @@ -12,6 +12,7 @@ GameObject: - component: {fileID: 45775000557492123} - component: {fileID: 45775000557492116} - component: {fileID: 3165625469853059737} + - component: {fileID: 1262334361908787796} m_Layer: 5 m_Name: ScrollParameterDisplay 1 m_TagString: Untagged @@ -29,6 +30,7 @@ RectTransform: 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: 8395591737078336061} - {fileID: 7707475700987653288} @@ -64,6 +66,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.9056604, g: 0.8992144, b: 0.004271993, a: 0.21568628} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -80,7 +83,7 @@ MonoBehaviour: m_PixelsPerUnitMultiplier: 1 --- !u!95 &3165625469853059737 Animator: - serializedVersion: 3 + serializedVersion: 4 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -93,10 +96,25 @@ Animator: m_UpdateMode: 0 m_ApplyRootMotion: 0 m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 m_WarningMessage: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1262334361908787796 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 45775000557492118} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 77b75bbb0b640664db62cf8acb69994e, type: 3} + m_Name: + m_EditorClassIdentifier: + imageToChange: {fileID: 45775000557492116} + imageToChangeDefaultColor: {r: 0, g: 0, b: 0, a: 0} --- !u!1 &5738028260646118123 GameObject: m_ObjectHideFlags: 0 @@ -126,6 +144,7 @@ RectTransform: 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: 240927666867053403} m_Father: {fileID: 45775000557492117} @@ -159,6 +178,7 @@ MonoBehaviour: 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: @@ -187,6 +207,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 0 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -217,6 +238,7 @@ MonoBehaviour: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1430730640409366961} + m_TargetAssemblyTypeName: m_MethodName: OnClickHintButton m_Mode: 1 m_Arguments: @@ -255,6 +277,7 @@ RectTransform: 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: 45775000557492117} m_RootOrder: 1 @@ -287,14 +310,15 @@ MonoBehaviour: 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_text: Parameter Description m_isRightToLeft: 0 - m_fontAsset: {fileID: 11400000, guid: e102aafbe9ad5444aa6caf6c496a8c72, type: 2} - m_sharedMaterial: {fileID: -2291642635969528081, guid: e102aafbe9ad5444aa6caf6c496a8c72, + m_fontAsset: {fileID: 11400000, guid: 3bce71b32a876f54e96869a29b46e150, type: 2} + m_sharedMaterial: {fileID: 5290021301827705759, guid: 3bce71b32a876f54e96869a29b46e150, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} @@ -313,13 +337,12 @@ MonoBehaviour: 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_outlineColor: - serializedVersion: 2 - rgba: 4278190080 m_fontSize: 24 m_fontSizeBase: 24 m_fontWeight: 400 @@ -327,7 +350,9 @@ MonoBehaviour: m_fontSizeMin: 18 m_fontSizeMax: 72 m_fontStyle: 0 - m_textAlignment: 514 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 m_characterSpacing: 0 m_wordSpacing: 0 m_lineSpacing: 0 @@ -337,10 +362,8 @@ MonoBehaviour: m_enableWordWrapping: 1 m_wordWrappingRatios: 0.4 m_overflowMode: 0 - m_firstOverflowCharacterIndex: -1 m_linkedTextComponent: {fileID: 0} - m_isLinkedTextComponent: 0 - m_isTextTruncated: 0 + parentLinkedComponent: {fileID: 0} m_enableKerning: 1 m_enableExtraPadding: 0 checkPaddingRequired: 0 @@ -348,40 +371,18 @@ MonoBehaviour: m_parseCtrlCharacters: 1 m_isOrthographic: 1 m_isCullingEnabled: 0 - m_ignoreRectMaskCulling: 0 - m_ignoreCulling: 1 m_horizontalMapping: 0 m_verticalMapping: 0 m_uvLineOffset: 0 m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 m_VertexBufferAutoSizeReduction: 1 - m_firstVisibleCharacter: 0 m_useMaxVisibleDescender: 1 m_pageToDisplay: 1 m_margin: {x: 0, y: 0, z: 2.959988, w: 0} - m_textInfo: - textComponent: {fileID: 1686984722580339795} - characterCount: 21 - spriteCount: 0 - spaceCount: 1 - wordCount: 2 - linkCount: 0 - lineCount: 1 - pageCount: 1 - materialCount: 1 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 - m_spriteAnimator: {fileID: 0} m_hasFontAssetChanged: 0 - m_subTextObjects: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &6351655452780298554 @@ -412,6 +413,7 @@ RectTransform: 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: 7669725544194832573} m_RootOrder: 0 @@ -444,6 +446,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -462,22 +465,6 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Hint ---- !u!114 &1430730640409366961 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7114714463615850914} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 93aede1a33263ef44a354960618fe997, type: 3} - m_Name: - m_EditorClassIdentifier: - ID: 0 - LabelMesh: {fileID: 1686984722580339795} - factUri: - ScrollParameterObject: {fileID: 45775000557492118} --- !u!1001 &1159872321215018256 PrefabInstance: m_ObjectHideFlags: 0 @@ -487,108 +474,108 @@ PrefabInstance: m_Modifications: - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalPosition.x - value: 0 + propertyPath: m_Pivot.x + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalPosition.y - value: 0 + propertyPath: m_Pivot.y + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalPosition.z + propertyPath: m_RootOrder value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalRotation.x - value: -0 + propertyPath: m_AnchorMax.x + value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalRotation.y - value: -0 + propertyPath: m_AnchorMax.y + value: 1 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalRotation.z - value: -0 + propertyPath: m_AnchorMin.x + value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalRotation.w + propertyPath: m_AnchorMin.y value: 1 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_RootOrder - value: 0 + propertyPath: m_SizeDelta.x + value: 100 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 + propertyPath: m_SizeDelta.y + value: 100 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalEulerAnglesHint.y + propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_LocalEulerAnglesHint.z + propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_AnchoredPosition.x - value: 60 + propertyPath: m_LocalPosition.z + value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_AnchoredPosition.y - value: -60 + propertyPath: m_LocalRotation.w + value: 1 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_SizeDelta.x - value: 100 + propertyPath: m_LocalRotation.x + value: -0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_SizeDelta.y - value: 100 + propertyPath: m_LocalRotation.y + value: -0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_AnchorMin.x - value: 0 + propertyPath: m_LocalRotation.z + value: -0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_AnchorMin.y - value: 1 + propertyPath: m_AnchoredPosition.x + value: 60 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_AnchorMax.x - value: 0 + propertyPath: m_AnchoredPosition.y + value: -60 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_AnchorMax.y - value: 1 + propertyPath: m_LocalEulerAnglesHint.x + value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_Pivot.x - value: 0.5 + propertyPath: m_LocalEulerAnglesHint.y + value: 0 objectReference: {fileID: 0} - target: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} - propertyPath: m_Pivot.y - value: 0.5 + propertyPath: m_LocalEulerAnglesHint.z + value: 0 objectReference: {fileID: 0} - target: {fileID: 8260792079148133554, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, type: 3} @@ -603,6 +590,22 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 1159872321215018256} m_PrefabAsset: {fileID: 0} +--- !u!114 &1430730640409366961 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7114714463615850914} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93aede1a33263ef44a354960618fe997, type: 3} + m_Name: + m_EditorClassIdentifier: + _URI: + LabelMesh: {fileID: 1686984722580339795} + HintButton: {fileID: 5738028260646118123} + ImageHintObject: {fileID: 1262334361908787796} --- !u!224 &8395591737078336061 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 7249550241351237421, guid: 1a3d2b3a09e7aa64ab57b0867d3b2307, diff --git a/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay.prefab b/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay.prefab index b102e2fb452e67f2ac26c9f9e4392d127e70ae50..1b08e37322a5cc360d3177c0ab5671c20da104b2 100644 --- a/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay.prefab +++ b/Assets/Resources/Prefabs/UI/Scrolls/ScrollParameterDisplay.prefab @@ -1,115 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!114 &2755165644415347940 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8358525157842135574} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 77b75bbb0b640664db62cf8acb69994e, type: 3} - m_Name: - m_EditorClassIdentifier: - imageToChange: {fileID: 8358525157842135572} ---- !u!33 &5935859409558485024 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3132340118756441274} - m_Mesh: {fileID: 0} ---- !u!114 &6723528486337534183 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3132340118756441274} - 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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_text: Hint - m_isRightToLeft: 0 - m_fontAsset: {fileID: 0} - m_sharedMaterial: {fileID: 0} - 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: 0 - m_overrideHtmlColors: 0 - m_faceColor: - serializedVersion: 2 - rgba: 4294967295 - m_fontSize: 26 - m_fontSizeBase: 26 - m_fontWeight: 400 - m_enableAutoSizing: 1 - m_fontSizeMin: 18 - m_fontSizeMax: 72 - m_fontStyle: 0 - m_HorizontalAlignment: 1 - m_VerticalAlignment: 256 - m_textAlignment: 514 - 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!1001 &8313031688112979328 PrefabInstance: m_ObjectHideFlags: 0 @@ -282,6 +172,11 @@ PrefabInstance: propertyPath: highlightColor.r value: 0.9529412 objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: ScrollParameterObject + value: + objectReference: {fileID: 0} - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, type: 3} propertyPath: defaultHintButtonColor.a @@ -423,27 +318,106 @@ PrefabInstance: - {fileID: 6410099383612658499, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, type: 3} - {fileID: 3165625469853059737, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, type: 3} ---- !u!1 &8358525157842135574 stripped +--- !u!1 &3132340118756441274 stripped GameObject: - m_CorrespondingSourceObject: {fileID: 45775000557492118, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + m_CorrespondingSourceObject: {fileID: 6351655452780298554, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, type: 3} m_PrefabInstance: {fileID: 8313031688112979328} m_PrefabAsset: {fileID: 0} ---- !u!114 &8358525157842135572 stripped +--- !u!33 &5935859409558485024 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3132340118756441274} + m_Mesh: {fileID: 0} +--- !u!114 &6723528486337534183 MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 45775000557492116, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, - type: 3} - m_PrefabInstance: {fileID: 8313031688112979328} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8358525157842135574} + m_GameObject: {fileID: 3132340118756441274} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &3132340118756441274 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 6351655452780298554, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, - type: 3} - m_PrefabInstance: {fileID: 8313031688112979328} - m_PrefabAsset: {fileID: 0} + 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_text: Hint + m_isRightToLeft: 0 + m_fontAsset: {fileID: 0} + m_sharedMaterial: {fileID: 0} + 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: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 26 + m_fontSizeBase: 26 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 514 + 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} diff --git a/Assets/Scenes/Menues/MainMenue.unity b/Assets/Scenes/Menues/MainMenue.unity index a71f8fd0ea2cf2c1929c3ab9d7ff12693b225097..5f6c52ec01082e7f84f02c803581404bc74c8824 100644 --- a/Assets/Scenes/Menues/MainMenue.unity +++ b/Assets/Scenes/Menues/MainMenue.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.37294164, g: 0.38055754, b: 0.35860202, a: 1} + m_IndirectSpecularColor: {r: 0.3730807, g: 0.380755, b: 0.35876408, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: diff --git a/Assets/Scenes/Worlds/RiverWorld.unity b/Assets/Scenes/Worlds/RiverWorld.unity index 6b084df8500bb46763a25d507b1b1d39d82734f4..1f30a61af541bc4df564f027f9f9bdbcf83151f1 100644 --- a/Assets/Scenes/Worlds/RiverWorld.unity +++ b/Assets/Scenes/Worlds/RiverWorld.unity @@ -60825,6 +60825,16 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 3231672576010862975, guid: b07552db700124a4680401e6fb94c186, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: MagicButtonTrigger + objectReference: {fileID: 0} + - target: {fileID: 3231672576010862975, guid: b07552db700124a4680401e6fb94c186, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: ScrollDetails, Assembly-CSharp + objectReference: {fileID: 0} - target: {fileID: 3256699174731649202, guid: b07552db700124a4680401e6fb94c186, type: 3} propertyPath: m_SizeDelta.y diff --git a/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset index 549af07f59fe13f256d10619f078fc2c39748d15..081d6278be16fd998f183894033d1be742805c9a 100644 --- a/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset @@ -20,7 +20,7 @@ MonoBehaviour: ButtonIndx: 5 LayerHitMask: serializedVersion: 2 - m_Bits: 535553 + m_Bits: 535569 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/Scripts/GlobalBehaviour.cs b/Assets/Scripts/GlobalBehaviour.cs index 071a85bae356483e9c4d825dd35dcdb102f3bf19..34f13735b0f4c31da3824dad884ae5b58615b276 100644 --- a/Assets/Scripts/GlobalBehaviour.cs +++ b/Assets/Scripts/GlobalBehaviour.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.Networking; -public class GlobalBehaviour : MonoBehaviour, ISerializationCallbackReceiver +public class GlobalBehaviour : MonoBehaviour { public static GlobalBehaviour Instance { @@ -22,57 +22,30 @@ public static GlobalBehaviour Instance //Make sure when using RGBA-Colors, the A-value of animationStartColor //and animationEndColor is the same OR try with value = 255 - public static Color hintAnimationStartColor; - public static Color hintAnimationEndColor; - public static float hintAnimationDuration; + public static Color HintAnimationStartColor => Instance._hintAnimationStartColor; + public static Color HintAnimationEndColor => Instance._hintAnimationEndColor; + public static float HintAnimationDuration => Instance._hintAnimationDuration; + public static float AnimationLerpDuration => Instance._AnimationLerpDuration; - public static Color StageAccomplished; - public static Color StageNotYetAccomplished; - public static Color StageError; + public static Color StageAccomplished => Instance._StageAccomplished; + public static Color StageNotYetAccomplished => Instance._StageNotYetAccomplished; + public static Color StageError => Instance._StageError; - public static float GadgetLaserDistance; - public static float GadgetPhysicalDistance; + public static float GadgetLaserDistance => Instance._GadgetLaserDistance; + public static float GadgetPhysicalDistance => Instance._GadgetPhysicalDistance; #region Unity Serialization [SerializeField] private Color _hintAnimationStartColor; [SerializeField] private Color _hintAnimationEndColor; [SerializeField] private float _hintAnimationDuration; + [SerializeField] private float _AnimationLerpDuration; [SerializeField] private Color _StageAccomplished; [SerializeField] private Color _StageNotYetAccomplished; [SerializeField] private Color _StageError; - [SerializeField] private float _GadgetLaserDistance = 30f; - [SerializeField] private float _GadgetPhysicalDistance = 2.5f; - - - void ISerializationCallbackReceiver.OnAfterDeserialize() - { - hintAnimationStartColor = _hintAnimationStartColor; - hintAnimationEndColor = _hintAnimationEndColor; - hintAnimationDuration = _hintAnimationDuration; - - StageAccomplished = _StageAccomplished; - StageNotYetAccomplished = _StageNotYetAccomplished; - StageError = _StageError; - - GadgetLaserDistance = _GadgetLaserDistance; - GadgetPhysicalDistance = _GadgetPhysicalDistance; - } - - void ISerializationCallbackReceiver.OnBeforeSerialize() - { - _hintAnimationStartColor = hintAnimationStartColor; - _hintAnimationEndColor = hintAnimationEndColor; - _hintAnimationDuration = hintAnimationDuration; - - _StageAccomplished = StageAccomplished; - _StageNotYetAccomplished = StageNotYetAccomplished; - _StageError = StageError; - - _GadgetLaserDistance = GadgetLaserDistance; - _GadgetPhysicalDistance = GadgetPhysicalDistance; - } + [SerializeField] private float _GadgetLaserDistance; + [SerializeField] private float _GadgetPhysicalDistance; #endregion private void Awake() diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index aa9556c56a09dfc3bfcd4dd088849ebfdeb6dfe2..22c55f0af9a7c3b57852454953cf0cf7a2499597 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -14,7 +14,6 @@ public static class CommunicationEvents public static UnityEvent<Fact> AddFactEvent = new(); public static UnityEvent<Fact> RemoveFactEvent = new(); - public static UnityEvent<Fact, FactObject.FactMaterials> PushoutFactEvent = new(); public static UnityEvent<Fact, Scroll.ScrollApplicationInfo> PushoutFactFailEvent = new(); public static UnityEvent gameSucceededEvent = new(); @@ -22,9 +21,9 @@ public static class CommunicationEvents public static UnityEvent NewAssignmentEvent = new(); public static UnityEvent StartT0Event = new(); - public static UnityEvent<GameObject, string> ScrollFactHintEvent = new(); - public static UnityEvent<Fact, FactObject.FactMaterials> AnimateExistingFactEvent = new(); - public static UnityEvent<Fact, FactObject.FactMaterials> AnimateExistingAsSolutionEvent = new(); + public static UnityEvent<ImageHintAnimation, string> ScrollFactHintEvent = new(); + public static UnityEvent<string, FactWrapper.FactMaterials> AnimateExistingFactEvent = new(); + public static UnityEvent<Fact, FactWrapper.FactMaterials> AnimateExistingAsSolutionEvent = new(); public static UnityEvent<Fact> AnimateNonExistingFactEvent = new(); public static UnityEvent<List<string>> HintAvailableEvent = new(); diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs index 344df17b5ea2c7e848ada3bfd8a304dbb50d1bce..e25eda05a4b962109238d41b9035a32579130da0 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs @@ -145,13 +145,13 @@ class LineSpanningOverRiverWorldComparer : FactComparer /// \copydoc FactComparer.Compare protected override bool Compare(Fact solution, Fact fact) { - if (!(fact is LineFact factLine)) + if (fact is not LineFact factLine) return false; // get positions of anker points - var point_pos = + Vector3[] point_pos = factLine.DependentFactIds - .Select(id => FactOrganizer.AllFacts[id].Representation.transform.position) + .Select(id => FactOrganizer.AllFacts[id].Position) .ToArray(); // check anker points *not within* RiverWall diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs index 242e9d4b86db25e710aa6971a999fd6a21a66310..c3cb432ac7db3e4cb675145aafb78bf59cb13b20 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs @@ -5,22 +5,14 @@ using System.Collections; using TMPro; using UnityEditor; +using static GlobalBehaviour; /// <summary> -/// <see cref="Fact.Id"/>/ <c>MonoBehaviour</c> wrapper to be attached to <see cref="Fact.Representation"/> +/// <see cref="Fact.Id"/>/ <c>MonoBehaviour</c> wrapper to be attached to <see cref="Fact.WorldRepresentation"/> /// </summary> [DisallowMultipleComponent] public class FactObject : FactWrapper, ISerializationCallbackReceiver { - public enum FactMaterials - { - Default = 0, - Selected = 1, - Hint = 2, - Solution = 3, - } - - [SerializeField] protected List<TMP_Text> FactText; [SerializeField] protected List<string> StringLabelFormats; @@ -95,6 +87,30 @@ private void Awake() { AllChildren = transform.GetComponentsInChildren<FactObject>(includeInactive: true).ToList(); AllChildren.Remove(this); + + FactText ??= new(); + StringLabelFormats ??= new(); + } + + public override void HighlightAs(FactMaterials tmpState) + { + CoroutineCascadeForMeAndChildrenAllRenderer( + (fact_obj, renderer) => _Animation(fact_obj, renderer) + ); + + IEnumerator _Animation(FactObject fact_obj, Renderer renderer) + { + for (IEnumerator clock = IEnumeratorExtensions.WaitForSeconds(HintAnimationDuration) + ; clock.MoveNext();) + { + renderer.material.Lerp(fact_obj.materials[(int)tmpState], + fact_obj.Default, + Mathf.PingPong(Time.time, AnimationLerpDuration)); + yield return null; + } + + renderer.material = fact_obj.Default; + } } protected override void FactUpdated() @@ -106,7 +122,7 @@ protected override void FactUpdated() foreach (FactObject childObject in AllChildren) { childObject._URI = _URI; - childObject._Fact = null; + childObject._Fact = _Fact; childObject.ReLabel(); } } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactOrganizer.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactOrganizer.cs index a3bace2c7fe9ac5f9465f0334b5e1489def088ed..94d864e7210a2748ff89aca748a2128794dc948a 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactOrganizer.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactOrganizer.cs @@ -221,7 +221,7 @@ public stepnote(FactOrganizer that, string Id, bool samestep, bool creation, Gad bool set_workflow = !samestep || new_gadget || prev.gadget_rank != this.gadget_rank || gadget_last_occurrence >= that.marker; - stepnote gadget_prev = set_workflow + stepnote gadget_prev = set_workflow ? default /*unused then*/ : that.Workflow[gadget_last_occurrence]; @@ -313,11 +313,11 @@ public FactOrganizer(bool invoke = false) : this() /// <param name="source">instance to be parsed</param> /// <param name="invoke">see <see cref="invoke"/></param> /// <param name="old_to_new">Generated to map <c>Key</c> outdated <see cref="Fact.Id"/>s to corresponding <c>Value</c> updatated <see cref="Fact.Id"/>s.</param> - public static T ReInitializeFactOrganizer<T>(T source, bool invoke, out Dictionary<string, string> old_to_new) + public static T ReInitializeFactOrganizer<T>(T source, bool invoke, out Dictionary<string, string> old_to_new) where T : FactOrganizer, new() { // TODO: other strategy needed when MMT save/load supported - bool source_initialized = GlobalFactDictionary.AllFactSpaces.ContainsKey(source) + bool source_initialized = GlobalFactDictionary.AllFactSpaces.ContainsKey(source) && source.MyFactSpace.Count > 0; Dictionary<string, string> _old_to_new = source_initialized @@ -403,9 +403,9 @@ Fact ReInitializeFact(string old_id) return null; } - Fact new_Fact = old_Fact.ReInitializeMe(_old_to_new, target); + Fact new_Fact = old_Fact.ReInitializeMe(_old_to_new, target); // check for dupes? - _old_to_new.Add(old_Fact.Id, new_Fact.Id); + _old_to_new.Add(old_Fact.Id, new_Fact.Id); //move up return new_Fact; } @@ -464,36 +464,6 @@ public bool ContainsLabel(string label) return !hit.Equals(default); } - //TODO? MMT? PERF: O(n), every Fact-insertion - /// <summary> - /// Looks for existent <see cref="Fact"/> (<paramref name="found"/>) which is very similar or identical (<paramref name="exact"/>) to prposed <see cref="Fact"/> (<paramref name="search"/>) - /// <remarks>does not check active state</remarks> - /// </summary> - /// <param name="search">to be searched for</param> - /// <param name="found"><see cref="Fact.Id"/> if return value is <c>true</c></param> - /// <param name="exact"><c>true</c> iff <paramref name="found"/> == <paramref name="search"/><see cref="Fact.Id">.Id</see></param> - /// <returns><c>true</c> iff the exact same or an equivalent <see cref="Fact"/> to <paramref name="search"/> was found in <see cref="MyFactSpace"/></returns> - private bool FindEquivalent(Fact search, out string found, out bool exact) - { - if (exact = MyFactSpace.ContainsKey(search.Id)) - { - found = search.Id; - return true; - } - - foreach (var entry in MyFactSpace) - { - if (entry.Value.Equivalent(search)) - { - found = entry.Key; - return true; - } - } - - found = null; - return false; - } - /// <summary> /// <see cref="PruneWorkflow">prunes</see> & adds <paramref name="note"/> to <see cref="Workflow"/>; <see cref="InvokeFactEvent(bool, string)">Invokes Events</see> /// </summary> @@ -578,7 +548,7 @@ public string Add(Fact value, out bool exists, bool samestep, Gadget gadget, str string key; #pragma warning restore IDE0018 // Inlinevariablendeklaration - if (exists = FindEquivalent(value, out key, out bool _)) + if (exists = GlobalFactDictionary.FindEquivalent(MyFactSpace, value, out key, out bool _)) { if (exists = MetaInf[key].active) //Fact in Scene? // desired outcome already achieved @@ -591,7 +561,12 @@ public string Add(Fact value, out bool exists, bool samestep, Gadget gadget, str else // brand new Fact { - key = value.Id; + //buggy mess + //if (GlobalFactDictionary.FindEquivalent(AllFacts, value, out key, out bool _)) + // value = AllFacts[key]; + //else + key = value.Id; + GlobalFactDictionary.FactSpaceAdd(this, value); MetaInf.Add(key, new meta(marker, true, isImmutable)); } @@ -1057,5 +1032,36 @@ public static void FactSpaceRemove(FactOrganizer me, string key) else FactReferences[key]--; } + + //TODO? MMT? PERF: O(n), every Fact-insertion + /// <summary> + /// Looks for existent <see cref="Fact"/> (<paramref name="found"/>) which is very similar or identical (<paramref name="exact"/>) to prposed <see cref="Fact"/> (<paramref name="search"/>) + /// <remarks>does not check active state</remarks> + /// </summary> + /// <param name="FactSpace">to search in</param> + /// <param name="search">to be searched for</param> + /// <param name="found"><see cref="Fact.Id"/> if return value is <c>true</c></param> + /// <param name="exact"><c>true</c> iff <paramref name="found"/> == <paramref name="search"/><see cref="Fact.Id">.Id</see></param> + /// <returns><c>true</c> iff the exact same or an equivalent <see cref="Fact"/> to <paramref name="search"/> was found in <see cref="MyFactSpace"/></returns> + public static bool FindEquivalent(IReadOnlyDictionary<string, Fact> FactSpace, Fact search, out string found, out bool exact) + { + if (exact = FactSpace.ContainsKey(search.Id)) + { + found = search.Id; + return true; + } + + foreach (var entry in FactSpace) + { + if (entry.Value.Equivalent(search)) + { + found = entry.Key; + return true; + } + } + + found = null; + return false; + } } } \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs index 21fcea377d6ce50b586a4b86a3624f0804515891..80563e96ef986475276fc17f161fa5ffabed8a21 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs @@ -17,9 +17,7 @@ public GameObject void Start() { AddFactEvent.AddListener(SpawnFactRepresentation); - RemoveFactEvent.AddListener(DeleteObject); - - AnimateNonExistingFactEvent.AddListener(animateNonExistingFactTrigger); + AnimateNonExistingFactEvent.AddListener(AnimateNonExistingFactTrigger); } public void SpawnFactRepresentation(Fact fact) @@ -45,25 +43,29 @@ public void SpawnFactRepresentation(Fact fact) public void SpawnAttachedPositionFunction(AttachedPositionFunction fact) { - var attachedBehaviour = fact.Fact.Representation.AddComponent<AttachedPositionFunctionBehaviour>(); - attachedBehaviour.URI = fact.Id; + var attachedBehaviour = fact.Fact.WorldRepresentation.gameObject + .AddComponent<AttachedPositionFunctionBehaviour>(); + attachedBehaviour.Fact = fact; - fact.Representation = attachedBehaviour.gameObject; + fact.WorldRepresentation = attachedBehaviour; } public void SpawnPoint(PointFact fact) { GameObject point = GameObject.Instantiate(Sphere); - point.GetComponent<FactObject>().URI = fact.Id; + fact.WorldRepresentation = point.GetComponent<FactObject>(); + fact.WorldRepresentation.Fact = fact; + point.transform.SetPositionAndRotation(fact.Position, fact.Rotation); - fact.Representation = point; } public void SpawnLine(LineFact fact) { //Change FactRepresentation to Line GameObject line = GameObject.Instantiate(Line); - line.GetComponentInChildren<FactObject>().URI = fact.Id; + fact.WorldRepresentation = line.GetComponentInChildren<FactObject>(); + fact.WorldRepresentation.Fact = fact; + //Place the Line in the centre of the two points line.transform.position = fact.Position; @@ -74,15 +76,15 @@ public void SpawnLine(LineFact fact) line.GetComponentInChildren<TextMeshPro>().text = fact.Label + " = " + Math.Round(fact.Distance, 2) + " m"; - - fact.Representation = line; } public void SpawnRay(RayFact fact) { //Change FactRepresentation to Line GameObject line = GameObject.Instantiate(Ray); - line.GetComponentInChildren<FactObject>().URI = fact.Id; + fact.WorldRepresentation = line.GetComponentInChildren<FactObject>(); + fact.WorldRepresentation.Fact = fact; + //Place the Line in the centre of the two points line.transform.position = fact.Position; @@ -90,8 +92,6 @@ public void SpawnRay(RayFact fact) //and without affecting Scale of the Text line.transform.GetChild(0).localScale = fact.LocalScale; line.transform.GetChild(0).rotation = fact.Rotation; - - fact.Representation = line; } //Spawn an angle: point with id = angleFact.Pid2 is the point where the angle gets applied @@ -99,7 +99,9 @@ public void SpawnAngle(AbstractAngleFact fact) { //Change FactRepresentation to Angle GameObject angle = GameObject.Instantiate(Angle); - angle.GetComponentInChildren<FactObject>().URI = fact.Id; + fact.WorldRepresentation = angle.GetComponentInChildren<FactObject>(); + fact.WorldRepresentation.Fact = fact; + angle.transform.SetPositionAndRotation(fact.Position, fact.Rotation); //Set text of angle @@ -114,8 +116,6 @@ public void SpawnAngle(AbstractAngleFact fact) CircleSegmentGenerator[] segments = angle.GetComponentsInChildren<CircleSegmentGenerator>(); foreach (CircleSegmentGenerator c in segments) c.setAngle((float)fact.angle); - - fact.Representation = angle; } public void SpawnRingAndCircle(CircleFact fact) @@ -125,14 +125,13 @@ public void SpawnRingAndCircle(CircleFact fact) SpawnCircle(fact, ringAndCircleGO.transform); ringAndCircleGO.transform.SetPositionAndRotation(fact.Position, fact.Rotation); - - fact.Representation = ringAndCircleGO; + fact.WorldRepresentation = ringAndCircleGO.AddComponent<FactObject>(); + fact.WorldRepresentation.Fact = fact; } public void SpawnRing(CircleFact circleFact, Transform parent = null) { GameObject ring = GameObject.Instantiate(Ring, parent); - ring.GetComponentInChildren<FactObject>().URI = circleFact.Id; var tori = ring.GetComponentsInChildren<TorusGenerator>(); foreach (var torus in tori) @@ -142,15 +141,11 @@ public void SpawnRing(CircleFact circleFact, Transform parent = null) public void SpawnCircle(CircleFact circleFact, Transform parent = null) { GameObject circle = Instantiate(Circle, parent); - circle.GetComponent<FactObject>().URI = circleFact.Id; //Set radius circle.transform.localScale = Vector3.Scale(circle.transform.localScale, circleFact.LocalScale); } - public void DeleteObject(Fact fact) - => GameObject.Destroy(fact.Representation); - - public void animateNonExistingFactTrigger(Fact fact) + public void AnimateNonExistingFactTrigger(Fact fact) { StartCoroutine(animateNonExistingFact(fact)); @@ -158,11 +153,11 @@ IEnumerator animateNonExistingFact(Fact fact) { SpawnFactRepresentation(fact); - ShinyThings.HighlightFact(fact, FactObject.FactMaterials.Hint); + AnimateExistingFactEvent.Invoke(fact.Id, FactWrapper.FactMaterials.Hint); - yield return new WaitForSeconds(GlobalBehaviour.hintAnimationDuration); + yield return new WaitForSeconds(GlobalBehaviour.HintAnimationDuration); - GameObject.Destroy(fact.Representation); + RemoveFactEvent.Invoke(fact); } } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper.cs index 04d1f5886859b3b63a11b82e18fe80f2499207e4..65ef5c09c9eda21502b56b8d0ded77f4cd151f5d 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper.cs @@ -3,10 +3,18 @@ /// <summary> /// <see cref="Fact.Id"/> <c>MonoBehaviour</c> wrapper to be attached to a <see cref="GameObject"/> /// </summary> -public abstract class FactWrapper : MonoBehaviour//, ISerializationCallbackReceiver +public class FactWrapper : MonoBehaviour//, ISerializationCallbackReceiver { + public enum FactMaterials + { + Default = 0, + Selected = 1, + Hint = 2, + Solution = 3, + } + /// <summary> - /// <see cref="Fact.Id"/> to identify arbitrary <see cref="Fact"/> by its <see cref="Fact.Representation"/> + /// <see cref="Fact.Id"/> to identify arbitrary <see cref="Fact"/> by its <see cref="Fact.WorldRepresentation"/> /// </summary> public string URI { @@ -18,7 +26,7 @@ public string URI FactUpdated(); } } - [HideInInspector, SerializeField] + [HideInInspector, SerializeField] // So cloning takes over protected string _URI; /// <summary> @@ -28,17 +36,55 @@ public Fact Fact { get { - if (_Fact == null) FactOrganizer.AllFacts.TryGetValue(URI, out _Fact); + if (_Fact == null && URI != null) + FactOrganizer.AllFacts.TryGetValue(URI, out _Fact); return _Fact; } set { _Fact = value; - _URI = value.Id; + _URI = value?.Id; FactUpdated(); } } protected Fact _Fact; - protected abstract void FactUpdated(); + private void Awake() + { + _Awake(); + } + protected virtual void _Awake() { } + + private void OnEnable() + { + CommunicationEvents.AnimateExistingFactEvent.AddListener(HiglightFactEvent); + CommunicationEvents.RemoveFactEvent.AddListener(DeleteFactEvent); + _OnEnable(); + } + protected virtual void _OnEnable() { } + + private void OnDisable() + { + CommunicationEvents.AnimateExistingFactEvent.RemoveListener(HiglightFactEvent); + CommunicationEvents.RemoveFactEvent.RemoveListener(DeleteFactEvent); + _OnDisable(); + } + protected virtual void _OnDisable() { } + + public void HiglightFactEvent(string fid, FactMaterials tmpState) + { + if (fid == URI) + HighlightAs(tmpState); + } + public virtual void HighlightAs(FactMaterials tmpState) { } + + public void DeleteFactEvent(Fact fact) + { + if (fact.Id == URI) + _DeleteFactEvent(fact); + } + protected virtual void _DeleteFactEvent(Fact fact) + => Destroy(gameObject); + + protected virtual void FactUpdated() { } } \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs index c273068e0cc412d4b97543594212a0b671779963..ba1281994be6b4f5e56738cc78ff9ba8a3b67ad3 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractAngleFact.cs @@ -129,7 +129,7 @@ public AngleFact(string pid1, string pid2, string pid3, FactOrganizer organizer) { angle = Vector3.Angle((Point1.Point - Point2.Point), (Point3.Point - Point2.Point)); - this.is_right_angle = Mathf.Abs(angle - 90.0f) < Math3d.vectorPrecission; + this.is_right_angle = Mathf.Approximately(angle, 90.0f); angle = is_right_angle ? 90f : angle; diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs index 434c83285e3f89111b6188b6a91defba0f165a47..2f775ff10e26923e27eb68b3fe28c6b3d32317e3 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs @@ -99,7 +99,7 @@ public abstract class Fact /// </summary> /// <seealso cref="FactObject"/> [JsonIgnore] - public GameObject Representation; + public FactWrapper WorldRepresentation; /// <summary> /// Collection of <c>Type</c>s of *all* available <see cref="Fact"/>s to choose from. @@ -136,10 +136,11 @@ public string Id { get { - while (FetchURICoroutine.MoveNext()) ; //active wait for server + //while (FetchURICoroutine.MoveNext()) ; //active wait for server return _URI; } } + //private IEnumerator FetchURICoroutine = IEnumeratorExtensions.yield_break; /// <summary> /// MMT URI @@ -249,8 +250,6 @@ protected set } private Vector3 _LocalScale; - private IEnumerator FetchURICoroutine = IEnumeratorExtensions.yield_break; - /// <summary> /// Only being used by [JsonReader](https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_JsonReader.htm) to initiate empty \ref Fact "Facts". /// <seealso cref="SOMDocManager"/> @@ -409,34 +408,42 @@ public static Fact parseFact(MMTDeclaration fact) } } + /// <summary> + /// + /// </summary> + /// <remarks>Asynchron version has proofen inefficent, since <see cref="Fact.Id"/> is usually called in close proximity.</remarks> + // Asynchron version in comments public void SendToMMT() { MMTDeclaration mmtDecl = MakeMMTDeclaration(); - GlobalBehaviour.Instance.StartCoroutine( - FetchURICoroutine = _SendAdd( + //GlobalBehaviour.Instance.StartCoroutine( + // FetchURICoroutine = + _URI = + _SendAdd( CommunicationEvents.ServerAdress + "/fact/add", - mmtDecl.ToJson(), - (string uri) => _SendURICallback(mmtDecl, uri) - )); + mmtDecl.ToJson() + //,(string uri) => _SendURICallback(mmtDecl, uri) + );//); - return; + //return; - void _SendURICallback(MMTDeclaration mmtDecl, string uri) - { - this._URI = uri; + //void _SendURICallback(MMTDeclaration mmtDecl, string uri) + //{ + // _URI = uri; if (mmtDecl is MMTSymbolDeclaration mMTSymbol && mMTSymbol.defines != null) - ParsingDictionary.parseTermsToId[mMTSymbol.defines.ToString()] = uri; - } + ParsingDictionary.parseTermsToId[mMTSymbol.defines.ToString()] = _URI; + //} - IEnumerator _SendAdd(string path, string body, Action<string> uriCallback) + /*IEnumerator*/ + string _SendAdd(string path, string body)//, Action<string> uriCallback) { if (!CommunicationEvents.ServerRunning) { Debug.LogWarning("Server not running"); - uriCallback(null); - yield break; + //uriCallback(null); + return null; // yield break; } if (CommunicationEvents.VerboseURI) @@ -448,21 +455,25 @@ IEnumerator _SendAdd(string path, string body, Action<string> uriCallback) www.SetRequestHeader("Content-Type", "application/json"); www.timeout = 1; - yield return www.SendWebRequest(); + //yield return + UnityWebRequestAsyncOperation web = + www.SendWebRequest(); + + while (!web.isDone) ; if (www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError) { Debug.LogWarning(www.error); - uriCallback(null); - yield break; + //uriCallback(null); + return null; // yield break; } else { string answer = null; while (string.IsNullOrEmpty(answer)) { - yield return null; + //yield return null; answer = www.downloadHandler.text; } @@ -471,8 +482,8 @@ IEnumerator _SendAdd(string path, string body, Action<string> uriCallback) if (CommunicationEvents.VerboseURI) Debug.Log("Server added Fact:\n" + res.uri); - uriCallback(res.uri); - yield break; + //uriCallback(res.uri); + return res.uri; // yield break; } } } @@ -518,7 +529,7 @@ public class PointFact : FactWrappedCRTP<PointFact> { /// <summary> Position </summary> public Vector3 Point; - /// <summary> Orientation for <see cref="Fact.Representation"/> </summary> + /// <summary> Orientation for <see cref="Fact.WorldRepresentation"/> </summary> [JsonProperty] private Vector3 Normal; diff --git a/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs index c94cde8412aa48a4ab3019ca561ffd6813ff3839..b38acaf2fb5f711a7fced537e1b67b65217115c3 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs @@ -15,7 +15,7 @@ public class AngleTool : Gadget private float curveRadius; - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) diff --git a/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs b/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs index 6dbe00786752b556bc58e0de53f3a2678ee6cbcc..7bf4cd79de16308cb996f1c4b70a5c549e69bf56 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs @@ -10,7 +10,7 @@ public class EqualCircleGadget : Gadget protected static new string s_type = "EqualCircles"; - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) // filters double hits / exact ones diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs b/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs index 25cfffdfd77360e9d4b1a69ccf4985a9b3954af0..d9958998aeff638b1cfe3081160e3b7c5e87b3ee 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs @@ -200,16 +200,16 @@ public void Hit(RaycastHit[] hit) _Hit(hit); } - public virtual void _Awake() { } - public virtual void _Enable() { } - public virtual void _Disable() { } - public virtual void _Update() { } + protected virtual void _Awake() { } + protected virtual void _Enable() { } + protected virtual void _Disable() { } + protected virtual void _Update() { } /// <summary> /// Called when <see cref="CommunicationEvents.TriggerEvent"/> is invoked, a.k.a. when Player clicks in GameWorld. /// </summary> /// <param name="hit">the position where it was clicked</param> - public virtual void _Hit(RaycastHit[] hit) { } + protected virtual void _Hit(RaycastHit[] hit) { } protected void ActivateLineDrawing() { diff --git a/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs index 01419014934dbead6ab882e94b4ca68cc6d7c4ff..84855ae9686d9671c875cf6ce9d6cfe83d43f884 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs @@ -9,9 +9,9 @@ public class LineTool : Gadget //Cache for drawing Line private readonly Vector3[] LineOrigin = new Vector3[1]; - - public override void _Hit(RaycastHit[] hit) + + protected override void _Hit(RaycastHit[] hit) { string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) diff --git a/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs index 7c3d2ed130b3a5c08215b26228c5dd144464ce2e..e6a86047054a21b8dbd9b536c78e8ba497292829 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs @@ -18,7 +18,7 @@ public class LotTool : Gadget private Vector3 BaseLineHit; - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { void CreateRayAndAngles(string IntersectionId, string LotPointId, bool samestep) { @@ -30,12 +30,15 @@ void CreateRayAndAngles(string IntersectionId, string LotPointId, bool samestep) , IntersectionId, LotPointId, samestep: true, gadget: this); } - string tempFactId; - if (!hit[0].transform.TryGetComponent(out FactObject obj) - || Workflow.Contains(tempFactId = obj.URI)) + string tempFactId = null; + if (hit[0].transform.TryGetComponent(out FactObject obj) + && Workflow.Contains(tempFactId = obj.URI)) return; - Fact tempFact = FactOrganizer.AllFacts[tempFactId]; + Fact tempFact = tempFactId == null + ? null + : FactOrganizer.AllFacts[tempFactId]; + switch (Workflow.Count) { case 0: // select basline @@ -53,11 +56,11 @@ void CreateRayAndAngles(string IntersectionId, string LotPointId, bool samestep) case 1: // select point perpendiculum/lot goes through if (tempFact is not PointFact) return; + Workflow.Add(tempFactId); IntersectionPoint = Math3d.ProjectPointOnLine(BaseLineRoot, BaseLine.Dir, hit[0].transform.position); if (Math3d.IsApproximatelyEqual(IntersectionPoint, hit[0].transform.position)) { // TempFact is on baseLine - Workflow.Add(tempFactId); return; } else diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs b/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs index 41409c46af255f010be8d17c381a2656dff6a143..f97fa0bb1ce3a6e265e468af56584f1e7e1a4bb7 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs @@ -7,12 +7,12 @@ public class Pendulum : Gadget [Newtonsoft.Json.JsonProperty] protected static new string s_type = "Pendulum"; - public override void _Enable() + protected override void _Enable() { ActivateLineDrawing(); } - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { //Raycast downwoard if (Physics.Raycast(hit[0].transform.position, Vector3.down, out RaycastHit ground, Mathf.Infinity, this.SecondaryLayerMask.value)) diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs b/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs index e0b033f815985a464336f7f340d729f0b848729b..657a93c5db4508a11643f06929f30f155771e247 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs @@ -7,7 +7,7 @@ public class Pointer : Gadget protected static new string s_type = "Pointer"; - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { string pid = FactManager.AddPointFact(hit[0], gadget: this).Id; diff --git a/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs index c3ff161c9d9c03dc068ab1eec699bae600e545ef..9d9972be470034adeb19e9a31822bf1b5644c51e 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs @@ -10,12 +10,12 @@ public class PoleTool : Gadget public float poleHeight = 1f; - public override void _Enable() + protected override void _Enable() { ActivateLineDrawing(); } - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { if (!Physics.Raycast( GadgetBehaviour.Cursor.transform.position + Vector3.up * (float)Math3d.vectorPrecission diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs b/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs index 359c463eded1aa02e5e29785976cfeefae6a10e3..9d93ce8f1645fcca073ac3fef2a34e963f51d0ed 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs @@ -11,7 +11,7 @@ public class Remover : Gadget protected static new string s_type = "Remover"; - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { bool samestep = false; foreach (string uri in hit.Select(h => h.transform.GetComponent<FactObject>()?.URI)) diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs b/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs index ca80d54abd4bfdb436c3c58b035ec75dfe11d826..763f8da0720df63575bc6c729e3c36324aee64e2 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs @@ -10,7 +10,7 @@ public class Tape : Gadget private readonly Vector3[] LineOrigin = new Vector3[1]; - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) diff --git a/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs b/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs index 9903f2160ecfbd2ea366014e25feff783a73bdc1..721adf57fdbdbf0bb932ae29bccf23efa1933d5e 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs @@ -9,7 +9,7 @@ public class TestMiddlePoint : Gadget //Cache for drawing Line private readonly Vector3[] LineOrigin = new Vector3[1]; - public override void _Hit(RaycastHit[] hit) + protected override void _Hit(RaycastHit[] hit) { string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) diff --git a/Assets/Scripts/InteractionEngine/ImageHintAnimation.cs b/Assets/Scripts/InteractionEngine/ImageHintAnimation.cs index 01eca9e9a29140f8ac59d2d602389a2ccbfc592e..173ce4dbfaf6508af0600130c323c4b54209e1cc 100644 --- a/Assets/Scripts/InteractionEngine/ImageHintAnimation.cs +++ b/Assets/Scripts/InteractionEngine/ImageHintAnimation.cs @@ -6,11 +6,11 @@ public class ImageHintAnimation : MonoBehaviour { public Image imageToChange; - [System.NonSerialized] - public Color imageToChangeDefaultColor; - private IEnumerator routine; + [HideInInspector, SerializeField] // So cloning takes over + private Color imageToChangeDefaultColor; + private IEnumerator AnimationRoutine; + - // Start is called before the first frame update void Awake() { if (imageToChange != null) @@ -19,18 +19,18 @@ void Awake() public void AnimationTrigger() { - StartCoroutine(routine = _Animation()); + StartCoroutine(AnimationRoutine = _Animation()); IEnumerator _Animation() { - for (IEnumerator track = IEnumeratorExtensions.WaitForSeconds(GlobalBehaviour.hintAnimationDuration) - ; track.MoveNext();) + for (IEnumerator clock = IEnumeratorExtensions.WaitForSeconds(GlobalBehaviour.HintAnimationDuration) + ; clock.MoveNext();) yield return imageToChange.color = Color.Lerp - ( GlobalBehaviour.hintAnimationStartColor - , GlobalBehaviour.hintAnimationEndColor - , Mathf.PingPong(Time.time, 1)); + ( GlobalBehaviour.HintAnimationStartColor + , GlobalBehaviour.HintAnimationEndColor + , Mathf.PingPong(Time.time, GlobalBehaviour.AnimationLerpDuration)); imageToChange.color = imageToChangeDefaultColor; } @@ -38,8 +38,8 @@ IEnumerator _Animation() public void ResetAnimation() { - if (routine != null) - StopCoroutine(routine); + if (AnimationRoutine != null) + StopCoroutine(AnimationRoutine); imageToChange.color = imageToChangeDefaultColor; } diff --git a/Assets/Scripts/InteractionEngine/ShinyThings.cs b/Assets/Scripts/InteractionEngine/ShinyThings.cs index b94a853baa7a6a185cfe1cae3c899b3aa58f8151..91b5e16402e8ac6e12e79f334015f5242ec9c39f 100644 --- a/Assets/Scripts/InteractionEngine/ShinyThings.cs +++ b/Assets/Scripts/InteractionEngine/ShinyThings.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; +using static FactWrapper; public class ShinyThings : MonoBehaviour { @@ -11,7 +12,7 @@ public class ShinyThings : MonoBehaviour //Variables for Pushout-Highlighting private static float timerDuration = 2.5f; - private static float lerpTime = 1f; + private static float lerpTime = GlobalBehaviour.AnimationLerpDuration; private IEnumerator rain_wait; private IEnumerator rain; @@ -26,13 +27,20 @@ public GameObject RainPrefab; - private void Awake() + private void OnEnable() { - CommunicationEvents.PushoutFactEvent.AddListener(HighlightFact); CommunicationEvents.PushoutFactFailEvent.AddListener(LetItRain); - CommunicationEvents.AnimateExistingFactEvent.AddListener(HighlightFact); CommunicationEvents.AnimateExistingAsSolutionEvent.AddListener(HighlightWithFireworks); + } + + private void OnDisable() + { + CommunicationEvents.PushoutFactFailEvent.RemoveListener(LetItRain); + CommunicationEvents.AnimateExistingAsSolutionEvent.RemoveListener(HighlightWithFireworks); + } + private void Awake() + { rain = rain_wait = IEnumeratorExtensions.yield_break; if (Cursor == null) @@ -80,23 +88,17 @@ void _ApplyMaterial(FactObject root, Material new_mat) => ); } - public static void HighlightFact(Fact startFact, FactObject.FactMaterials tmp_mat) + public static void HighlightFact(Fact startFact, FactMaterials tmp_mat) { - if (startFact.Representation == null) + if (startFact.WorldRepresentation == null) return; - FactObject selected_fact_obj = startFact.Representation.GetComponentInChildren<FactObject>(); - - selected_fact_obj.CoroutineCascadeForMeAndChildrenAllRenderer( - (fact_obj, renderer) => - renderer.ProgrammMaterialChange(new[] { - (0f, lerpTime, fact_obj.materials[(int) tmp_mat]), - (GlobalBehaviour.hintAnimationDuration, lerpTime, fact_obj.Default), - }) - ); + startFact.WorldRepresentation + .GetComponentInChildren<FactObject>() + ?.HighlightAs(tmp_mat); } - public void HighlightWithFireworks(Fact fact, FactObject.FactMaterials mat) + public void HighlightWithFireworks(Fact fact, FactMaterials mat) { rain_wait = IEnumeratorExtensions.yield_break; //stop rain @@ -107,7 +109,7 @@ IEnumerator _BlossomAndDie() { GameObject firework = GameObject.Instantiate (Fireworks_Animation - , fact.Representation.transform + , fact.WorldRepresentation.transform ); yield return new WaitForSeconds(timerDuration); diff --git a/Assets/Scripts/InteractionEngine/TBD/AttachedPositionFunctionBehaviour.cs b/Assets/Scripts/InteractionEngine/TBD/AttachedPositionFunctionBehaviour.cs index 9d8a932f24966e3bcf805ef4eb3022476d9434e6..d7ea61c34fc0848dea41c34a97a5084b2837d486 100644 --- a/Assets/Scripts/InteractionEngine/TBD/AttachedPositionFunctionBehaviour.cs +++ b/Assets/Scripts/InteractionEngine/TBD/AttachedPositionFunctionBehaviour.cs @@ -58,17 +58,20 @@ public void NewExecutingInstance() cloneComp.StartExecution(); } + public override void HighlightAs(FactMaterials tmpState) + => gameObject.GetComponent<FactObject>().HighlightAs(tmpState); + protected override void FactUpdated(){ startcondition = transform; f_t_to_pos = (Fact as AttachedPositionFunction).FunctionCallFacts.ToList(); } - private void OnEnable() + protected override void _OnEnable() { CommunicationEvents.StartT0Event.AddListener(NewExecutingInstance); } - private void OnDisable() + protected override void _OnDisable() { CommunicationEvents.StartT0Event.RemoveListener(NewExecutingInstance); } diff --git a/Assets/Scripts/InteractionEngine/WorldCursor.cs b/Assets/Scripts/InteractionEngine/WorldCursor.cs index 3f453b7a5a1e0b664e22c35c8bf3d6ad40ad4c53..aaa376b67378de2b20b05a071930a2c323281a0f 100644 --- a/Assets/Scripts/InteractionEngine/WorldCursor.cs +++ b/Assets/Scripts/InteractionEngine/WorldCursor.cs @@ -79,6 +79,7 @@ void Update() { // find first acceptable hit Fact fact = Hits[i].transform.TryGetComponent(out FactObject factObj) + && FactOrganizer.AllFacts.ContainsKey(factObj.URI) ? FactOrganizer.AllFacts[factObj.URI] : null; diff --git a/Assets/Scripts/InventoryStuff/DisplayFacts.cs b/Assets/Scripts/InventoryStuff/DisplayFacts.cs index 260a1c2baa0238328d66ae9d2053cbb5e02b4807..81e51b080dc22335491301762a21694fa93670f4 100644 --- a/Assets/Scripts/InventoryStuff/DisplayFacts.cs +++ b/Assets/Scripts/InventoryStuff/DisplayFacts.cs @@ -65,10 +65,10 @@ public void OnAfterDeserialize() _PrefabDictionary = new(); for (int i = 0; i != Math.Min(PrefabtTypeReadonly.Count, PrefabDataConfig.Count); i++) // if (PrefabDataConfig[i] != null) - _PrefabDictionary.TryAdd( - TypeExtensions<Fact>.UAssemblyInheritenceTypes.FirstOrDefault(type => type.ToString() == PrefabtTypeReadonly[i]), - PrefabDataConfig[i] - ); + _PrefabDictionary.TryAdd( + TypeExtensions<Fact>.UAssemblyInheritenceTypes.FirstOrDefault(type => type.ToString() == PrefabtTypeReadonly[i]), + PrefabDataConfig[i] + ); } #endregion ISerializationCallbackReceiver @@ -76,12 +76,24 @@ public void OnAfterDeserialize() void Awake() { Instance = this; //first come, first serve + } + private void OnEnable() + { AddFactEvent.AddListener(AddFact); RemoveFactEvent.AddListener(RemoveFact); - //AnimateExistingFactEvent.AddListener(AnimateFact); FactFavorisation.ChangeFavoriteEvent.AddListener(OnFavoriteChange); } + + private void OnDisable() + { + AddFactEvent.RemoveListener(AddFact); + RemoveFactEvent.RemoveListener(RemoveFact); + FactFavorisation.ChangeFavoriteEvent.RemoveListener(OnFavoriteChange); + } + + private void RemoveFact(Fact fact) + => displayedFacts.Remove(fact.Id); #endregion UnityMethods #region Implementation @@ -116,6 +128,8 @@ public void AddFact(Fact fact) private GameObject CreateDisplay(Transform transform, Fact fact) { var spot = Instantiate(factSpotPrefab, factscreenContent); + spot.GetComponent<FactWrapper>().Fact = fact; + return InstantiateDisplay(fact, spot.transform); } @@ -131,19 +145,6 @@ public static GameObject InstantiateDisplay(Fact fact, Transform transform) return ret; } - public void RemoveFact(Fact fact) - { - // destroy factSpot (parent of displayed fact) and the fact display with it - Destroy(displayedFacts[fact.Id].transform.parent.gameObject); - displayedFacts.Remove(fact.Id); - } - - public void AnimateFact(Fact fact) - { - var factIcon = displayedFacts[fact.Id]; - factIcon.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); - } - #region Sorting #region AscDesc public void AscDescChanged(Toggle t) diff --git a/Assets/Scripts/InventoryStuff/DragHandling.cs b/Assets/Scripts/InventoryStuff/DragHandling.cs index f3ab2cafd5094206254eb1de144db2919fea412f..577d44d3d9330b71f8c80090edc89b835eeb8894 100644 --- a/Assets/Scripts/InventoryStuff/DragHandling.cs +++ b/Assets/Scripts/InventoryStuff/DragHandling.cs @@ -6,6 +6,8 @@ public class DragHandling : MonoBehaviour, IDragHandler, IEndDragHandler private Vector3 StartingPosition; private Transform StartingParent; [HideInInspector] public bool dragged = false; + + public void OnDrag(PointerEventData eventData) { if (!dragged) @@ -28,6 +30,5 @@ public void OnEndDrag(PointerEventData eventData) transform.localPosition = StartingPosition; GetComponent<CanvasGroup>().blocksRaycasts = true; dragged = false; - } } diff --git a/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs b/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs index f0263f17d3e7924aaa14fe521bbf57d47cb88562..e744a1c21350437861f5789b94fc4a3fcb47e960 100644 --- a/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs +++ b/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs @@ -8,7 +8,8 @@ public class RenderedScrollFact : FactWrapper, IDropHandler, IPointerClickHandle { #region Serializable public TextMeshProUGUI LabelMesh; - public GameObject ScrollParameterObject; + public GameObject HintButton; + public ImageHintAnimation ImageHintObject; #endregion Serializable #region Properties @@ -41,39 +42,61 @@ public string ScrollFactLabel => LabelMesh.text; #endregion Properties - protected override void FactUpdated() { } + public override void HighlightAs(FactMaterials tmpState) + { + ImageHintObject.AnimationTrigger(); + } - public void Populate(Scroll scroll, int Nr) + protected override void FactUpdated() { - Scroll = scroll; - ID = Nr; + if (RenderedFactObject != null) + Destroy(RenderedFactObject.gameObject); + + CommunicationEvents.NewAssignmentEvent.Invoke(); + + _URI ??= ScrollFactURI; + + if (VerboseURI) + Debug.Log(nameof(RenderedScrollFact) + " recieved Fact: " + URI); } - private void SetLabel(string label) + protected override void _DeleteFactEvent(Fact fact) + => Fact = null; + + protected override void _Awake() { - LabelMesh.text = label ?? Scroll?.requiredFacts[ID].label ?? "Err"; + _URI ??= ScrollFactURI; } - private void OnEnable() + protected override void _OnEnable() { HintAvailableEvent.AddListener(OnHintAvailable); } - private void OnDisable() + protected override void _OnDisable() { HintAvailableEvent.RemoveListener(OnHintAvailable); } + public void Populate(Scroll scroll, int Nr) + { + Scroll = scroll; + ID = Nr; + } + + private void SetLabel(string label) + { + LabelMesh.text = label ?? Scroll?.requiredFacts[ID].label ?? "Err"; + } + public void OnClickHintButton() { - ScrollFactHintEvent.Invoke(this.ScrollParameterObject, ScrollFactURI); + ScrollFactHintEvent.Invoke(ImageHintObject, URI); } public void OnHintAvailable(List<string> uris) { - GameObject hintButton = ScrollParameterObject.transform.GetChild(2).gameObject; - - hintButton.SetActive(uris.Contains(ScrollFactURI)); + HintButton.SetActive(true);// uris.Contains(ScrollFactURI)); } #region DropHandling @@ -84,43 +107,21 @@ public void OnDrop(PointerEventData eventData) { Fact = eventData.pointerDrag.GetComponent<FactObject>().Fact; - { + if (VerboseURI) Debug.Log(Fact.Label + " was dropped on " + gameObject.name + " " + (ID + 1) + "/" + ScrollDetails.ParameterDisplays.Count + " label: " + ScrollFactLabel); - } - - Destroy(RenderedFactObject?.gameObject); - RenderedFactObject = // has to be , Vector3.zero, Quaternion.identity => SetParent + RenderedFactObject = // has to be: ..., Vector3.zero, Quaternion.identity => SetParent Instantiate(eventData.pointerDrag, Vector3.zero, Quaternion.identity) .GetComponent<FactObject>(); - RenderedFactObject.transform.SetParent(gameObject.transform, worldPositionStays: false); - RenderedFactObject.Fact = Fact; - //Set imageToChangeDefaultColor of current: Fix so that current won't take the color - //the dragged item was having during animation - RenderedFactObject.GetComponent<ImageHintAnimation>().imageToChangeDefaultColor = - eventData.pointerDrag.GetComponent<ImageHintAnimation>().imageToChangeDefaultColor; RenderedFactObject.GetComponent<ImageHintAnimation>().ResetAnimation(); - - var rect = RenderedFactObject.GetComponent<RectTransform>(); - rect.anchorMin = new Vector2(0.5f, 0.5f); - rect.anchorMax = new Vector2(0.5f, 0.5f); - - Debug.Log("recieved Fact: " + Fact.Id); - - CommunicationEvents.NewAssignmentEvent.Invoke(); } public void OnPointerClick(PointerEventData eventData) - { - Destroy(RenderedFactObject); - Fact = null; - - CommunicationEvents.NewAssignmentEvent.Invoke(); - } + => _DeleteFactEvent(null); #endregion DropHandling } diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs index e5ba956cebac1fa2039b5d2906c021859396e0ee..ca2d328e1618ab42a7cf65fadedc947f997cf122 100644 --- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs +++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs @@ -77,11 +77,30 @@ public void SetScroll(Scroll scroll_to_set) originalRSF.Populate(ActiveScroll, i); } + foreach (int i in PrePopulateActiveScroll()) + ParameterDisplays[i].gameObject.SetActive(false); + //set active scroll for ErrorMessagePopup Popup.setScroll(ActiveScroll); Popup.setParameterDisplays(ParameterDisplays.Select(RSF => RSF.gameObject).ToList()); } + /// <summary> + /// Secretly populates <see cref="Scroll"/>s + /// </summary> + /// <returns><c>Array</c> containing indicis of <see cref="Scroll.requiredFacts"/> to be hidden.</returns> + private int[] PrePopulateActiveScroll() + { + switch (ActiveScroll.@ref) + { + case MMT_OMS_URI.ScrollAngleSum: + return new int[0]; + + default: + return new int[0]; + } + } + public void MagicButtonTrigger() { StartCoroutine(_MagicButton()); @@ -134,7 +153,7 @@ IEnumerator _NewAssignment() private IEnumerator SendView(string endpoint) { - while(ParameterDisplays == null) // Wait for server + while (ParameterDisplays == null) // Wait for server yield return null; string body = prepareScrollAssignments(); @@ -186,9 +205,9 @@ private void ReadPushout(List<MMTDeclaration> pushoutFacts) Fact newFact = ParsingDictionary.parseFactDictionary[pushoutFacts[i].getType()].Invoke(pushoutFacts[i]); if (newFact != null) { - PushoutFactEvent.Invoke - (FactManager.AddFactIfNotFound(newFact, out _, samestep, null, ActiveScroll.label) - , FactObject.FactMaterials.Solution); + AnimateExistingFactEvent.Invoke + (FactManager.AddFactIfNotFound(newFact, out _, samestep, null, ActiveScroll.label).Id + , FactWrapper.FactMaterials.Solution); samestep = true; } @@ -228,24 +247,22 @@ void _processRenderedScroll(Scroll rendered, List<string> hintUris) for (int i = 0; i < rendered.requiredFacts.Count; i++) { RenderedScrollFact RenderedScrollFact = ParameterDisplays - .Find(RSF => RSF.ScrollFactURI.Equals(rendered.requiredFacts[i].@ref.uri)); + .Find(RSF => RSF.ScrollFactURI == rendered.requiredFacts[i].@ref.uri); if (DynamicScrollDescriptionsActive) //Update ScrollParameter label RenderedScrollFact.Scroll = rendered; - //Check Hint Informations //If ScrollFact is assigned -> No Hint if (RenderedScrollFact.Fact == null) { - Fact HintFact = ParsingDictionary.parseFactDictionary[rendered.requiredFacts[i].getType()].Invoke(rendered.requiredFacts[i]); - // If currentFact could be parsed: this fact maybe not yet exists in the global fact-list but there must be a fact - // of the same type and the same dependent facts in the fact-list, otherwise currentFact could not have been parsed + Fact HintFact = + ParsingDictionary.parseFactDictionary[rendered.requiredFacts[i].getType()] + .Invoke(rendered.requiredFacts[i]); //If the fact could not be parsed -> Therefore not all dependent Facts exist -> No Hint - //AND if fact has no dependent facts -> No Hint - if (HintFact != null && HintFact.HasDependentFacts) - { // Hint available for abstract-problem uri + if (HintFact != null) + { hintUris.Add(HintFact.Id); LatestRenderedHints.Add(HintFact); } @@ -256,44 +273,46 @@ void _processRenderedScroll(Scroll rendered, List<string> hintUris) } } - public void animateHint(GameObject scrollParameter, string scrollParameterUri) + public void animateHint(ImageHintAnimation scrollHintImage, string scrollParameterUri) { - Scroll.ScrollAssignment suitableCompletion = LatestCompletions.Find(x => x.fact.uri.Equals(scrollParameterUri)); - Fact fact; + if (FactOrganizer.AllFacts.ContainsKey(scrollParameterUri)) + AnimateExistingFactEvent.Invoke( + scrollParameterUri, + FactWrapper.FactMaterials.Hint + ); + + Scroll.ScrollAssignment suitableCompletion = + LatestCompletions.Find(x => x.fact.uri == scrollParameterUri); + Fact fact; if (suitableCompletion != null) { if (FactOrganizer.AllFacts.ContainsKey(suitableCompletion.assignment.uri)) { - fact = FactOrganizer.AllFacts[suitableCompletion.assignment.uri]; - //Animate ScrollParameter - scrollParameter.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); - //Animate Fact in FactPanel - AnimateExistingFactEvent.Invoke(fact, FactObject.FactMaterials.Hint); + AnimateExistingFactEvent.Invoke( + suitableCompletion.assignment.uri, + FactWrapper.FactMaterials.Hint + ); } } - else if (LatestRenderedHints.Exists(x => x.Id.Equals(scrollParameterUri))) + else if (null != + (fact = LatestRenderedHints.Find(x => x.Id == scrollParameterUri))) { - fact = LatestRenderedHints.Find(x => x.Id.Equals(scrollParameterUri)); - var factId = fact.Id; + if (FactOrganizer.AllFacts.ContainsKey(fact.Id)) + // existing fact -> Animate that + AnimateExistingFactEvent.Invoke( + fact.Id, + FactWrapper.FactMaterials.Hint + ); - //If there is an equal existing fact -> Animate that fact AND ScrollParameter - if (FactOrganizer.AllFacts.ContainsKey(factId)) - { - Fact existingFact = FactOrganizer.AllFacts[factId]; - - //Animate ScrollParameter - scrollParameter.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); - //Animate Fact in FactPanel - AnimateExistingFactEvent.Invoke(existingFact, FactObject.FactMaterials.Hint); - } - //If not -> Generate a Fact-Representation with such dependent facts else { - //Animate ScrollParameter - scrollParameter.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); - //Generate new FactRepresentation and animate it + // Generate new FactRepresentation and animate it AnimateNonExistingFactEvent.Invoke(fact); + AnimateExistingFactEvent.Invoke( + scrollParameterUri, + FactWrapper.FactMaterials.Hint + ); } } } diff --git a/Assets/Scripts/Loading/Stage.cs b/Assets/Scripts/Loading/Stage.cs index b8629b4a51068154c370993be1b64881619447a1..5ed72ba7e0f96e449601e471a835221cffcc7704 100644 --- a/Assets/Scripts/Loading/Stage.cs +++ b/Assets/Scripts/Loading/Stage.cs @@ -358,17 +358,27 @@ public void store(bool reset_player = false, bool force_stage_file = false) /// <returns><see langword="true"/> iff succeeded</returns> public static bool ShallowLoad(out Stage set, string path) { + DateTime t_0 = System.DateTime.Now; + if (!IJSONsavable<Stage>.Instance._IJGetRawObject(out set, path)) { Debug.LogErrorFormat("Unable to load Stage: \"???\"\n\tFile might be corrupted or outdated: {0}", path); return false; } - + + DateTime t_R = DateTime.Now; + set = IJSONsavable<Stage>.postprocess(set); set.path = path; - + + DateTime t_PP = DateTime.Now; + // ignore output: IJSONsavable<Stage>.load_children(null /*hierarchie*/, set.name, ref set, post_process: false); + + Debug.Log("Raw: " + path + "\n\t " + (t_R - t_0).TotalMilliseconds + "ms\n" + + "PostProcess:\n\t " + (t_PP - t_R).TotalMilliseconds + "ms\n" + + "ChildLoad:\n\t " + (DateTime.Now - t_PP).TotalMilliseconds + "ms"); return true; } diff --git a/Assets/Scripts/SOMDocManager.cs b/Assets/Scripts/SOMDocManager.cs index 5c2828b5e35f9480ee6f06c79358616d73403c7f..271b8026a6453c1963e24f9251bc4c5ac456be61 100644 --- a/Assets/Scripts/SOMDocManager.cs +++ b/Assets/Scripts/SOMDocManager.cs @@ -63,6 +63,20 @@ public static class MMT_OMS_URI public static readonly string SquareRoot = "SquareRoot"; //public static readonly string MakeUnityEngineVector3 = "UnityEngine.Vector3"; public static readonly string MakeObjectArray = "MakeObjectArray"; + + + public const string ScrollOppositeLen = "http://mathhub.info/FrameIT/frameworld?OppositeLen"; + public const string ScrollSupplementaryAngles = "http://mathhub.info/FrameIT/frameworld?SupplementaryAngles"; + public const string ScrollAngleSum = "http://mathhub.info/FrameIT/frameworld?AngleSum"; + public const string ScrollPythagoras = "http://mathhub.info/FrameIT/frameworld?Pythagoras"; + public const string ScrollCylinderVolumeScroll = "http://mathhub.info/FrameIT/frameworld?CylinderVolumeScroll"; + public const string ScrollCircleLineAngleToAngleScroll = "http://mathhub.info/FrameIT/frameworld?CircleLineAngleToAngleScroll"; + public const string ScrollMidpoint = "http://mathhub.info/FrameIT/frameworld?Midpoint"; + public const string ScrollCircleScroll = "http://mathhub.info/FrameIT/frameworld?CircleScroll"; + public const string ScrollCircleLineAngleScroll = "http://mathhub.info/FrameIT/frameworld?CircleLineAngleScroll"; + public const string ScrollCircleAreaScroll = "http://mathhub.info/FrameIT/frameworld?CircleAreaScroll"; + public const string ScrollConeVolumeScroll = "http://mathhub.info/FrameIT/frameworld?ConeVolumeScroll"; + public const string ScrollTruncatedConeVolumeScroll = "http://mathhub.info/FrameIT/frameworld?TruncatedConeVolumeScroll"; } diff --git a/Assets/Scripts/UI/InGame/PopupBehavior.cs b/Assets/Scripts/UI/InGame/PopupBehavior.cs index ac145d2d4730752b237d297eb042ed833118c440..174df6f09a65ec8e68b5d26c6572b2e41bfe923e 100644 --- a/Assets/Scripts/UI/InGame/PopupBehavior.cs +++ b/Assets/Scripts/UI/InGame/PopupBehavior.cs @@ -102,7 +102,7 @@ private string generateHelpfulMessageAndAnimateScrollParam(Scroll.ScrollApplicat { RenderedScrollFact scrollfact = g.transform.GetChild(0).GetComponent<RenderedScrollFact>(); if (scrollfact.ScrollFactURI == fact.@ref.uri) - scrollfact.ScrollParameterObject.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); + scrollfact.ImageHintObject.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); } } else diff --git a/Assets/Scripts/Utility/Extensions/RendererExtensions.cs b/Assets/Scripts/Utility/Extensions/RendererExtensions.cs index bf9786680753f49c44e137760dfeda715a41cefa..18a7a86d537219bd7e92f23a01920ac6389e6334 100644 --- a/Assets/Scripts/Utility/Extensions/RendererExtensions.cs +++ b/Assets/Scripts/Utility/Extensions/RendererExtensions.cs @@ -4,11 +4,11 @@ public static class RendererExtensions { - public static IEnumerator ProgrammMaterialChange(this Renderer renderer, IEnumerable<(float delay, float lerp_time, Material new_material)> instructions, bool loop = false) + public static IEnumerator ProgrammMaterialChange(this Renderer renderer, IEnumerable<(float delay, float lerp_time, Material new_material)> instructions, int loop_times = 1) { Material last_material; - do + while (loop_times-- > 0) foreach (var (delay, lerp_time, new_material) in instructions) { yield return new WaitForSeconds(delay); @@ -21,6 +21,5 @@ public static IEnumerator ProgrammMaterialChange(this Renderer renderer, IEnumer yield return null; } } - while (loop); } }