Esempio n. 1
0
    static string GetSaveFileName(HoloID id)
    {
#if UNITY_WSA_10_0 && !UNITY_EDITOR
        //Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
        Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.RoamingFolder;
        string path = Path.Combine(localFolder.Path, id.ToString() + "Save.save");
        Debug.Log("Savename " + path);
        return(path);
#else
        return(Path.Combine(Application.persistentDataPath, id.ToString() + "Save.save"));
#endif
    }
Esempio n. 2
0
    void Start()
    {
        if (!HoloHelper.isHololens())
        {
            return;
        }

        //WorldAnchorStore.GetAsync(AnchorStoreReady);

        // Add an AudioSource component and set up some defaults
        audioSource             = gameObject.AddComponent <AudioSource>();
        audioSource.playOnAwake = false;
        //audioSource.spatialize = true;
        //audioSource.spatialBlend = 1.0f;
        //audioSource.dopplerLevel = 0.0f;
        //audioSource.rolloffMode = AudioRolloffMode.Custom;

        // Load the Sphere sounds from the Resources folder
        startClip = Resources.Load <AudioClip>("calibrationStart");
        stopClip  = Resources.Load <AudioClip>("calibrationStop");

        //CalibrationObject = transform.FindChild("ProjectorObj").gameObject;
        //CalibrationObject = transform.FindChild("ProjectorObj").gameObject.transform.FindChild("ProjectorMesh").gameObject;
        CalibrationObject  = this.gameObject;
        CalibrationMeshObj = transform.FindChild("ProjectorMesh").gameObject;


        SceneObject = GameObject.Find("SceneObj").gameObject;
#if UNITY_WSA_10_0 && !UNITY_EDITOR
        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) =>
        {
            this.OnSelect();
        };
        //recognizer.StartCapturingGestures();
#endif

        HoloTransform savedTransform = LoadProjectorTransform(ProjectorID);
        if (savedTransform != null)
        {
            Debug.Log("Save found for " + ProjectorID.ToString());
            CalibrationObject.transform.localPosition = savedTransform.position;
            CalibrationObject.transform.localRotation = savedTransform.rotation;
        }

        //if (PlayerPrefs.HasKey(ProjectorID.ToString() + "PosX") && PlayerPrefs.HasKey(ProjectorID.ToString() + "PosY") && PlayerPrefs.HasKey(ProjectorID.ToString() + "PosZ")) {
        //    Vector3 pos = new Vector3(PlayerPrefs.GetFloat(ProjectorID.ToString() + "PosX"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "PosY"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "PosZ"));
        //    Debug.Log("ProjPos " + pos);
        //    CalibrationObject.transform.localPosition = pos;
        //}
        //if (PlayerPrefs.HasKey(ProjectorID.ToString() + "RotX") && PlayerPrefs.HasKey(ProjectorID.ToString() + "RotY") && PlayerPrefs.HasKey(ProjectorID.ToString() + "RotZ") && PlayerPrefs.HasKey(ProjectorID.ToString() + "RotW"))
        //{
        //    Quaternion rot = new Quaternion(PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotX"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotY"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotZ"), PlayerPrefs.GetFloat(ProjectorID.ToString() + "RotW"));
        //    Debug.Log("ProjRot " + rot);
        //    CalibrationObject.transform.localRotation = rot;
        //}

        if (showCalibration)
        {
            OnShowCalibration();
        }

        RemoteCmdHandler.Instance.RegisterForCmd(RemoteCmdType.MoveRef, ProjectorID.ToString(), MoveProjector);
    }