private Api(string apiKey, CoordinateSystem coordinateSystem, Transform parentTransformForStreamedObjects, ConfigParams configParams) { CollisionStates = configParams.Collisions; if (!APIKeyHelpers.AppearsValid(apiKey)) { throw new InvalidApiKeyException(string.Format(InvalidApiKeyExceptionMessage, apiKey)); } try { m_implementation = new ApiImplementation(apiKey, coordinateSystem, parentTransformForStreamedObjects, configParams); } catch (DllNotFoundException dllNotFound) { bool couldNotFindWRLDBinary = dllNotFound.Message.ToLower().Contains("streamalpha"); bool is32Bit = IntPtr.Size == 4; if (couldNotFindWRLDBinary && is32Bit) { var guiTextObject = new GameObject("OtherErrorMessage"); var errorMessage = guiTextObject.AddComponent <ErrorMessage>(); errorMessage.Title = "WRLD Error: Unsupported Build Architecture"; errorMessage.Text = "It looks like you're trying to run a 32 bit build of the game. Unfortunately that isn't currently supported.\n\n" + "Please go to 'File->Build Settings' in the Unity menu and select 'x86_64' as your Architecture to continue."; } else { throw; } } }
string GetApiKey() { if (APIKeyHelpers.AppearsValid(m_apiKey)) { APIKeyHelpers.CacheAPIKey(m_apiKey); } else { var cachedAPIKey = APIKeyHelpers.GetCachedAPIKey(); if (cachedAPIKey != null) { m_apiKey = cachedAPIKey; } } return(m_apiKey); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_apiKey, new GUIContent("API Key")); bool apiKeyChanged = EditorGUI.EndChangeCheck(); if (apiKeyChanged) { m_apiKey.stringValue = m_apiKey.stringValue.Trim(); } bool hasApiKey = APIKeyHelpers.AppearsValid(m_apiKey.stringValue); if (!hasApiKey) { if (!m_cachedKeyHasBeenRead) { var cachedAPIKey = PlayerPrefs.GetString(WrldApiKeyTag); hasApiKey = APIKeyHelpers.AppearsValid(cachedAPIKey); if (hasApiKey) { m_apiKey.stringValue = cachedAPIKey; } m_cachedKeyHasBeenRead = true; } } if (hasApiKey) { if (apiKeyChanged) { PlayerPrefs.SetString(WrldApiKeyTag, m_apiKey.stringValue); } if (QualitySettings.shadowDistance < Wrld.Constants.RecommendedShadowDistance) { EditorGUILayout.HelpBox("Your Shadow Distance setting is below the recommended value. Shadows may not display correctly.", MessageType.Warning); if (GUILayout.Button("Use recommended value")) { QualitySettings.shadowDistance = Wrld.Constants.RecommendedShadowDistance; } } EditorGUILayout.PropertyField(m_streamingCamera, new GUIContent("Camera")); EditorGUILayout.PropertyField(m_useBuiltInCameraControls, new GUIContent("Use Built-in Camera Controls")); EditorGUILayout.PropertyField(m_latitudeDegrees, new GUIContent("Start Latitude")); EditorGUILayout.PropertyField(m_longitudeDegrees, new GUIContent("Start Longitude")); if (m_useBuiltInCameraControls.boolValue) { EditorGUILayout.PropertyField(m_distanceToInterest, new GUIContent("Starting Distance To Interest Point")); EditorGUILayout.PropertyField(m_headingDegrees, new GUIContent("Start Heading")); } EditorGUILayout.PropertyField(m_coordSystem, new GUIContent("World Space")); EditorGUILayout.PropertyField(m_streamingLodBasedOnDistance, new GUIContent("LOD Based On Distance")); EditorGUILayout.PropertyField(m_terrainCollisions, new GUIContent("Terrain Collisions")); EditorGUILayout.PropertyField(m_roadCollisions, new GUIContent("Road Collisions")); EditorGUILayout.PropertyField(m_buildingCollisions, new GUIContent("Building Collisions")); EditorGUILayout.PropertyField(m_materialDirectory, new GUIContent("Material Directory")); EditorGUILayout.PropertyField(m_overrideLandmarkMaterial, new GUIContent("Landmark Override Material")); if (GUILayout.Button("Provide Feedback")) { Application.OpenURL("https://docs.google.com/a/eegeo.com/forms/d/e/1FAIpQLSe_QJz3sqn7Xs-yiMw94JTdQiZ4Nq-50FYMRD21th0ZHMPEmQ/viewform"); } } else { EditorGUILayout.HelpBox("You must have an API key!", MessageType.Error); if (GUILayout.Button("Get an API key from wrld3d.com")) { Application.OpenURL("https://wrld3d.com/register?utm_source=UnitySDK&utm_medium=UnityEditor"); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_apiKey, new GUIContent("API Key")); bool apiKeyChanged = EditorGUI.EndChangeCheck(); if (apiKeyChanged) { m_apiKey.stringValue = m_apiKey.stringValue.Trim(); } bool hasApiKey = APIKeyHelpers.AppearsValid(m_apiKey.stringValue); if (!hasApiKey) { if (!m_cachedKeyHasBeenRead) { var cachedAPIKey = APIKeyHelpers.GetCachedAPIKey(); hasApiKey = APIKeyHelpers.AppearsValid(cachedAPIKey); if (hasApiKey) { m_apiKey.stringValue = cachedAPIKey; } m_cachedKeyHasBeenRead = true; } } if (hasApiKey) { if (apiKeyChanged) { APIKeyHelpers.CacheAPIKey(m_apiKey.stringValue); } if (QualitySettings.shadowDistance < Wrld.Constants.RecommendedShadowDistance) { EditorGUILayout.HelpBox("Your Shadow Distance setting is below the recommended value. Shadows may not display correctly.", MessageType.Warning); if (GUILayout.Button("Use recommended value")) { QualitySettings.shadowDistance = Wrld.Constants.RecommendedShadowDistance; } } EditorGUILayout.PropertyField(m_streamingCamera, new GUIContent("Camera")); EditorGUILayout.PropertyField(m_useBuiltInCameraControls, new GUIContent("Use Built-in Camera Controls")); EditorGUILayout.PropertyField(m_latitudeDegrees, new GUIContent("Start Latitude")); EditorGUILayout.PropertyField(m_longitudeDegrees, new GUIContent("Start Longitude")); if (m_useBuiltInCameraControls.boolValue) { EditorGUILayout.PropertyField(m_distanceToInterest, new GUIContent("Starting Distance To Interest Point")); EditorGUILayout.PropertyField(m_headingDegrees, new GUIContent("Start Heading")); } EditorGUILayout.PropertyField(m_coordSystem, new GUIContent("World Space")); EditorGUILayout.PropertyField(m_streamingLodBasedOnDistance, new GUIContent("LOD Based On Distance")); EditorGUILayout.PropertyField(m_terrainCollisions, new GUIContent("Terrain Collisions")); EditorGUILayout.PropertyField(m_roadCollisions, new GUIContent("Road Collisions")); EditorGUILayout.PropertyField(m_buildingCollisions, new GUIContent("Building Collisions")); EditorGUILayout.PropertyField(m_materialDirectory, new GUIContent("Material Directory")); EditorGUILayout.PropertyField(m_indoorMapMaterialDirectory, new GUIContent("Indoor Map Material Directory")); EditorGUILayout.PropertyField(m_overrideLandmarkMaterial, new GUIContent("Landmark Override Material")); m_experimentalFeaturesDisplayed = EditorGUILayout.Foldout(m_experimentalFeaturesDisplayed, "Experimental Features"); if (m_experimentalFeaturesDisplayed) { EditorGUILayout.LabelField("Experimental features are subject to change."); EditorGUILayout.PropertyField(m_enableLabels, new GUIContent("Show Text Labels")); if (m_enableLabels.boolValue) { EditorGUILayout.PropertyField(m_enableIndoorEntryMarkerEvents, new GUIContent("Interactive Indoor Entry Markers")); EditorGUILayout.PropertyField(m_labelCanvas, new GUIContent("Label Canvas")); } EditorGUILayout.PropertyField(m_uploadMeshes, new GUIContent("Discard Meshes from memory")); } if (GUILayout.Button("Provide Feedback")) { Application.OpenURL("https://docs.google.com/a/eegeo.com/forms/d/e/1FAIpQLSe_QJz3sqn7Xs-yiMw94JTdQiZ4Nq-50FYMRD21th0ZHMPEmQ/viewform"); } } else { EditorGUILayout.HelpBox("You must have an API key!", MessageType.Error); if (GUILayout.Button("Get an API key from wrld3d.com")) { var url = UTMParamHelpers.BuildGetApiKeyUrl("get-api-key-button"); Application.OpenURL(url); } } serializedObject.ApplyModifiedProperties(); }