Exemplo n.º 1
0
        protected override void _TurnOn()
        {
            Utility.AppConfig config = Utility.AppConfig.Instance;
            config.LoadConfig(MEHoloConstant.NetworkConfigFile);
            serverHost = Utility.AppConfig.Instance.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Host", "127.0.0.1");

            ui.TurnOn();

            Debug.Log("App[" + MEHoloEntrance.Instance.AppID + "] Get Storage From " + serverHost);
            assetAPI     = new AssetApi("http://" + serverHost, 80);
            recordingAPI = new RecordingApi("http://" + serverHost, 80);

            downloadWorker = new BackgroundWorker();
            downloadWorker.StartWorker();
        }
Exemplo n.º 2
0
        protected override void _TurnOn()
        {
            Utility.AppConfig config = Utility.AppConfig.Instance;
            config.LoadConfig(MEHoloConstant.NetworkConfigFile);
            serverHost = Utility.AppConfig.Instance.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Host", "127.0.0.1:8848");
            int.TryParse(Utility.AppConfig.Instance.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Port", "8848"), out serverPort);

            ui.TurnOn();

            Debug.Log("App[" + MEHoloEntrance.Instance.AppID + "] Get Storage From " + serverHost);
            //下面的暂时只能使用https:// 无法去掉
            assetAPI     = new AssetApi(serverHost, serverPort);
            recordingAPI = new RecordingApi(serverHost, serverPort);
            directorAPI  = new DirectorApi(serverHost, serverPort);

            downloadWorker = new BackgroundWorker();
            downloadWorker.StartWorker();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 初始化,仅设置信息,并不投入使用
        /// </summary>
        protected override void _Init()
        {
            appId  = MEHoloEntrance.Instance.AppID;
            roomId = Network.RoomManager.Instance.GetCurrentRoom();

            Utility.AppConfig config = Utility.AppConfig.Instance;
            config.LoadConfig(MEHoloConstant.NetworkConfigFile);
            serverHost = Utility.AppConfig.Instance.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Host", "127.0.0.1");

            spatialMappingManager = SpatialMappingManager.Instance;
            meshObserver          = spatialMappingManager.gameObject.GetComponent <MeshSurfaceObserver>();

            inputManager = MultiInputManager.Instance;
            anchorShared = gameObject.AddComponent <AnchorShared>();

            anchorShared.Init();

            // 设置所有的anchor信息
            AnchorDefinition[] defines = GameObject.FindObjectsOfType <AnchorDefinition>();
            for (int i = 0; i < defines.Length; i++)
            {
                AnchorDefinition define = defines[i];
                GameObject       obj    = define.gameObject;
                int find = anchorRootList.IndexOf(obj);
                if (find >= 0)
                {
                    anchorNameList.RemoveAt(find);
                    anchorRootList.RemoveAt(find);
                }

                string aName = define.anchorName;
                if (string.IsNullOrEmpty(aName))
                {
                    aName             = obj.name;
                    define.anchorName = obj.name;
                }
                AddAnchorObject(aName, obj);
            }

            // 兼容老数据
            for (int i = 0; i < anchorNameList.Count; i++)
            {
                if (anchorRootList[i] != null)
                {
                    AddAnchorObject(anchorNameList[i], anchorRootList[i]);
                    Debug.Log("Fit old anchor [" + anchorNameList[i] + "]");
                }
            }

            FitCamera();


            /*
             * DataMesh.AR.Common.FollowMainCamera follow = markCameraObj.AddComponent<DataMesh.AR.Common.FollowMainCamera>();
             * follow.positionOffset = Vector3.zero;
             * follow.rotationOffset = Vector3.zero;
             */


            markCamera.gameObject.SetActive(false);

            Debug.Log("Anchor count=" + anchorObjectList.Count);
        }