示例#1
0
        public virtual UniTask InitializeServiceAsync()
        {
            videoLoader     = Configuration.Loader.CreateLocalizableFor <VideoClip>(providerManager, localeManager);
            streamExtension = Engine.GetConfiguration <ResourceProviderConfiguration>().VideoStreamExtension;
            cancelInput     = inputManager.GetCancel();

            Player             = Engine.CreateObject <VideoPlayer>(nameof(MoviePlayer));
            Player.playOnAwake = false;
            Player.skipOnDrop  = Configuration.SkipFrames;
            #if UNITY_WEBGL && !UNITY_EDITOR
            Player.source = VideoSource.Url;
            #else
            Player.source = VideoSource.VideoClip;
            #endif
            Player.renderMode        = VideoRenderMode.APIOnly;
            Player.isLooping         = false;
            Player.audioOutputMode   = VideoAudioOutputMode.Direct;
            Player.loopPointReached += HandleLoopPointReached;

            if (Configuration.SkipOnInput && cancelInput != null)
            {
                cancelInput.OnStart += Stop;
            }

            return(UniTask.CompletedTask);
        }
示例#2
0
        public Task InitializeServiceAsync()
        {
            videoLoader = new LocalizableResourceLoader <VideoClip>(config.LoaderConfiguration, providerManager, localeManager);

            Player             = Engine.CreateObject <VideoPlayer>(nameof(MoviePlayer));
            Player.playOnAwake = false;
            Player.skipOnDrop  = config.SkipFrames;
            #if UNITY_WEBGL && !UNITY_EDITOR
            Player.source = VideoSource.Url;
            #else
            Player.source = VideoSource.VideoClip;
            #endif
            Player.aspectRatio       = config.AspectRatio;
            Player.renderMode        = VideoRenderMode.APIOnly;
            Player.isLooping         = false;
            Player.audioOutputMode   = VideoAudioOutputMode.Direct;
            Player.loopPointReached += HandleLoopPointReached;

            if (inputManager?.Cancel != null)
            {
                inputManager.Cancel.OnStart += Stop;
            }

            return(Task.CompletedTask);
        }
示例#3
0
        public virtual async UniTask InitializeServiceAsync()
        {
            foreach (var binding in Configuration.Bindings)
            {
                var sampler = new InputSampler(Configuration, binding, null);
                samplersMap[binding.Name] = sampler;
            }

            gameObject = Engine.CreateObject(nameof(InputManager));

            if (Configuration.SpawnEventSystem)
            {
                if (ObjectUtils.IsValid(Configuration.CustomEventSystem))
                {
                    Engine.Instantiate(Configuration.CustomEventSystem).transform.SetParent(gameObject.transform, false);
                }
                else
                {
                    gameObject.AddComponent <EventSystem>();
                }
            }

            if (Configuration.SpawnInputModule)
            {
                if (ObjectUtils.IsValid(Configuration.CustomInputModule))
                {
                    Engine.Instantiate(Configuration.CustomInputModule).transform.SetParent(gameObject.transform, false);
                }
                else
                {
                    #if ENABLE_INPUT_SYSTEM && INPUT_SYSTEM_AVAILABLE
                    var inputModule = gameObject.AddComponent <UnityEngine.InputSystem.UI.InputSystemUIInputModule>();
                    #else
                    var inputModule = gameObject.AddComponent <StandaloneInputModule>();
                    #endif
                    await AsyncUtils.WaitEndOfFrame;
                    inputModule.enabled = false; // Otherwise it stops processing UI events when using new input system.
                    inputModule.enabled = true;
                }
            }

            SampleInputAsync(sampleCTS.Token).Forget();
        }
示例#4
0
        public Task InitializeServiceAsync()
        {
            foreach (var binding in config.Bindings)
            {
                var sampler = new InputSampler(binding, null, config.TouchContinueCooldown);
                samplersMap[binding.Name] = sampler;
            }

            gameObject = Engine.CreateObject("InputManager");

            if (config.SpawnEventSystem)
            {
                if (ObjectUtils.IsValid(config.CustomEventSystem))
                {
                    Engine.Instantiate(config.CustomEventSystem).transform.SetParent(gameObject.transform, false);
                }
                else
                {
                    gameObject.AddComponent <EventSystem>();
                }
            }


            if (config.SpawnInputModule)
            {
                if (ObjectUtils.IsValid(config.CustomInputModule))
                {
                    Engine.Instantiate(config.CustomInputModule).transform.SetParent(gameObject.transform, false);
                }
                else
                {
                    gameObject.AddComponent <StandaloneInputModule>();
                }
            }

            engineBehaviour.OnBehaviourUpdate += SampleInput;

            return(Task.CompletedTask);
        }