Exemplo n.º 1
0
            public void ShowDropDown(TobiiXR_Settings settings, ref string eyeTrackingProviderTypeString)
            {
                var changed = ShowDropDown(ref eyeTrackingProviderTypeString);

                if (changed)
                {
                    Undo.RecordObject(settings, _targetGroup.ToString() + " Provider changed");
                    TobiiXR_SettingsEditorWindow.SetDirty(settings);
                    EditorUtils.UpdateCompilerFlags(settings);
                }
                var type = AssemblyUtils.EyetrackingProviderType(eyeTrackingProviderTypeString);

                if (type == typeof(GazeModifier.GazeModifierProvider))
                {
                    var wrappedProvider = GazeModifier.GazeModifierSettings.CreateDefaultSettings().EyetrackingProviderType;
                    if (wrappedProvider != _gazeModifierWrappedProvider)
                    {
                        _gazeModifierWrappedProvider = wrappedProvider;
                        EditorUtils.UpdateCompilerFlags(settings);
                    }
                }
                else
                {
                    _gazeModifierWrappedProvider = null;
                }
            }
        private static void SetCompilerflagForBuildTarget(string eyetrackerProviderType, IEditorSettings editorSettings, BuildTargetGroup target)
        {
            var flags     = editorSettings.GetScriptingDefineSymbolsForGroup(target).Split(';').ToList();
            var type      = AssemblyUtils.EyetrackingProviderType(eyetrackerProviderType);
            var attribute = Attribute.GetCustomAttribute(type, typeof(CompilerFlagAttribute)) as CompilerFlagAttribute;

            if (attribute != null)
            {
                if (flags.Contains(attribute.Flag))
                {
                    return;
                }
                flags.RemoveAll(flag => flag.StartsWith(COMPILERFLAGPREFIX));
                flags.Add(attribute.Flag);
                if (!attribute.Flag.StartsWith(COMPILERFLAGPREFIX))
                {
                    Debug.LogError(string.Format("Provider {0} uses CompilerFlag {1} which does not use TOBIIXR_ prefix, this will cause problems when switching providers!", type.Name, attribute.Flag));
                }
                editorSettings.SetScriptingDefineSymbolsForGroup(target, string.Join(";", flags.ToArray()));
            }
            else
            {
                if (flags.Any(f => f.StartsWith(COMPILERFLAGPREFIX)))
                {
                    flags.RemoveAll(flag => flag.StartsWith(COMPILERFLAGPREFIX));
                    editorSettings.SetScriptingDefineSymbolsForGroup(target, string.Join(";", flags.ToArray()));
                }
            }
        }
        public Type GetProviderType()
        {
            string eyeTrackingProviderType = _platform == RuntimePlatform.Android
                ? EyeTrackingProviderTypeAndroid
                : EyeTrackingProviderTypeStandAlone;

            if (string.IsNullOrEmpty(eyeTrackingProviderType))
            {
                return(null);
            }
            return(AssemblyUtils.EyetrackingProviderType(eyeTrackingProviderType));
        }
Exemplo n.º 4
0
        public IEyeTrackingProvider GetProvider()
        {
            var eyeTrackingProviders = _platform == RuntimePlatform.Android ? AndroidEyeTrackingProviders : StandaloneEyeTrackingProviders;

            // Get first viable provider from list
            var providerResult = eyeTrackingProviders
                                 .Select(element => AssemblyUtils.EyetrackingProviderType(element.TypeName))
                                 .Where(type => type != null)
                                 .Select(GetProviderFrom)
                                 .FirstOrDefault(provider => provider.Initialize());

            return(providerResult);
        }
Exemplo n.º 5
0
            private static IProviderSettings GetProviderSettingsFor(string providerTypeString)
            {
                var providerType = AssemblyUtils.EyetrackingProviderType(providerTypeString);

                if (providerType == null)
                {
                    return(null);
                }

                var editorType = EditorUtils.ProviderSettingsType(providerType);

                if (editorType == null)
                {
                    return(null);
                }
                return((IProviderSettings)Activator.CreateInstance(editorType));
            }