diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab index 276dca4..5ec5978 100644 --- a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab +++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab @@ -270,6 +270,141 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &515667114 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 515667115} + - component: {fileID: 515667117} + - component: {fileID: 515667116} + m_Layer: 0 + m_Name: WindSpeed + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &515667115 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 515667114} + m_LocalRotation: {x: -0, y: -3.234449e-10, z: -0.0000000018343476, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.000021321988} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1160440965881748806} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &515667117 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 515667114} + m_CullTransparentMesh: 1 +--- !u!114 &515667116 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 515667114} + 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: '[Wind Speed ]' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: fc41d5815b9a5bb48be4c84a746c4ff6, type: 2} + m_sharedMaterial: {fileID: 7032093815205813286, guid: fc41d5815b9a5bb48be4c84a746c4ff6, 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: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 6 + m_fontSizeMax: 48 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + 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: 0 + 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!1 &857526030 GameObject: m_ObjectHideFlags: 0 @@ -405,6 +540,141 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1172936520 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1172936521} + - component: {fileID: 1172936523} + - component: {fileID: 1172936522} + m_Layer: 0 + m_Name: WindSpeed + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1172936521 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1172936520} + m_LocalRotation: {x: -0, y: -3.234449e-10, z: -0.0000000018343476, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.000021321988} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1160440967034714766} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1172936523 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1172936520} + m_CullTransparentMesh: 1 +--- !u!114 &1172936522 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1172936520} + 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: 'Wind Speed:' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: a6446991ef31ced4190c53c206cf4b3e, type: 2} + m_sharedMaterial: {fileID: -9221056233183343877, guid: a6446991ef31ced4190c53c206cf4b3e, 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: 22 + m_fontSizeBase: 22 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 6 + m_fontSizeMax: 48 + m_fontStyle: 1 + m_HorizontalAlignment: 1 + 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: 0 + 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!1 &1671468704 GameObject: m_ObjectHideFlags: 0 @@ -707,6 +977,7 @@ MonoBehaviour: windDirValue: {fileID: 1160440966591220994} temperatureValue: {fileID: 1160440967716077678} loc: {fileID: 1160440966516636515} + windSpeedValue: {fileID: 515667116} --- !u!1001 &1988956797 PrefabInstance: m_ObjectHideFlags: 0 @@ -1120,19 +1391,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 287564679024842756, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: m_fontColor.b - value: 0.121635705 + value: 0.94867706 objectReference: {fileID: 0} - target: {fileID: 287564679024842756, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: m_fontColor.g - value: 0.9811321 + value: 0.9528302 objectReference: {fileID: 0} - target: {fileID: 287564679024842756, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: m_fontColor.r - value: 0.05245039 + value: 0.9483357 objectReference: {fileID: 0} - target: {fileID: 287564679024842756, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: m_fontColor32.rgba - value: 4280285709 + value: 4294112242 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} @@ -1237,6 +1508,26 @@ PrefabInstance: propertyPath: _disabledColor.g value: 1 objectReference: {fileID: 0} + - target: {fileID: 4293156749170067433, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + propertyPath: _whenSelect.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4293156749170067433, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + propertyPath: _whenUnselect.m_PersistentCalls.m_Calls.Array.size + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4293156749170067433, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + propertyPath: _whenSelect.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1160440965950818012} + - target: {fileID: 4293156749170067433, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + propertyPath: _whenSelect.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: RPC_EmergencyButtonClick + objectReference: {fileID: 0} + - target: {fileID: 4293156749170067433, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + propertyPath: _whenSelect.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: API, Assembly-CSharp + objectReference: {fileID: 0} - target: {fileID: 4293156750076656786, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: m_LocalPosition.x value: 0.174 @@ -1345,6 +1636,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 6036491611310996877, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + propertyPath: m_text + value: 'Location Temperature:' + objectReference: {fileID: 0} - target: {fileID: 6036491611310996877, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: m_fontAsset value: @@ -1567,6 +1862,11 @@ PrefabInstance: objectReference: {fileID: 4621530251273852237} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} +--- !u!224 &1160440965881748806 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6036491612240916196, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + m_PrefabInstance: {fileID: 4890728645620921250} + m_PrefabAsset: {fileID: 0} --- !u!1 &1160440965950817989 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6036491612173940071, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} @@ -1626,6 +1926,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!224 &1160440967034714766 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6036491611111016748, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} + m_PrefabInstance: {fileID: 4890728645620921250} + m_PrefabAsset: {fileID: 0} --- !u!224 &1160440967424361300 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 6036491610696200438, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} diff --git a/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity b/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity index f324bf6..4ef218d 100644 --- a/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity +++ b/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} + m_IndirectSpecularColor: {r: 0.18028326, g: 0.22571333, b: 0.30692202, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index 824c172..7e8d681 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -1,4 +1,5 @@ using OVRSimpleJSON; +using Photon.Pun; using System; using System.Collections; using System.Collections.Generic; @@ -41,18 +42,23 @@ public class API : MonoBehaviour public TextMeshProUGUI windDirValue; public TextMeshProUGUI temperatureValue; public TextMeshProUGUI loc; + public TextMeshProUGUI windSpeedValue; private float LatestT; private float latestWD; + private float latestWS; + private String windDirectionInDirectionTerms; private string unit; private GameObject webSocketController; private WebSocketController webSocketControllerScript; private bool isButtonPressed = false; // Boolean to keep voltage updated as long as the turbine is rotating - + PhotonView photonView; void Start() { - + //TestFromJsonToData(); - EmergencyButtonClick(); + //EmergencyButtonClick(); + photonView = PhotonView.Get(this); + photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All); } private void Update() @@ -69,7 +75,9 @@ public class API : MonoBehaviour webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); StartCoroutine(GetText()); } - public void EmergencyButtonClick() + + [PunRPC] + public void RPC_EmergencyButtonClick() { isButtonPressed = false; loc.SetText("----"); @@ -107,7 +115,7 @@ public class API : MonoBehaviour public void ExtractDataFromJson(string json) { isButtonPressed = true; // Boolean to keep voltage updated as long as the turbine is rotating - + ApiResponse response = JsonUtility.FromJson<ApiResponse>(json); //Debug.Log("Api response worked!!!!"); @@ -122,19 +130,45 @@ public void ExtractDataFromJson(string json) { DataPoint point = dataPoints[i]; - loc.SetText("Kista"); + if (point.name == "wd") { latestWD = point.values[0]; - windDirValue.SetText(latestWD.ToString()); + windDirectionInDirectionTerms = GetWindDirection(latestWD); + //windDirValue.SetText(latestWD.ToString()); webSocketControllerScript.ws.Send(latestWD.ToString()+":take input"); } if (point.name == "t") { LatestT = point.values[0]; unit = point.unit; - temperatureValue.SetText(LatestT.ToString()+ " "+ unit); + //temperatureValue.SetText(LatestT.ToString()+ " "+ unit); + } + if (point.name == "ws") + { + latestWS = point.values[0]; } } + + photonView.RPC("RPC_GreenButtonClick", RpcTarget.All,windDirectionInDirectionTerms,LatestT+" C","Kista",latestWS+" m/s"); + } + + [PunRPC] + public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed) + { + + windDirValue.SetText(windDirection); + temperatureValue.SetText(locationTemperature); + loc.SetText(location); + windSpeedValue.SetText(windSpeed); + } + public string GetWindDirection(float degrees) + { + // Ensure degrees are within the range 0 to 359 + degrees = (degrees % 360 + 360) % 360; + + string[] directions = { "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW" }; + int index = (int)Math.Floor((degrees + 11.25) / 22.5); + return directions[index]; } } diff --git a/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset b/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset index c271450..6b54b69 100644 --- a/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset +++ b/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset @@ -49,6 +49,8 @@ MonoBehaviour: - SendSessionStart - CheckForLocalAnchors - OnColocatedAck + - RPC_EmergencyButtonClick + - RPC_GreenButtonClick DisableAutoOpenWizard: 1 ShowSettings: 1 DevRegionSetOnce: 1 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 399a1fd..6eb6409 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -507,9 +507,6 @@ PlayerSettings: - {fileID: 0} - {fileID: 0} - {fileID: 0} - - {fileID: 11400000, guid: fa3fffa2e684f7f4a8ba6975e0c7d092, type: 2} - - {fileID: 7480733010254389227, guid: e618e6ad86b9a954096d9f36d6b5bba4, type: 2} - - {fileID: 11400000, guid: ca8e257eaef0c3042a86010b1fb019f0, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1