/// <summary>
        /// Initializes a new instance of the class <see cref="MixedRealityExtensionApp"/>
        /// </summary>
        /// <param name="globalAppId">A string uniquely identifying the MRE behind the server URL. Used for generating
        /// consistent user IDs when user tracking is enabled.</param>
        /// <param name="ephemeralAppId">A string uniquely identifying the MRE instance in the shared space across
        /// all clients. Used for generating user IDs when user tracking is disabled.</param>
        /// <param name="ownerScript">The owner mono behaviour script for the app.</param>
        internal MixedRealityExtensionApp(string globalAppId, string ephemeralAppId, Node ownerScript, IMRELogger logger = null)
        {
            GlobalAppId    = globalAppId;
            EphemeralAppId = ephemeralAppId;
            _ownerScript   = ownerScript;
            EventManager   = new MWEventManager(this);
            _assetLoader   = new AssetLoader(ownerScript, this);
            _userManager   = new UserManager(this);
            _actorManager  = new ActorManager(this);

            if (Constants.UsePhysicsBridge)
            {
                PhysicsBridge = new PhysicsBridge();
            }

            SoundManager     = new SoundManager(this);
            AnimationManager = new AnimationManager(this);
            _commandManager  = new CommandManager(new Dictionary <Type, ICommandHandlerContext>()
            {
                { typeof(MixedRealityExtensionApp), this },
                { typeof(Actor), null },
                { typeof(AssetLoader), _assetLoader },
                { typeof(ActorManager), _actorManager },
                { typeof(AnimationManager), AnimationManager }
            });

            var cacheRoot = new Node()
            {
                Name = "MRE Cache"
            };

            _ownerScript.AddChild(cacheRoot);
            cacheRoot.SetProcess(false);
            _assetManager = new AssetManager(this, cacheRoot);

            RPC         = new RPCInterface(this);
            RPCChannels = new RPCChannelInterface();
            // RPC messages without a ChannelName will route to the "global" RPC handlers.
            RPCChannels.SetChannelHandler(null, RPC);
#if ANDROID_DEBUG
            Logger = logger ?? new UnityLogger(this);
#else
            Logger = logger ?? new ConsoleLogger(this);
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the class <see cref="MixedRealityExtensionApp"/>
        /// </summary>
        /// <param name="globalAppId">The global id of the app.</param>
        /// <param name="ownerScript">The owner mono behaviour script for the app.</param>
        internal MixedRealityExtensionApp(string globalAppId, MonoBehaviour ownerScript, IMRELogger logger = null)
        {
            GlobalAppId   = globalAppId;
            _ownerScript  = ownerScript;
            EventManager  = new MWEventManager(this);
            _assetLoader  = new AssetLoader(ownerScript, this);
            _userManager  = new UserManager(this);
            _actorManager = new ActorManager(this);

            UsePhysicsBridge = Constants.UsePhysicsBridge;

            if (UsePhysicsBridge)
            {
                _physicsBridge = new PhysicsBridge();
            }

            SoundManager     = new SoundManager(this);
            AnimationManager = new AnimationManager(this);
            _commandManager  = new CommandManager(new Dictionary <Type, ICommandHandlerContext>()
            {
                { typeof(MixedRealityExtensionApp), this },
                { typeof(Actor), null },
                { typeof(AssetLoader), _assetLoader },
                { typeof(ActorManager), _actorManager },
                { typeof(AnimationManager), AnimationManager }
            });

            var cacheRoot = new GameObject("MRE Cache");

            cacheRoot.transform.SetParent(_ownerScript.gameObject.transform);
            cacheRoot.SetActive(false);
            _assetManager = new AssetManager(this, cacheRoot);

            RPC         = new RPCInterface(this);
            RPCChannels = new RPCChannelInterface();
            // RPC messages without a ChannelName will route to the "global" RPC handlers.
            RPCChannels.SetChannelHandler(null, RPC);
#if ANDROID_DEBUG
            Logger = logger ?? new UnityLogger(this);
#else
            Logger = logger ?? new ConsoleLogger(this);
#endif
        }