コード例 #1
0
 public LogoDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new []
         {
             ChoiceRow <NamedAnchor> .Create(
                 "Anchor",
                 Enumeration.GetAll <NamedAnchor>().ToArray(),
                 () => SettingsManager.Instance.LogoAnchor,
                 anchor => SettingsManager.Instance.LogoAnchor = anchor,
                 this.DataSourceListener
                 )
         }),
         new Section(new[]
         {
             FloatWithUnitRow.Create(
                 "X",
                 () => SettingsManager.Instance.LogoOffset.X,
                 value => SettingsManager.Instance.LogoOffset = SettingsManager.Instance.LogoOffset.NewWithX(value),
                 this.DataSourceListener
                 ),
             FloatWithUnitRow.Create(
                 "Y",
                 () => SettingsManager.Instance.LogoOffset.Y,
                 value => SettingsManager.Instance.LogoOffset = SettingsManager.Instance.LogoOffset.NewWithY(value),
                 this.DataSourceListener
                 )
         }, "Offset")
     };
 }
コード例 #2
0
 public FeedbackDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new Row[]
         {
             SwitchRow.Create(
                 "Sound",
                 () => SettingsManager.Instance.Feedback.Sound != null,
                 value =>
             {
                 Sound sound  = value ? Sound.DefaultSound : null;
                 var feedback = new Feedback(SettingsManager.Instance.Feedback.Vibration, sound);
                 SettingsManager.Instance.Feedback = feedback;
             }
                 ),
             ChoiceRow <VibrationType> .Create(
                 "Vibration",
                 Enumeration.GetAll <VibrationType>().ToArray(),
                 () => VibrationType.Create(SettingsManager.Instance.Vibration),
                 type => {
                 SettingsManager.Instance.Vibration = type.Vibration;
                 var feedback = new Feedback(
                     SettingsManager.Instance.Vibration,
                     SettingsManager.Instance.Feedback.Sound);
                 SettingsManager.Instance.Feedback = feedback;
             },
                 this.DataSourceListener
                 )
         })
     };
 }
コード例 #3
0
 private Section CreateSpotlightSettings()
 {
     return(new Section(new Row[]
     {
         ChoiceRow <SpotlightViewfinderBackgroundColor> .Create(
             "Background Color",
             Enumeration.GetAll <SpotlightViewfinderBackgroundColor>().ToArray(),
             () => SettingsManager.Instance.SpotlightViewfinderBackgroundColor,
             color => SettingsManager.Instance.SpotlightViewfinderBackgroundColor = color,
             this.DataSourceListener
             ),
         ChoiceRow <SpotlightViewfinderEnabledColor> .Create(
             "Enabled Color",
             Enumeration.GetAll <SpotlightViewfinderEnabledColor>().ToArray(),
             () => SettingsManager.Instance.SpotlightViewfinderEnabledColor,
             color => SettingsManager.Instance.SpotlightViewfinderEnabledColor = color,
             this.DataSourceListener
             ),
         ChoiceRow <SpotlightViewfinderDisabledColor> .Create(
             "Disabled Color",
             Enumeration.GetAll <SpotlightViewfinderDisabledColor>().ToArray(),
             () => SettingsManager.Instance.SpotlightViewfinderDisabledColor,
             color => SettingsManager.Instance.SpotlightViewfinderDisabledColor = color,
             this.DataSourceListener
             )
     }, "Spotlight"));
 }
コード例 #4
0
        private Row LaserlineViewfinderEnabledColorRow()
        {
            Row enabledColorRow;

            if (Equals(SettingsManager.Instance.LaserlineViewfinderStyleType, LaserlineViewfinderStyleType.Animated))
            {
                enabledColorRow = ChoiceRow <LaserlineViewfinderAnimatedEnabledColor> .Create(
                    "Enabled Color",
                    Enumeration.GetAll <LaserlineViewfinderAnimatedEnabledColor>().ToArray(),
                    () => SettingsManager.Instance.LaserlineViewfinderAnimatedEnabledColor,
                    color => SettingsManager.Instance.LaserlineViewfinderAnimatedEnabledColor = color,
                    this.DataSourceListener
                    );
            }
            else
            {
                enabledColorRow = ChoiceRow <LaserlineViewfinderEnabledColor> .Create(
                    "Enabled Color",
                    Enumeration.GetAll <LaserlineViewfinderEnabledColor>().ToArray(),
                    () => SettingsManager.Instance.LaserlineViewfinderEnabledColor,
                    color => SettingsManager.Instance.LaserlineViewfinderEnabledColor = color,
                    this.DataSourceListener
                    );
            }

            return(enabledColorRow);
        }
コード例 #5
0
 private Section CreateLaserlineSettings()
 {
     return(new Section(new Row[]
     {
         FloatWithUnitRow.Create(
             "Width",
             () => (SettingsManager.Instance.Viewfinder as LaserlineViewfinder).Width,
             unit => (SettingsManager.Instance.Viewfinder as LaserlineViewfinder).Width = unit,
             this.DataSourceListener
             ),
         ChoiceRow <LaserlineViewfinderEnabledColor> .Create(
             "Enabled Color",
             Enumeration.GetAll <LaserlineViewfinderEnabledColor>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderEnabledColor,
             color => SettingsManager.Instance.LaserlineViewfinderEnabledColor = color,
             this.DataSourceListener
             ),
         ChoiceRow <LaserlineViewfinderDisabledColor> .Create(
             "Disabled Color",
             Enumeration.GetAll <LaserlineViewfinderDisabledColor>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderDisabledColor,
             color => SettingsManager.Instance.LaserlineViewfinderDisabledColor = color,
             this.DataSourceListener
             )
     }, "Laserline"));
 }
コード例 #6
0
 private Section CreateLaserlineSettings()
 {
     return(new Section(new Row[]
     {
         ChoiceRow <LaserlineViewfinderStyleType> .Create(
             "Style",
             Enumeration.GetAll <LaserlineViewfinderStyleType>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderStyleType,
             newStyle =>
         {
             SettingsManager.Instance.LaserlineViewfinderStyleType = newStyle;
             SettingsManager.Instance.ViewfinderKind = ViewfinderKind.UpdateLaserlineStyle(newStyle);
             this.laserlineSettings = this.CreateLaserlineSettings();
         },
             this.DataSourceListener),
         FloatWithUnitRow.Create(
             "Width",
             () => (SettingsManager.Instance.ViewfinderKind.Viewfinder as LaserlineViewfinder).Width,
             unit => (SettingsManager.Instance.ViewfinderKind.Viewfinder as LaserlineViewfinder).Width = unit,
             this.DataSourceListener
             ),
         this.LaserlineViewfinderEnabledColorRow(),
         ChoiceRow <LaserlineViewfinderDisabledColor> .Create(
             "Disabled Color",
             Enumeration.GetAll <LaserlineViewfinderDisabledColor>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderDisabledColor,
             color => SettingsManager.Instance.LaserlineViewfinderDisabledColor = color,
             this.DataSourceListener
             )
     }, "Laserline"));
 }
コード例 #7
0
 private Section CreateCameraSettingsSection()
 {
     return(new Section(new Row[]
     {
         FloatRow.Create(
             "Max Frame Rate",
             () => NumberFormatter.Instance.FormatNFloat(SettingsManager.Instance.MaxFrameRate),
             () => SettingsManager.Instance.MaxFrameRate,
             value => SettingsManager.Instance.MaxFrameRate = value
             ),
         ChoiceRow <Resolution> .Create(
             "Preferred Resolution",
             Enumeration.GetAll <Resolution>().ToArray(),
             () => Resolution.Create(SettingsManager.Instance.PreferredResolution),
             value => SettingsManager.Instance.PreferredResolution = value.VideoResolution,
             this.DataSourceListener
             ),
         SliderRow.Create(
             "Zoom Factor",
             () => SettingsManager.Instance.ZoomFactor,
             value => SettingsManager.Instance.ZoomFactor = value
             ),
         ChoiceRow <FocusRangeType> .Create(
             "Focus Range",
             Enumeration.GetAll <FocusRangeType>().ToArray(),
             () => FocusRangeType.Create(SettingsManager.Instance.FocusRange),
             value => SettingsManager.Instance.FocusRange = value.FocusRange,
             this.DataSourceListener
             )
     }, "Camera Settings"));
 }
コード例 #8
0
        private DefaultChoiceElement CreateDefaultChoiceGUI(DialogueElement root, ConversationRow conversation,
                                                            ChoiceRow choice, IList <ContentElement> contents, string language)
        {
            var choiceElem = new DefaultChoiceElement();

            CreateChoiceContent(root.Header, choiceElem, conversation, choice, contents, language);

            root.Add(choiceElem);
            return(choiceElem);
        }
        private Section CreateActiveSymbolCountRangeSection()
        {
            int currentMin;
            int currentMax;

            if (!this.symbologySettings.ActiveSymbolCounts.Any())
            {
                currentMin = (int)this.symbologyDescription.ActiveSymbolCountRange.Minimum;
            }
            else
            {
                currentMin = this.symbologySettings.ActiveSymbolCounts.Min();
            }
            if (!this.symbologySettings.ActiveSymbolCounts.Any())
            {
                currentMax = (int)this.symbologyDescription.ActiveSymbolCountRange.Maximum;
            }
            else
            {
                currentMax = this.symbologySettings.ActiveSymbolCounts.Max();
            }

            var minimumRange = Enumerable.Range((int)this.symbologyDescription.ActiveSymbolCountRange.Minimum,
                                                currentMax - (int)this.symbologyDescription.ActiveSymbolCountRange.Minimum);
            var maximumRange = Enumerable.Range(currentMin,
                                                (int)this.symbologyDescription.ActiveSymbolCountRange.Maximum - currentMin);

            return(new Section(new[]
            {
                ChoiceRow <SymbolCount> .Create(
                    "Minimum",
                    minimumRange.Select(val => new SymbolCount(val)).ToArray(),
                    () => new SymbolCount((int)currentMin),
                    value =>
                {
                    var newSet = this.symbologySettings.ActiveSymbolCounts.NewSetWithMinimum((short)value.Id);
                    this.symbologySettings.ActiveSymbolCounts = newSet;
                },
                    this.DataSourceListener
                    ),
                ChoiceRow <SymbolCount> .Create(
                    "Maximum",
                    maximumRange.Select(val => new SymbolCount(val)).ToArray(),
                    () => new SymbolCount(currentMax),
                    value =>
                {
                    var newSet = this.symbologySettings.ActiveSymbolCounts.NewSetWithMaximum((short)value.Id);
                    this.symbologySettings.ActiveSymbolCounts = newSet;
                },
                    this.DataSourceListener
                    )
            }, "Range"));
        }
コード例 #10
0
 private Section CreateRectangularSettings()
 {
     return(new Section(new[]
     {
         ChoiceRow <RectangularViewfinderColor> .Create(
             "Color",
             Enumeration.GetAll <RectangularViewfinderColor>().ToArray(),
             () => SettingsManager.Instance.RectangularViewfinderColor,
             newColor => SettingsManager.Instance.RectangularViewfinderColor = newColor,
             this.DataSourceListener)
     }, "Rectangular"));
 }
コード例 #11
0
 private Section CreateRectangularSizeType()
 {
     return(new Section(new[]
     {
         ChoiceRow <RectangularSizeSpecification> .Create(
             "Size Specification",
             Enumeration.GetAll <RectangularSizeSpecification>().ToArray(),
             () => SettingsManager.Instance.ViewfinderSizeSpecification,
             spec => SettingsManager.Instance.ViewfinderSizeSpecification = spec,
             this.DataSourceListener)
     }));
 }
コード例 #12
0
 private Section CreateTorchSection()
 {
     return(new Section(new[]
     {
         ChoiceRow <TorchStateType> .Create(
             "Desired Torch State",
             Enumeration.GetAll <TorchStateType>().ToArray(),
             () => SettingsManager.Instance.TorchStateType,
             value => SettingsManager.Instance.TorchStateType = value,
             this.DataSourceListener
             )
     }));
 }
コード例 #13
0
        private GoToElement CreateGoToGUI(VisualElement root, ChoiceRow choice)
        {
            if (string.IsNullOrEmpty(choice.GoTo))
            {
                return(null);
            }

            var goToElem = new GoToElement("Go To")
            {
                value = choice.GoTo
            };

            root.Add(goToElem);
            return(goToElem);
        }
コード例 #14
0
 public OverlayDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             ChoiceRow <NamedBrush> .Create("Brush",
                                            Enumeration.GetAll <NamedBrush>().ToArray(),
                                            () => NamedBrush.Create(SettingsManager.Instance.Brush),
                                            brush => SettingsManager.Instance.Brush = brush.Brush,
                                            this.DataSourceListener
                                            )
         }),
     };
 }
コード例 #15
0
        private ChoiceElement CreateChoiceGUI(VisualElement root, ConversationRow conversation,
                                              ChoiceRow choice, IList <ContentElement> contents, string language)
        {
            var choiceElem = new ChoiceElement();

            var idElem = new IdElement {
                value = choice.Id.ToString()
            };

            choiceElem.Header.Add(idElem);

            CreateChoiceContent(choiceElem.Header, choiceElem.Content, conversation, choice, contents, language);

            root.Add(choiceElem);
            return(choiceElem);
        }
コード例 #16
0
 private Section CreateRectangularSettings()
 {
     return(new Section(new Row[]
     {
         ChoiceRow <RectangularViewfinderStyleType> .Create(
             "Style",
             Enumeration.GetAll <RectangularViewfinderStyleType>().ToArray(),
             () => SettingsManager.Instance.RectangularViewfinderStyleType,
             newStyle =>
         {
             SettingsManager.Instance.RectangularViewfinderStyleType = newStyle;
             SettingsManager.Instance.ViewfinderKind = ViewfinderKind.UpdateRectangularStyle(newStyle);
         },
             this.DataSourceListener),
         ChoiceRow <RectangularViewfinderLineStyleType> .Create(
             "Line Style",
             Enumeration.GetAll <RectangularViewfinderLineStyleType>().ToArray(),
             () => SettingsManager.Instance.RectangularViewfinderLineStyleType,
             newLineStyle =>
         {
             SettingsManager.Instance.RectangularViewfinderLineStyleType = newLineStyle;
             SettingsManager.Instance.ViewfinderKind = ViewfinderKind.UpdateRectangularStyle(
                 SettingsManager.Instance.RectangularViewfinderStyleType, newLineStyle);
         },
             this.DataSourceListener),
         FloatRow.Create(
             "Dimming (0.0 - 1.0)",
             () => NumberFormatter.Instance.FormatNFloat(SettingsManager.Instance.RectangularViewfinderDimming),
             () => SettingsManager.Instance.RectangularViewfinderDimming,
             value => SettingsManager.Instance.RectangularViewfinderDimming = value
             ),
         ChoiceRow <RectangularViewfinderColor> .Create(
             "Color",
             Enumeration.GetAll <RectangularViewfinderColor>().ToArray(),
             () => SettingsManager.Instance.RectangularViewfinderColor,
             newColor => SettingsManager.Instance.RectangularViewfinderColor = newColor,
             this.DataSourceListener),
         ChoiceRow <RectangularViewfinderDisabledColor> .Create(
             "Disabled Color",
             Enumeration.GetAll <RectangularViewfinderDisabledColor>().ToArray(),
             () => SettingsManager.Instance.RectangularViewfinderDisabledColor,
             newColor => SettingsManager.Instance.RectangularViewfinderDisabledColor = newColor,
             this.DataSourceListener
             )
     }, "Rectangular"));
 }
コード例 #17
0
        private ContentElement CreateContentGUI(VisualElement root, ConversationRow conversation,
                                                ChoiceRow choice, IList <ContentElement> contentElems, string language)
        {
            root.userData = conversation;
            var contentText = conversation.GetContent(choice.ContentId)?.GetLocalization(language);

            if (string.IsNullOrEmpty(contentText))
            {
                return(null);
            }

            var contentElem = new ContentElement {
                userData = choice.ContentId,
                value    = contentText
            };

            contentElems.Add(contentElem);
            root.Add(contentElem);
            return(contentElem);
        }
コード例 #18
0
 private Section CreateAimerSettings()
 {
     return(new Section(new Row[]
     {
         ChoiceRow <AimerViewfinderFrameColor> .Create(
             "Frame Color",
             Enumeration.GetAll <AimerViewfinderFrameColor>().ToArray(),
             () => SettingsManager.Instance.AimerViewfinderFrameColor,
             color => SettingsManager.Instance.AimerViewfinderFrameColor = color,
             this.DataSourceListener
             ),
         ChoiceRow <AimerViewfinderDotColor> .Create(
             "Dot Color",
             Enumeration.GetAll <AimerViewfinderDotColor>().ToArray(),
             () => SettingsManager.Instance.AimerViewfinderDotColor,
             color => SettingsManager.Instance.AimerViewfinderDotColor = color,
             this.DataSourceListener
             )
     }, "Aimer"));
 }
コード例 #19
0
 private Section CreateCameraSettingsSection()
 {
     return(new Section(new Row[]
     {
         ChoiceRow <Resolution> .Create(
             "Preferred Resolution",
             Enumeration.GetAll <Resolution>().ToArray(),
             () => Resolution.Create(SettingsManager.Instance.PreferredResolution),
             value => SettingsManager.Instance.PreferredResolution = value.VideoResolution,
             this.DataSourceListener
             ),
         SliderRow.Create(
             "Zoom Factor",
             () => SettingsManager.Instance.ZoomFactor,
             value => SettingsManager.Instance.ZoomFactor = value
             ),
         SliderRow.Create(
             "Zoom Gesture Zoom Factor",
             () => SettingsManager.Instance.ZoomGestureZoomFactor,
             value => SettingsManager.Instance.ZoomGestureZoomFactor = value
             ),
         ChoiceRow <FocusGestureStrategyType> .Create(
             "Focus Gesture Strategy",
             Enumeration.GetAll <FocusGestureStrategyType>().ToArray(),
             () => FocusGestureStrategyType.Create(SettingsManager.Instance.FocusGestureStrategy),
             value => SettingsManager.Instance.FocusGestureStrategy = value.FocusGestureStrategy,
             this.DataSourceListener
             ),
         ChoiceRow <FocusRangeType> .Create(
             "Focus Range",
             Enumeration.GetAll <FocusRangeType>().ToArray(),
             () => FocusRangeType.Create(SettingsManager.Instance.FocusRange),
             value => SettingsManager.Instance.FocusRange = value.FocusRange,
             this.DataSourceListener
             )
     }, "Camera Settings"));
 }
コード例 #20
0
        private Section[] CreateSections()
        {
            var sections = new List <Section>()
            {
                new Section(new []
                {
                    OptionRow <bool> .Create("None",
                                             () => SettingsManager.Instance.LocationSelection == null,
                                             tuple => SettingsManager.Instance.LocationSelection = null,
                                             this.DataSourceListener
                                             ),
                    OptionRow <bool> .Create("Radius",
                                             () => SettingsManager.Instance.LocationSelection is RadiusLocationSelection,
                                             _ => SettingsManager.Instance.LocationSelection = RadiusLocationSelection.Create(FloatWithUnit.Zero),
                                             this.DataSourceListener
                                             ),
                    OptionRow <bool> .Create("Rectangular",
                                             () => SettingsManager.Instance.LocationSelection is RectangularLocationSelection,
                                             _ => SettingsManager.Instance.LocationSelection = RectangularLocationSelection.Create(SizeWithUnit.Zero),
                                             this.DataSourceListener
                                             )
                }, "Type")
            };

            switch (SettingsManager.Instance.LocationSelection)
            {
            case RadiusLocationSelection radiusLocationSelection:
            {
                var radiusSettings = new Section(new[]
                    {
                        FloatWithUnitRow.Create(
                            "Size",
                            () => radiusLocationSelection.Radius,
                            value => SettingsManager.Instance.LocationSelection = RadiusLocationSelection.Create(value),
                            this.DataSourceListener
                            )
                    }, "Radius");
                sections.Add(radiusSettings);
                break;
            }

            case RectangularLocationSelection rectangularLocationSelection:
            {
                var rectangularSettings = new Section(new []
                    {
                        ChoiceRow <RectangularSizeSpecification> .Create(
                            "Size Specification",
                            Enumeration.GetAll <RectangularSizeSpecification>().ToArray(),
                            () => this.GetCurrentSizeSpecification(),
                            specification => this.SetCurrentSizeSpecification(specification),
                            this.DataSourceListener
                            ),
                    }, "Rectangular");
                sections.Add(rectangularSettings);
                switch (rectangularLocationSelection.SizeWithUnitAndAspect.SizingMode)
                {
                case SizingMode.WidthAndHeight:
                {
                    sections.Add(new Section(new[]
                            {
                                this.CreateRectangularWidthRow(),
                                this.CreateRectangularHeightRow()
                            }));
                    break;
                }

                case SizingMode.WidthAndAspectRatio:
                {
                    sections.Add(new Section(new Row[]
                            {
                                this.CreateRectangularWidthRow(),
                                this.CreateHeightAspectRow()
                            }));
                    break;
                }

                case SizingMode.HeightAndAspectRatio:
                {
                    sections.Add(new Section(new Row[]
                            {
                                this.CreateRectangularHeightRow(),
                                this.CreateWidthAspectRow()
                            }));
                    break;
                }
                }
                break;
            }
            }

            return(sections.ToArray());
        }
コード例 #21
0
 private void CreateChoiceContent(VisualElement header, VisualElement content, ConversationRow conversation,
                                  ChoiceRow choice, IList <ContentElement> contents, string language)
 {
     CreateContentGUI(header, conversation, choice, contents, language);
     CreateGoToGUI(content, choice);
 }