public void OptionNames()
        {
            var s     = new BubbleOptions();
            var names = s.GetOptionNames();

            Assert.AreEqual(propertyNames.Count, names.Count);
        }
        public void BackgroundCustom()
        {
            var propertyIndex = 0;
            var expectedValue = EnumHelpers.GetRandomValue <KnownColor>(KnownColor.White).ToString();

            var src = new BubbleOptions {
                Background = expectedValue
            };
            var so = PopulateOptions(src);

            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void NubSizeCustom()
        {
            var propertyIndex = 7;
            var expectedValue = r.Next(-2, 2);

            var src = new BubbleOptions {
                NubSize = expectedValue
            };
            var so = PopulateOptions(src);

            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void NubOffsetCustom()
        {
            var propertyIndex = 6;
            var expectedValue = r.Next(-4, 4, BubbleOptions.Defaults.NubOffset);

            var src = new BubbleOptions {
                NubOffset = expectedValue
            };
            var so = PopulateOptions(src);

            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void BorderWidthCustom()
        {
            var propertyIndex = 5;
            var expectedValue = new CSSLengthUnit(r.Next(0, 5, BubbleOptions.Defaults.BorderWidth.Units), CSSUnit.Pixels);

            var src = new BubbleOptions {
                BorderWidth = expectedValue
            };
            var so = PopulateOptions(src);

            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void BorderStyleCustom()
        {
            var propertyIndex = 3;
            var expectedValue = borderStyles[r.Next(0, borderStyles.Length, 3)];

            var src = new BubbleOptions {
                BorderStyle = expectedValue
            };
            var so = PopulateOptions(src);

            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void BorderColorCustom()
        {
            var propertyIndex = 2;
            var expectedValue = EnumHelpers.GetRandomValue <KnownColor>().ToString();

            var src = new BubbleOptions {
                BorderColor = expectedValue
            };
            var so = PopulateOptions(src);

            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void EmptyContructor()
        {
            var aco = new BubbleOptions
            {
            };

            var o = PopulateOptions(aco);

            Assert.AreEqual(0, o.Count);

            o = PopulateOptions(aco, true);
            Assert.AreEqual(8, o.Count);
        }
        public void BackgroundDefault()
        {
            var propertyIndex = 0;
            var expectedValue = BubbleOptions.Defaults.Background;
            var src           = new BubbleOptions {
            };

            var so = PopulateOptions(src);

            AssertEmptyProperty(so, propertyIndex);

            so = PopulateOptions(src, true);
            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void NubSizeDefault()
        {
            var propertyIndex = 7;
            var expectedValue = BubbleOptions.Defaults.NubSize;
            var src           = new BubbleOptions {
            };

            var so = PopulateOptions(src);

            AssertEmptyProperty(so, propertyIndex);

            so = PopulateOptions(src, true);
            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void BorderWidthDefault()
        {
            var propertyIndex = 5;
            var expectedValue = BubbleOptions.Defaults.BorderWidth;
            var src           = new BubbleOptions {
            };

            var so = PopulateOptions(src);

            AssertEmptyProperty(so, propertyIndex);

            so = PopulateOptions(src, true);
            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
        public void TextColorDefault()
        {
            var propertyIndex = 1;
            var expectedValue = BubbleOptions.Defaults.TextColor;
            var src           = new BubbleOptions {
            };

            var so = PopulateOptions(src);

            AssertEmptyProperty(so, propertyIndex);

            so = PopulateOptions(src, true);
            AssertPopulatedProperty(so, propertyIndex, expectedValue);
        }
    /// <summary>
    /// Constructor. Inject the various dependencies.
    /// </summary>
    public BubbleController(GameObject bubblePrefab, BubbleOptions options, Boundary worldBoundary, ExplosionController explosionController, SpectrumVisualiser spectrumVisualiser)
    {
        this.explosionController = explosionController;
        this.bubblePrefab = bubblePrefab;
        this.options = options;
        this.worldBoundary = worldBoundary;

        activeBubbles = new List<GameObject>(options.maxBubbles);
        pooledBubbles = new List<GameObject>(options.maxBubbles);
        InitBubblePool();

        spectrumPeaks = new List<Peak>();

        // Subscribe to the spectrum visualiser's SpectrumChangedEvent,
        // so that we are able to spawn bubbles at peaks in the rendered spectrum.
        spectrumVisualiser.SpectrumChangedEventHandler += OnSpectrumBandsUpdate;
        yOrigin = spectrumVisualiser.yOrigin;
    }
        private static void PopulateOptions(Random r, WebChatStyleOptions options)
        {
            var cc = new ChatColorOptions()
            {
                BackgroundColor = EnumHelpers.GetRandomValue <KnownColor>().ToString(),
                AccentColor     = EnumHelpers.GetRandomValue <KnownColor>().ToString(),
                SubtleColor     = EnumHelpers.GetRandomValue <KnownColor>().ToString()
            };
            var borderStyles = new string[]
            {
                "none", "dotted", "dashed",
                "solid", "double", "groove",
                "ridge", "inset", "outset"
            };

            var bb = new BubbleOptions(true)
            {
                Background = EnumHelpers.GetRandomValue <KnownColor>().ToString(),
                TextColor  = EnumHelpers.GetRandomValue <KnownColor>().ToString(),

                BorderColor  = EnumHelpers.GetRandomValue <KnownColor>().ToString(),
                BorderStyle  = borderStyles[r.Next(0, borderStyles.Length)],
                BorderRadius = new CSSLengthUnit(r.Next(0, 20), CSSUnit.Pixels),
                BorderWidth  = new CSSLengthUnit(r.Next(0, 5), CSSUnit.Pixels)
            };
            var ub = new BubbleOptions(false)
            {
                Background = EnumHelpers.GetRandomValue <KnownColor>().ToString(),
                TextColor  = EnumHelpers.GetRandomValue <KnownColor>().ToString(),

                BorderColor  = EnumHelpers.GetRandomValue <KnownColor>().ToString(),
                BorderStyle  = borderStyles[r.Next(0, borderStyles.Length)],
                BorderRadius = new CSSLengthUnit(r.Next(0, 20), CSSUnit.Pixels),
                BorderWidth  = new CSSLengthUnit(r.Next(0, 5), CSSUnit.Pixels)
            };
            var ab = new BubbleCommonOptions()
            {
            };

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            // Get the array of FontFamily objects.
            var fontFamilies = installedFontCollection.Families;
Exemple #15
0
        internal override Size GetSymbolSize(int pointIndex, DataInfo dataInfo, Chart chart)
        {
            Size size = new Size();

            if ((dataInfo.MinVals.Length < 3) || (dataInfo.MaxVals.Length < 3))
            {
                return(size);
            }
            double num     = dataInfo.MinVals[2];
            double num2    = dataInfo.MaxVals[2];
            Size   minSize = GetMinSize(dataInfo);
            Size   maxSize = GetMaxSize(dataInfo);

            double[,] values = GetValues();
            if (values == null)
            {
                return(size);
            }
            int length = values.GetLength(0);
            int num4   = values.GetLength(1);

            if (((length < 3) || (pointIndex < 0)) || (pointIndex >= num4))
            {
                return(size);
            }
            double d = values[2, pointIndex];

            if (double.IsNaN(d))
            {
                return(size);
            }
            double num6 = (num2 == num) ? 1.0 : ((d - num) / (num2 - num));

            if ((chart != null) && (BubbleOptions.GetScale(chart) == BubbleScale.Area))
            {
                num6 = Math.Sqrt(num6);
            }
            return(new Size(minSize.Width + (num6 * (maxSize.Width - minSize.Width)), minSize.Height + (num6 * (maxSize.Height - minSize.Height))));
        }