Пример #1
0
        private void Awake()
        {
            AzureSpatialAnchorsDemoConfiguration demoConfig = Resources.Load <AzureSpatialAnchorsDemoConfiguration>("AzureSpatialAnchorsDemoConfig");

            SpatialAnchorsAccountId  = demoConfig.SpatialAnchorsAccountId;
            SpatialAnchorsAccountKey = demoConfig.SpatialAnchorsAccountKey;
        }
        public void OnPreprocessBuild(BuildReport report)
        {
            AzureSpatialAnchorsDemoConfiguration demoConfig = Resources.Load <AzureSpatialAnchorsDemoConfiguration>("AzureSpatialAnchorsDemoConfig");

            if (string.IsNullOrWhiteSpace(demoConfig.SpatialAnchorsAccountId) || string.IsNullOrWhiteSpace(demoConfig.SpatialAnchorsAccountKey))
            {
                Debug.LogWarning(@"Missing security values in AzureSpatialAnchorsPlugin\Examples\Resources\AzureSpatialAnchorsDemoConfig");
            }
        }
        /// <summary>
        /// Start is called on the frame when a script is enabled just before any
        /// of the Update methods are called the first time.
        /// </summary>
        public override void Start()
        {
            base.Start();

            if (!SanityCheckAccessConfiguration())
            {
                XRUXPickerForSharedAnchorDemo.Instance.GetDemoButtons()[1].gameObject.SetActive(false);
                XRUXPickerForSharedAnchorDemo.Instance.GetDemoButtons()[0].gameObject.SetActive(false);
                XRUXPickerForSharedAnchorDemo.Instance.GetDemoInputField().gameObject.SetActive(false);
                return;
            }

            AzureSpatialAnchorsDemoConfiguration demoConfig = Resources.Load <AzureSpatialAnchorsDemoConfiguration>("AzureSpatialAnchorsDemoConfig");

            BaseSharingUrl = demoConfig.BaseSharingURL;

            if (string.IsNullOrEmpty(BaseSharingUrl))
            {
                feedbackBox.text = "Need to set the BaseSharingUrl on AzureSpatialAnchorsDemoConfig in Examples/Resources.";
                XRUXPickerForSharedAnchorDemo.Instance.GetDemoButtons()[1].gameObject.SetActive(false);
                XRUXPickerForSharedAnchorDemo.Instance.GetDemoButtons()[0].gameObject.SetActive(false);
                XRUXPickerForSharedAnchorDemo.Instance.GetDemoInputField().gameObject.SetActive(false);
                return;
            }
            else
            {
                Uri result;
                if (!Uri.TryCreate(BaseSharingUrl, UriKind.Absolute, out result))
                {
                    feedbackBox.text = "BaseSharingUrl, on AzureSpatialAnchorsDemoConfig in Examples/Resources, is not a valid url";
                    return;
                }
                else
                {
                    BaseSharingUrl = $"{result.Scheme}://{result.Host}/api/anchors";
                }
            }

#if !UNITY_EDITOR
            anchorExchanger.WatchKeys(BaseSharingUrl);
#endif

            feedbackBox.text = stateParams[currentAppState].StepMessage;

            Debug.Log("Azure Spatial Anchors Shared Demo script started");
            EnableCorrectUIControls();
        }