// unloads all listed scenes
    public void Unload(string[] SceneNames)
    {
        IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

        sceneSystem.UnloadContent(SceneNames);
        return;
    }
    public async void OpenConfigScene()
    {
        IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();
        await sceneSystem.LoadContent("ConfigScene", LoadSceneMode.Single);

        await sceneSystem.UnloadContent("MainScene");
    }
    void Start()
    {
        slice = textures.Length / 2;

        // view = 1;
        IMixedRealitySceneSystem check = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

        sizeLimits           = AnatomyObject.GetComponent <BoxCollider>().bounds.size;
        midPosition          = AnatomyObject.transform.position;
        currentScene         = check.IsContentLoaded("GameScene");
        originalScaleUpright = GameObject.Find("UprightViewProjectionPlane").transform.localScale;

        ax_foo();
        // get a specific slice and apply as texture
        Texture2D texture = (Texture2D)textures[slice];

        projectionplanematerial.mainTexture = texture;

        DownKeyPressed = false;
        UpKeyPressed   = false;

        if (sceneName != "EducationalScene")
        {
            return;
        }

        AudioSource[] audios = GetComponents <AudioSource>();
        lungsSource   = audios[0];
        heartSource   = audios[1];
        bowelSource   = audios[2];
        bladderSource = audios[3];

        heartSource.enabled   = false;
        bladderSource.enabled = false;
        lungsSource.enabled   = false;
        bowelSource.enabled   = false;

        // define organ limits
        // Lungs (20 - 340) Heart(170 - 290) Bowel(350 - 700) Bladder(695 - 775)
        lungsStart = textures.Length - textures.Length * (20 / dicomSlices);
        lungsEnd   = textures.Length - textures.Length * (340 / dicomSlices);
        lungsMin   = (float)(lungsStart + 0.3 * (lungsEnd - lungsStart));
        lungsMax   = (float)(lungsMin + 0.4 * (lungsEnd - lungsStart));

        heartStart = textures.Length - textures.Length * (170 / dicomSlices);
        heartEnd   = textures.Length - textures.Length * (290 / dicomSlices);
        heartMin   = (float)(heartStart + 0.3 * (heartEnd - heartStart));
        heartMax   = (float)(heartMin + 0.4 * (heartEnd - heartStart));

        bowelStart = textures.Length - textures.Length * (350 / dicomSlices);
        bowelEnd   = textures.Length - textures.Length * (700 / dicomSlices);
        bowelMin   = (float)(bowelStart + 0.3 * (bowelEnd - bowelStart));
        bowelMax   = (float)(bowelMin + 0.4 * (bowelEnd - bowelStart));

        bladderStart = textures.Length - textures.Length * (695 / dicomSlices);
        bladderEnd   = textures.Length - textures.Length * (775 / dicomSlices);
        bladderMin   = (float)(bladderStart + 0.3 * (bladderEnd - bladderStart));
        bladderMax   = (float)(bladderMin + 0.4 * (bladderEnd - bladderStart));
    }
    void Start()
    {
        sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

        sceneSystem.LoadContent(sceneSystem.ContentSceneNames[0], LoadSceneMode.Single);

        UserNo = "0";
        Invoke("Init", 1.0f);
    }
    private async void Load()
    {
        IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

        if (!sceneSystem.IsContentLoaded(StartSceneName))
        {
            await sceneSystem.LoadContent(StartSceneName, LoadSceneMode.Single);
        }
    }
        private async void ServiceContentLoad(IMixedRealitySceneSystem sceneSystem, string sceneName)
        {
            if (requireActivationToken)
            {
                activationToken.AllowSceneActivation = false;
            }

            await sceneSystem.LoadContent(sceneName, loadSceneMode, activationToken);
        }
    // loads desired scene
    public void Load(string SceneName)
    {
        IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

        sceneSystem.LoadContent(SceneName);
        //MonoBehaviour shaderscript = Camera.main.GetComponent("screenspacedshader") as MonoBehaviour;
        //shaderscript.enabled = true;
        //System.Threading.Thread.Sleep(5000);
        //shaderscript.enabled = false;
        return;
    }
    void Start()
    {
        //FeedbackScript = FeedbackPlane.GetComponent<present_at_correct_location>();

        int Score = timer.EndScore;

        outputText = string.Format("Your endscore is {0000} (: \n" +
                                   "Thanks for playing !!", Score);
        EndText.text = outputText;
        sceneSystem  = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();
        ScenePopulationManager.SetActive(false); // sets game scene population inactive
    }
 /// <summary>
 /// Resets all cached system references to null
 /// </summary>
 public static void ResetCacheReferences()
 {
     serviceCache.Clear();
     boundarySystem         = null;
     cameraSystem           = null;
     diagnosticsSystem      = null;
     focusProvider          = null;
     inputSystem            = null;
     raycastProvider        = null;
     sceneSystem            = null;
     spatialAwarenessSystem = null;
     teleportSystem         = null;
 }
Exemple #10
0
    void Start()
    {
        timelimit = 90.0f; // 60 seconds.
        minutes   = (int)(timelimit / 60f);
        seconds   = (int)(timelimit % 60f);
        fraction  = (int)((timelimit * 100f) % 100f);

        timertext.text  = string.Format("{0:00}:{1:00}:{2:00}", minutes, seconds, fraction);
        timertext.color = Color.white;

        FeedbackScript = FeedbackPlane.GetComponent <present_at_correct_location>();

        sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();
    }
    private async void AcceptInput(string ip, string azureId, string azureKey, string azureDomain)
    {
#if WINDOWS_UWP
        if (String.IsNullOrEmpty(azureId) || String.IsNullOrEmpty(azureKey) || String.IsNullOrEmpty(azureDomain))
        {
            //Load from document.
            string filename = "asa_account_config.json";
            string path     = Application.persistentDataPath;
            string filePath = Path.Combine(path, filename);

            if (!File.Exists(filePath))
            {
                Toolkit.singleton.TriggerEvent("message_box_service",
                                               new MessageBoxContent(120, "Config file not found!", $"The path {filePath} does not lead to an existing file.\nYour input was:\nAure Id: {azureId}\nAure Key: {azureKey}\nAzure Domain: {azureDomain}", AcceptLastSubmittedInput, "Try again"));
                return;
            }

            string json = File.ReadAllText(filePath);

            try
            {
                AzureConfig config = JsonConvert.DeserializeObject <AzureConfig>(json);
                azureId     = config.AccountId;
                azureKey    = config.AccountKey;
                azureDomain = config.AccountDomain;

                if (!String.IsNullOrEmpty(config.AzureAnchorId))
                {
                    PlayerPrefs.SetString("current_asa_anchor_id", config.AzureAnchorId);
                }
            }
            catch (Exception ex)
            {
                Toolkit.singleton.TriggerEvent("message_box_service",
                                               new MessageBoxContent(6, "Deserialiation failed!", $"An error occurred", AcceptLastSubmittedInput, "Try again"));
                return;
            }
        }
#endif

        PlayerPrefs.SetString("server_address", ip);
        PlayerPrefs.SetString("asa_account_id", azureId);
        PlayerPrefs.SetString("asa_account_key", azureKey);
        PlayerPrefs.SetString("asa_account_domain", azureDomain);

        PlayerPrefs.Save();

        IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();
        await sceneSystem.LoadContent("Demo2Scene", LoadSceneMode.Single);
    }
Exemple #12
0
    public List <SceneLoadInformation> LoaderInformation = new List <SceneLoadInformation>();//holds data for all ways to load scenes

    public void Start()
    {
        Debug.Log("Starting scene Loader set up in " + SceneManager.GetActiveScene().name);

        sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

        for (int i = 0; i < LoaderInformation.Count; i++)
        {
            SceneLoadInformation lI = LoaderInformation[i];

            if (lI.doAutomaticallly)
            {
                GoToScene(lI.sceneName);
                Destroy(gameObject);
            }
            else
            {
                EnumSwitchSetUp(LoaderInformation[i]);
            }
        }
    }
        private void RenderLightingScenes(IMixedRealitySceneSystem sceneSystem, IMixedRealitySceneSystemEditor sceneSystemEditor, List <SceneInfo> lightingScenes)
        {
            EditorGUILayout.HelpBox("Select the active lighting scene by clicking its name.", MessageType.Info);

            if (Application.isPlaying)
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.LabelField("Current Scene Operation", EditorStyles.boldLabel);
                EditorGUILayout.Toggle("Scene Operation In Progress", sceneSystem.LightingOperationInProgress);
                EditorGUILayout.FloatField("Progress", sceneSystem.LightingOperationProgress);
                transitionType = (LightingSceneTransitionType)EditorGUILayout.EnumPopup("Lighting transition type", transitionType);
                if (transitionType != LightingSceneTransitionType.None)
                {
                    transitionSpeed = EditorGUILayout.Slider("Lighting transition speed", transitionSpeed, 0f, 10f);
                }
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical();
            foreach (SceneInfo lightingScene in lightingScenes)
            {
                if (lightingScene.IsEmpty)
                {
                    GUI.color = errorColor;
                    GUILayout.Button("(Scene Missing)", EditorStyles.toolbarButton);
                    continue;
                }

                bool selected = lightingScene.Name == sceneSystem.ActiveLightingScene;

                GUI.color = selected ? enabledColor : disabledColor;
                if (GUILayout.Button(lightingScene.Name, EditorStyles.toolbarButton) && !selected)
                {
                    sceneSystem.SetLightingScene(lightingScene.Name, transitionType, transitionSpeed);
                }
            }
            EditorGUILayout.EndVertical();
        }
 private static void ResetCacheReferenceFromType(Type serviceType)
 {
     if (typeof(IMixedRealityBoundarySystem).IsAssignableFrom(serviceType))
     {
         boundarySystem = null;
     }
     else if (typeof(IMixedRealityCameraSystem).IsAssignableFrom(serviceType))
     {
         cameraSystem = null;
     }
     else if (typeof(IMixedRealityDiagnosticsSystem).IsAssignableFrom(serviceType))
     {
         diagnosticsSystem = null;
     }
     else if (typeof(IMixedRealityFocusProvider).IsAssignableFrom(serviceType))
     {
         focusProvider = null;
     }
     else if (typeof(IMixedRealityInputSystem).IsAssignableFrom(serviceType))
     {
         inputSystem = null;
     }
     else if (typeof(IMixedRealityRaycastProvider).IsAssignableFrom(serviceType))
     {
         raycastProvider = null;
     }
     else if (typeof(IMixedRealitySceneSystem).IsAssignableFrom(serviceType))
     {
         sceneSystem = null;
     }
     else if (typeof(IMixedRealitySpatialAwarenessSystem).IsAssignableFrom(serviceType))
     {
         sceneSystem = null;
     }
     else if (typeof(IMixedRealityTeleportSystem).IsAssignableFrom(serviceType))
     {
         teleportSystem = null;
     }
 }
 private async void ServiceContentUnload(IMixedRealitySceneSystem sceneSystem, string sceneName)
 {
     await sceneSystem.UnloadContent(sceneName);
 }
        public override void DrawInspectorGUI(object target)
        {
            // Get the scene system itself
            IMixedRealitySceneSystem sceneSystem = target as IMixedRealitySceneSystem;
            // Get the scene system's editor interface
            IMixedRealitySceneSystemEditor sceneSystemEditor = target as IMixedRealitySceneSystemEditor;

            if (sceneSystemEditor == null)
            {
                EditorGUILayout.HelpBox("This scene service implementation does not implement IMixedRealitySceneSystemEditor. Inspector will not be rendered.", MessageType.Info);
                return;
            }

            GUI.color = enabledColor;

            MixedRealitySceneSystemProfile profile = sceneSystem.ConfigurationProfile as MixedRealitySceneSystemProfile;

            if (profile.UseLightingScene)
            {
                EditorGUILayout.LabelField("Lighting Scene", EditorStyles.boldLabel);
                List <SceneInfo> lightingScenes = new List <SceneInfo>(sceneSystemEditor.LightingScenes);
                if (lightingScenes.Count == 0)
                {
                    EditorGUILayout.LabelField("(No lighting scenes found)", EditorStyles.miniLabel);
                }
                else
                {
                    RenderLightingScenes(sceneSystem, sceneSystemEditor, lightingScenes);
                }
                EditorGUILayout.Space();
            }

            GUI.color = enabledColor;

            EditorGUILayout.LabelField("Content Scenes", EditorStyles.boldLabel);
            List <SceneInfo> contentScenes = new List <SceneInfo>(sceneSystemEditor.ContentScenes);

            if (contentScenes.Count == 0)
            {
                EditorGUILayout.LabelField("(No content scenes found)", EditorStyles.miniLabel);
            }
            else
            {
                if (Application.isPlaying)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    EditorGUILayout.LabelField("Current Scene Operation", EditorStyles.boldLabel);
                    loadSceneMode = (LoadSceneMode)EditorGUILayout.EnumPopup("Load Mode", loadSceneMode);
                    EditorGUILayout.Toggle("Scene Operation In Progress", sceneSystem.SceneOperationInProgress);
                    EditorGUILayout.FloatField("Progress", sceneSystem.SceneOperationProgress);

                    requireActivationToken = EditorGUILayout.Toggle("Require Manual Scene Activation", requireActivationToken);

                    if (requireActivationToken && activationToken.ReadyToProceed)
                    {
                        if (GUILayout.Button("Allow Scene Activation"))
                        {
                            activationToken.AllowSceneActivation = true;
                        }
                    }
                    else
                    {
                        activationToken.AllowSceneActivation = true;
                    }

                    EditorGUILayout.EndVertical();
                }

                EditorGUI.BeginDisabledGroup(sceneSystem.SceneOperationInProgress);
                RenderContentScenes(sceneSystem, sceneSystemEditor, contentScenes);
                EditorGUI.EndDisabledGroup();
            }

            EditorGUILayout.Space();
        }
    // unloads all content scenes
    public void UnloadCurrentScenes()
    {
        IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

        Unload(sceneSystem.ContentSceneNames);
    }
 private async void ServiceContentUnloadByTag(IMixedRealitySceneSystem sceneSystem, string tag)
 {
     await sceneSystem.UnloadContentByTag(tag);
 }
 private async void ServiceContentLoadPrev(IMixedRealitySceneSystem sceneSystem)
 {
     await sceneSystem.LoadPrevContent(false, LoadSceneMode.Single, activationToken);
 }
        private void RenderContentScenes(IMixedRealitySceneSystem sceneSystem, IMixedRealitySceneSystemEditor sceneSystemEditor, List <SceneInfo> contentScenes)
        {
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Load / Unload by tag", EditorStyles.miniBoldLabel);
            List <string> contentTags = new List <string>(sceneSystemEditor.ContentTags);

            if (contentTags.Count == 0)
            {
                EditorGUILayout.LabelField("(No scenes with content tags found)", EditorStyles.miniLabel);
            }
            else
            {
                foreach (string tag in contentTags)
                {
                    using (new EditorGUILayout.VerticalScope(GUILayout.MaxWidth(tagLoadButtonSetWidth)))
                    {
                        EditorGUILayout.LabelField(tag, EditorStyles.miniLabel);
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            if (GUILayout.Button("Load", EditorStyles.miniButton, GUILayout.MaxWidth(maxLoadButtonWidth)))
                            {
                                if (Application.isPlaying)
                                {
                                    ServiceContentLoadByTag(sceneSystem, tag);
                                }
                                else
                                {
                                    foreach (SceneInfo contentScene in sceneSystemEditor.ContentScenes)
                                    {
                                        if (contentScene.Tag == tag)
                                        {
                                            EditorSceneManager.OpenScene(contentScene.Path, OpenSceneMode.Additive);
                                        }
                                    }
                                }
                            }

                            if (GUILayout.Button("Unload", EditorStyles.miniButton, GUILayout.MaxWidth(maxLoadButtonWidth)))
                            {
                                if (Application.isPlaying)
                                {
                                    ServiceContentUnloadByTag(sceneSystem, tag);
                                }
                                else
                                {
                                    foreach (SceneInfo contentScene in sceneSystemEditor.ContentScenes)
                                    {
                                        if (contentScene.Tag == tag)
                                        {
                                            Scene scene = EditorSceneManager.GetSceneByName(contentScene.Name);
                                            EditorSceneManager.CloseScene(scene, false);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Load / Unload by build index order", EditorStyles.miniBoldLabel);
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUI.BeginDisabledGroup(!sceneSystem.PrevContentExists);
                if (GUILayout.Button("Load Prev Content", EditorStyles.miniButton))
                {
                    if (Application.isPlaying)
                    {
                        ServiceContentLoadPrev(sceneSystem);
                    }
                    else
                    {
                        sceneSystemEditor.EditorLoadPrevContent();
                    }
                }
                EditorGUI.EndDisabledGroup();

                EditorGUI.BeginDisabledGroup(!sceneSystem.NextContentExists);
                if (GUILayout.Button("Load Next Content", EditorStyles.miniButton))
                {
                    if (Application.isPlaying)
                    {
                        ServiceContentLoadNext(sceneSystem);
                    }
                    else
                    {
                        sceneSystemEditor.EditorLoadNextContent();
                    }
                }
                EditorGUI.EndDisabledGroup();
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Load / Unload individually", EditorStyles.miniBoldLabel);
            foreach (SceneInfo contentScene in sceneSystemEditor.ContentScenes)
            {
                if (contentScene.IsEmpty)
                {
                    GUI.color = errorColor;
                    GUILayout.Button("(Scene Missing)", EditorStyles.toolbarButton);
                    continue;
                }

                Scene scene  = EditorSceneManager.GetSceneByName(contentScene.Name);
                bool  loaded = scene.isLoaded;

                GUI.color = loaded ? enabledColor : disabledColor;
                if (GUILayout.Button(contentScene.Name, EditorStyles.toolbarButton))
                {
                    if (Application.isPlaying)
                    {
                        if (loaded)
                        {
                            ServiceContentUnload(sceneSystem, contentScene.Name);
                        }
                        else
                        {
                            ServiceContentLoad(sceneSystem, contentScene.Name);
                        }
                    }
                    else
                    {
                        if (loaded)
                        {
                            EditorSceneManager.CloseScene(scene, false);
                        }
                        else
                        {
                            EditorSceneManager.OpenScene(contentScene.Path, OpenSceneMode.Additive);
                        }
                    }
                }
            }
        }
Exemple #21
0
        void Start()
        {
            IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService <IMixedRealitySceneSystem>();

            sceneSystem.OnWillUnloadContent += HandleSceneOperation;
        }