Ejemplo n.º 1
0
    public void OnGo()
    {
        int no = dropdown.value - 1;

        Debug.Log("SELECTED ADF No " + no.ToString());

        if (no < 0)
        {
            viewTangoInfo.UseADF     = false;
            poseCont.m_baseFrameMode = TangoPoseController.BaseFrameSelectionModeEnum.USE_START_OF_SERVICE;
            tangoApp.UseADFOn3dr     = false;


            tangoApp.Startup(null);
        }
        else
        {
            poseCont.m_baseFrameMode = TangoPoseController.BaseFrameSelectionModeEnum.USE_AREA_DESCRIPTION;
            viewTangoInfo.UseADF     = true;
            tangoApp.UseADFOn3dr     = true;
            tangoApp.Startup(list[no]);
        }

        this.gameObject.SetActive(false);
    }
    /// <summary>
    /// Loads the Area Description.
    /// </summary>
    public void LoadAreaDescription()
    {
        // Check that Area Description has been found or do nothing
        if (string.IsNullOrEmpty(m_areaDescriptionUUID))
        {
            AndroidHelper.ShowAndroidToastMessage("Please select a scan");
            return;
        }
        else
        {
            m_areaDescription = AreaDescription.ForUUID(m_areaDescriptionUUID);
            m_tangoApplication.m_areaDescriptionLearningMode = false;

            m_tangoApplication.Startup(m_areaDescription);
            m_poseController.gameObject.SetActive(true);
        }

        m_panelAreaDescriptionPicker.SetActive(false);

        if (m_seeOnly)
        {
            m_panelSeeMenuTop.SetActive(true);
        }
        else
        {
            m_panelPlaceMenuSide.SetActive(true);
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Start quality mode, creating a brand new Area Description.
    /// </summary>
    public void NewAreaDescription()
    {
        m_tangoApplication.Startup(null);

        // Disable the management UI, we are now in the world.
        m_managementRoot.SetActive(false);
        m_qualityRoot.SetActive(true);
    }
    /// <summary>
    /// This is called when the Area Description export operation completes.
    /// </summary>
    /// <param name="isSuccessful">If the export operation completed successfully.</param>
    public void OnAreaDescriptionExported(bool isSuccessful)
    {
        if (!isSuccessful)
        {
            AndroidHelper.ShowAndroidToastMessage("Area Description export failed," +
                                                  "other players will be unable to join game.");
            _QuitGame();
            return;
        }

        m_tangoApplication.Startup(Globals.m_curAreaDescription);
        _StartPlayer();
    }
Ejemplo n.º 5
0
    public void OnTangoPermissions(bool permissionsGranted)
    {
        if (permissionsGranted)
        {
            AreaDescription[]        list               = AreaDescription.GetList();
            AreaDescription          mostRecent         = null;
            AreaDescription.Metadata mostRecentMetadata = null;
            if (list.Length > 0)
            {
                // Find and load the most recent Area Description
                mostRecent         = list[0];
                mostRecentMetadata = mostRecent.GetMetadata();
                foreach (AreaDescription areaDescription in list)
                {
                    AreaDescription.Metadata metadata = areaDescription.GetMetadata();
                    if (metadata.m_dateTime > mostRecentMetadata.m_dateTime)
                    {
                        mostRecent         = areaDescription;
                        mostRecentMetadata = metadata;
                    }
                }

                m_tangoApplication.Startup(mostRecent);
            }
            else
            {
                // No Area Descriptions available.
                Debug.Log("No area descriptions available.");
            }
        }
    }
Ejemplo n.º 6
0
 public void OnTangoPermissions(bool permissionsGranted)
 {
     if (permissionsGranted)
     {
         AreaDescription[]        list = AreaDescription.GetList();
         AreaDescription.Metadata mostRecentMetadata = null;
         if (list.Length > 0)
         {
             // Find and load the most recent Area Description
             area = list[0];
             mostRecentMetadata = area.GetMetadata();
             foreach (AreaDescription areaDescription in list)
             {
                 AreaDescription.Metadata metadata = areaDescription.GetMetadata();
                 if (metadata.m_name.Contains("nathanbrandon00"))
                 {
                     area = areaDescription;
                     break;
                 }
             }
             loadedMessage = "AREA LOADED" + Environment.NewLine;
             m_tangoApplication.Startup(area);
             loadSuccess = true;
         }
     }
 }
Ejemplo n.º 7
0
    public void OnTangoPermissions(bool permissionsGranted)
    {
        if (permissionsGranted)
        {
            /*
             * AreaDescription[] list = AreaDescription.GetList();
             * AreaDescription mostRecent = null;
             * AreaDescription.Metadata mostRecentMetadata = null;
             * if (list.Length > 0)
             * {
             *  // Find and load the most recent Area Description
             *  mostRecent = list[0];
             *  mostRecentMetadata = mostRecent.GetMetadata();
             *  foreach (AreaDescription areaDescription in list)
             *  {
             *      AreaDescription.Metadata metadata = areaDescription.GetMetadata();
             *      if (metadata.m_dateTime > mostRecentMetadata.m_dateTime)
             *      {
             *          mostRecent = areaDescription;
             *          mostRecentMetadata = metadata;
             *      }
             *  }
             *
             *  m_tangoApplication.Startup(mostRecent);
             * }
             * else
             * {
             *  // No Area Descriptions available.
             *  Debug.Log("No area descriptions available.");
             * }
             */

            m_tangoApplication.Startup(null);
        }
    }
Ejemplo n.º 8
0
        // Connect the service, assuming all the required permissions have been granted.
        IEnumerator _ConnectService()
        {
            // Display Startup UI.
            startupNotification.OnIntended();

            // The thread will be busy running Shutdown() and Start().
            // Here ensures startup notification will be drawn/displayed beforehand.
            yield return(null);

            if (!tango.m_areaDescriptionLearningMode && selectedADF == null)
            {
                // With this state, service would start completely blind.
                // Also we can't restart service from this state (for some reason).
                // We don't want it -- so don't start service.
                Debug.LogAssertion("Can't start service with this setup.");
            }
            else
            {
                yield return(null);

                DisconnectService();

                // Just making sure.
                tango.m_enableMotionTracking   = true;
                tango.m_enableAreaDescriptions = true;

                tango.Startup(selectedADF);
            }

            // Hide Startup UI.
            // This may not be invoked when the above procedure fails.
            startupNotification.OnStarted();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// This is called when the permission granting process is finished.
 /// </summary>
 /// <param name="permissionsGranted"><c>true</c> if permissions were granted, otherwise <c>false</c>.</param>
 public void OnTangoPermissions(bool permissionsGranted)
 {
     if (permissionsGranted)
     {
         if (m_tangoApplication.m_enableADFLoading && m_areaDescription != null)
         {
             m_tangoApplication.Startup(m_areaDescription);
         }
         else
         {
             m_tangoApplication.Startup(null);
         }
     }
     else
     {
         AndroidHelper.ShowAndroidToastMessage("Motion Tracking Permissions Needed", true);
     }
 }
Ejemplo n.º 10
0
    public void OnTangoPermissions(bool permissionsGranted)
    {
        if (permissionsGranted)
        {
            if (!isNewMap)
            {
                list = AreaDescription.GetList();
                if (list.Length > 0)
                {
                    foreach (AreaDescription areaDescription in list)
                    {
                        AreaDescription.Metadata metadata = areaDescription.GetMetadata();

                        GameObject b = Instantiate(MapSelectorButton);
                        b.transform.SetParent(MapSelectorPanel.transform);
                        Button tempButton = b.GetComponent <Button>();
                        tempButton.GetComponentInChildren <Text>().text = metadata.m_name;
                        tempButton.onClick.AddListener(() => SelectMapButton(tempButton.GetComponentInChildren <Text>().text));
                    }
                }
                else
                {
                    // No Area Descriptions available.
                    m_tangoApplication.AreaDescriptionLearningMode = true;
                    isNewMap = true;
                    mapName  = "NewMap";
                    m_tangoApplication.Startup(null);
                    //GetComponent<PhotonManager>().ConnectPlayer();
                    //UIManager.gs = UIManager.guistate.InGameLearning;
                    GameManager.gs = GameManager.gamestate.InGameCreatingMap;
                }
            }
            else
            {
                m_tangoApplication.AreaDescriptionLearningMode = true;
                m_tangoApplication.Startup(null);
                //GetComponent<PhotonManager>().ConnectPlayer();
                //UIManager.gs = UIManager.guistate.InGameLearning;
                GameManager.gs = GameManager.gamestate.InGameCreatingMap;
            }
        }
    }
Ejemplo n.º 11
0
 /// <summary>
 /// This is called when the permission granting process is finished.
 /// </summary>
 /// <param name="permissionsGranted"><c>true</c> if permissions were granted, otherwise <c>false</c>.</param>
 public void OnTangoPermissions(bool permissionsGranted)
 {
     if (permissionsGranted)
     {
         m_tangoApplication.Startup(null);
     }
     else
     {
         AndroidHelper.ShowAndroidToastMessage("Motion Tracking Permissions Needed", true);
     }
 }
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start()
    {
        Statics.currentTangoState = TangoPoseStates.Connecting;

        tangoApplication = FindObjectOfType <TangoApplication>();
        if (tangoApplication == null)
        {
            tangoApplication = FindObjectOfType <TangoApplication>();
        }
        tangoApplication.Register(this);
        tangoApplication.Startup(AreaDescription.ForUUID(Statics.curADFId));

        startingRotation = transform.rotation;
    }
Ejemplo n.º 13
0
    /// <summary>
    /// This is called when the permission granting process is finished.
    /// </summary>
    /// <param name="permissionsGranted"><c>true</c> if permissions were granted, otherwise <c>false</c>.</param>
    public void OnTangoPermissions(bool permissionsGranted)
    {
        if (permissionsGranted)
        {
            m_tangoApplication.Startup(null);

            // Get camera extrinsics to form final matrix transforms
            _SetCameraExtrinsics();
        }
        else
        {
            AndroidHelper.ShowAndroidToastMessage("Motion Tracking Permissions Needed", true);
        }
    }
Ejemplo n.º 14
0
    public void OnTangoPermissions(bool permissionsGranted)
    {
        if (permissionsGranted)
        {
            m_tangoApplication.Startup(null);
        }
        else
        {
            AndroidHelper.ShowAndroidToastMessage("Motion Tracking and Area Learning Permissions Needed");

            // This is a fix for a lifecycle issue where calling
            // Application.Quit() here, and restarting the application
            // immediately results in a deadlocked app.
            AndroidHelper.AndroidQuit();
        }
    }
Ejemplo n.º 15
0
    /// <summary>
    /// Start the game.
    ///
    /// This will start the service connection, and start pose estimation from Tango Service.
    /// </summary>
    /// <param name="isNewAreaDescription">If set to <c>true</c> game with start to learn a new Area
    /// Description.</param>
    public void StartGame(bool isNewAreaDescription)
    {
        // The game has to be started with an Area Description.
        if (!isNewAreaDescription)
        {
            if (string.IsNullOrEmpty(m_curAreaDescriptionUUID))
            {
                AndroidHelper.ShowAndroidToastMessage("Please choose an Area Description.");
                return;
            }
        }
        else
        {
            m_curAreaDescriptionUUID = null;
        }

        // Dismiss Area Description list, footer and header UI panel.
        gameObject.SetActive(false);

        if (isNewAreaDescription)
        {
            // Completely new area description.
            m_guiController.m_curAreaDescription             = null;
            m_tangoApplication.m_areaDescriptionLearningMode = true;
        }
        else
        {
            // Load up an existing Area Description.
            AreaDescription areaDescription = AreaDescription.ForUUID(m_curAreaDescriptionUUID);
            m_guiController.m_curAreaDescription             = areaDescription;
            m_tangoApplication.m_areaDescriptionLearningMode = m_enableLearningToggle.isOn;
        }

        m_tangoApplication.Startup(m_guiController.m_curAreaDescription);

        // Enable GUI controller to allow user tap and interactive with the environment.
        m_poseController.gameObject.SetActive(true);
        m_guiController.enabled = true;
        if (m_guiController.navigateBool)
        {
            m_NavigateControlPanel.SetActive(true);
        }
        else
        {
            m_editControlPanel.SetActive(true);
        }
    }
Ejemplo n.º 16
0
    public bool StartGame()    //需要不停探测,直到打开一个区域,或者由界面打开
    {
        if (!m_needNewAreaDescription)
        {
            if (string.IsNullOrEmpty(m_curAreaDescriptionUUID))
            {
                AndroidHelper.ShowAndroidToastMessage("没有区域描述.");
                return(false);
            }
        }
        else
        {
            m_curAreaDescriptionUUID = null;
        }

        // Dismiss Area Description list, footer and header UI panel.
        //gameObject.SetActive(false);

        if (m_needNewAreaDescription)
        {
            // Completely new area description.
            //m_guiController.m_curAreaDescription = null;
            TangoManager.Instance.m_curAreaDescription       = null;
            m_tangoApplication.m_areaDescriptionLearningMode = true;
        }
        else
        {
            // Load up an existing Area Description.
            AreaDescription areaDescription = AreaDescription.ForUUID(m_curAreaDescriptionUUID);
            TangoManager.Instance.m_curAreaDescription       = areaDescription;
            m_tangoApplication.m_areaDescriptionLearningMode = m_enableLearningToggle;
        }

        m_tangoApplication.Startup(TangoManager.Instance.m_curAreaDescription);

        // Enable GUI controller to allow user tap and interactive with the environment.
        m_poseController.gameObject.SetActive(true);
        return(true);
        //m_guiController.enabled = true;
        //m_gameControlPanel.SetActive(true);
    }
Ejemplo n.º 17
0
 private void _StartGame()
 {
     m_tangoApplication.m_areaDescriptionLearningMode = true;
     m_tangoApplication.Startup(null);
 }
Ejemplo n.º 18
0
 public void OnTangoPermissions(bool permissionsGranted)
 {
     // No Area Descriptions available.
     m_tangoApplication.Startup(null);
 }
Ejemplo n.º 19
0
 // Makes sure to restart the service properly.
 // If the service hasn't started, just starts the service normally.
 public static void Restart(this TangoApplication self, AreaDescription adf)
 {
     self.Shutdown();
     self.Startup(adf);
 }