Example #1
0
    public void UpdateSkin()
    {
        SkinData sd = GameManager.Instance.Player.CurrentSkin;

        if (PipeType == EPipeType.Blocker)
        {
            IconImage.sprite = GameManager.Instance.Game.GetSprite("blocker");
            ValueImage.gameObject.SetActive(false);
        }
        else
        {
            //if (sd.PipeStructureType == EPipeStructureType.BackFront)
            //{
            ValueImage.gameObject.SetActive(true);
            IconImage.sprite = GameManager.Instance.Game.GetSprite(sd.BackPrefix + AColor.ToString());
            IconImage.SetNativeSize();
            ValueImage.sprite = GameManager.Instance.Game.GetSprite(sd.FrontPrefix + Param.ToString());
            ValueImage.SetNativeSize();
            //}
            //else
            //if (sd.PipeStructureType == EPipeStructureType.Solid)
            //{
            //	ValueImage.gameObject.SetActive (false);
            //	IconImage.sprite = GameManager.Instance.Game.GetSprite(sd.BackPrefix + AColor.ToString() + "_" +  Param.ToString());
            //	IconImage.SetNativeSize();
            //}
        }
    }
 public PageString(byte x, byte y, AColor clr, byte sz, string str)
     : base(x, y)
 {
     this.TextColor = clr;
     this.Size      = sz;
     this.Data      = str;
 }
Example #3
0
        public UIAcolorBox(Color clr_in)
            : base()
        {
            dp    = new DockPanel();
            tbC   = new TextBox();
            rectC = new Rectangle();
            Label lbl_clr = new Label();

            clr = new AColor();
            clr.SetFromColor(clr_in);

            lbl_clr.Content = "Цвет";
            tbC.Text        = clr.ToHex();

            tbC.Width         = 65;
            tbC.Height        = 23;
            tbC.TextAlignment = TextAlignment.Center;
            tbC.MaxLength     = 6;

            rectC.Fill            = new SolidColorBrush(clr_in);
            rectC.Stroke          = Brushes.Black;
            rectC.StrokeThickness = 3;

            rectC.Width  = 23;
            rectC.Height = 23;

            rectC.ContextMenu = genContextMenu();

            //rectC.MouseLeftButtonDown +=

            dp.Children.Add(lbl_clr);
            dp.Children.Add(tbC);
            dp.Children.Add(rectC);
            dp.LastChildFill = false;
        }
Example #4
0
 public ButtonAttribute(string text = "", AColor color = AColor.None,
                        UnityEventCallState whenCanPress = UnityEventCallState.EditorAndRuntime,
                        UISize size = UISize.SoSmall)
     : base(color)
 {
     Height       = (int)size;
     Text         = text ?? throw new ArgumentNullException(nameof(text));
     WhenCanPress = whenCanPress;
 }
Example #5
0
 public Gadget()
 {
     MagnifyingGlass.UseWin32Api = true;
     InitializeComponent();
     Font = new Font("Microsoft Sans Serif", (float)8.25);
     MGlass.Hide();
     AColor.Hide();
     MGlass.MovingGlass.MagnifyingGlass.Click += new EventHandler(MagnifyingGlass_Click);
     SelectColor(MGlass.PixelColor);
 }
        ///
        /// <summary> * Draw a linear spectrum graph.
        /// *  </summary>
        /// * <param name="data"> An array of floats defining the signal power
        /// *                      at each frequency in the spectrum. </param>
        /// * <param name="graphics">  Canvas to draw into. </param>
        /// * <param name="pen"> Graphics to draw with. </param>
        ///
        private void logGraph(float[] data, Graphics graphics, Pen pen)
        {
            //pen.Style = Graphics.Style.FILL;
            paintColor[1] = 1f;
            paintColor[2] = 1f;
            int   len = data.Length;
            float bw  = (float)(spectGraphWidth - 2) / (float)len;
            float bh  = spectGraphHeight - 2;
            float be  = spectGraphY + spectGraphHeight - 1;

            // Determine the first and last frequencies we have.
            float leftFrequency  = nyquistFreq / len;
            float rightFrequency = nyquistFreq;

            // Now, how many octaves is that. Round down. Calculate pixels/oct.
            int   octaves  = (int)Math.Floor(log2(rightFrequency / leftFrequency)) - 2;
            float octWidth = (float)(spectGraphWidth - 2) / (float)octaves;

            // Calculate the base frequency for the graph, which isn't leftFrequency.
            float baseFrequency = rightFrequency / (float)Math.Pow(2, octaves);

            // TODO: Old Java: Element 0 isn't a frequency bucket; skip it.
            for (int i = 1; i < len; ++i)
            {
                // Cycle the hue angle from 0° to 300°; i.e. red to purple.
                paintColor[0] = (float)i / (float)len * 300f;
                pen.Color     = AColor.HSVToColor(paintColor);

                // What frequency bucket are we in.
                float f = leftFrequency * i;

                // For freq f, calculate x.
                float x = spectGraphX + (float)(log2(f) - log2(baseFrequency)) * octWidth;

                // Draw the bar.
                float y = be - (float)(Math.Log10(data[i]) / RANGE_BELS + 1f) * bh;
                if (y > be)
                {
                    y = be;
                }
                else if (y < spectGraphY)
                {
                    y = spectGraphY;
                }
                if (bw <= 1.0f)
                {
                    graphics.DrawLine(pen, x, y, x, be);
                }
                else
                {
                    //graphics.DrawRectangle(pen, x, y, bw, be-y);
                    graphics.FillRectangle(new SolidBrush(pen.Color), x, y, bw, be - y);
                }
            }
        }
Example #7
0
 private void bSelect_Click(object sender, EventArgs e)
 {
     lR.Hide();
     lG.Hide();
     lB.Hide();
     lH.Hide();
     SColor.Hide();
     bSelect.Hide();
     MGlass.Show();
     AColor.Show();
     MGlass.UpdateTimer.Start();
     MGlass.MovingGlass.Show();
 }
Example #8
0
 private void MagnifyingGlass_Click(object sender, EventArgs e)
 {
     SelectColor(MGlass.PixelColor);
     MGlass.Hide();
     MGlass.UpdateTimer.Stop();
     AColor.Hide();
     SColor.Show();
     lR.Show();
     lG.Show();
     lB.Show();
     lH.Show();
     bSelect.Show();
 }
        private void clickContextMenu(object sender, EventArgs e)
        {
            AColor clr;

            if (sender is MenuItem)
            {
                string header = (sender as MenuItem).Header as string;

                if (AColors.AColorsDict.ContainsKey(header))
                {
                    clr        = AColors.AColorsDict[header];
                    tbC.Text   = clr.ToHex();
                    rectC.Fill = new SolidColorBrush(clr.GetColor());
                }
            }
        }
Example #10
0
    private static AColor[,] prepare(Bitmap bmp)
    {
        AColor[,] matrix2d = new AColor[bmp.Width, bmp.Height];

        for (int y = 0; y < bmp.Height; y++)
        {
            for (int x = 0; x < bmp.Width; x++)
            {
                Color  middle  = bmp.GetPixel(x, y);
                AColor AColor1 = new AColor();
                AColor1.R      = middle.R;
                AColor1.G      = middle.G;
                AColor1.B      = middle.B;
                matrix2d[x, y] = AColor1;
            }
        }
        return(matrix2d);
    }
        public async Task Can_DeserializePayload_WithPrimitiveParameters(string actionName, IEdmAction expectedAction, ODataPath path)
        {
            // Arrange
            const int    Quantity    = 1;
            const string ProductCode = "PCode";
            string       body        = "{" +
                                       string.Format(@" ""Quantity"": {0} , ""ProductCode"": ""{1}"" , ""Birthday"": ""2015-02-27"", ""BkgColor"": ""Red"", ""InnerColor"": null", Quantity, ProductCode) +
                                       "}";

            ODataMessageWrapper message = new ODataMessageWrapper(await GetStringAsStreamAsync(body));

            message.SetHeader("Content-Type", "application/json");
            ODataMessageReader       reader  = new ODataMessageReader(message as IODataRequestMessage, new ODataMessageReaderSettings(), _model);
            ODataDeserializerContext context = new ODataDeserializerContext()
            {
                Path = path, Model = _model
            };

            // Act
            ODataActionParameters payload = await _deserializer.ReadAsync(reader, typeof(ODataActionParameters), context) as ODataActionParameters;

            IEdmAction action = ODataActionPayloadDeserializer.GetAction(context);

            // Assert
            Assert.NotNull(actionName);
            Assert.Same(expectedAction, action);
            Assert.NotNull(payload);
            Assert.True(payload.ContainsKey("Quantity"));
            Assert.Equal(Quantity, payload["Quantity"]);
            Assert.True(payload.ContainsKey("ProductCode"));
            Assert.Equal(ProductCode, payload["ProductCode"]);

            Assert.True(payload.ContainsKey("Birthday"));
            Assert.Equal(new Date(2015, 2, 27), payload["Birthday"]);

            Assert.True(payload.ContainsKey("BkgColor"));
            AColor bkgColor = Assert.IsType <AColor>(payload["BkgColor"]);

            Assert.Equal(AColor.Red, bkgColor);

            Assert.True(payload.ContainsKey("InnerColor"));
            Assert.Null(payload["InnerColor"]);
        }
        ///
        ///	 <summary> * Draw a linear spectrum graph.
        ///	 *  </summary>
        /// * <param name="data"> An array of floats defining the signal power
        /// *                      at each frequency in the spectrum. </param>
        ///	 * <param name="graphics">  Canvas to draw into. </param>
        ///	 * <param name="pen"> Graphics to draw with. </param>
        ///
        private void linearGraph(float[] data, Graphics graphics, Pen pen)
        {
            paintColor[1] = 1f;
            paintColor[2] = 1f;
            int   len = data.Length;
            float bw  = (float)(spectGraphWidth - 2) / (float)len;
            float bh  = spectGraphHeight - 2;
            float be  = spectGraphY + spectGraphHeight - 1;

            // TODO: Java: Element 0 isn't a frequency bucket; skip it.
            for (int i = 1; i < len; ++i)
            {
                // Cycle the hue angle from 0° to 300°; i.e. red to purple.
                paintColor[0] = (float)i / (float)len * 300f;
                pen.Color     = AColor.HSVToColor(paintColor);

                // Draw the bar.
                float x = spectGraphX + (i * bw + 1);                 //  + (i * bw + 1)
                float y = be - (float)(Math.Log10(data[i]) / RANGE_BELS + 1f) * bh;
                if (y > be)
                {
                    y = be;
                }
                else if (y < spectGraphY)
                {
                    y = spectGraphY;
                }
                if (bw <= 1.0f)
                {
                    graphics.DrawLine(pen, x, y, x, be);
                }
                else
                {
                    // canvas.drawRect(x, y, x + bw, be, paint);
                    // graphics.DrawRectangle(pen, x, y, bw, be-y);
                    graphics.FillRectangle(new SolidBrush(pen.Color), x, y, bw, be - y);
                }
            }
        }
Example #13
0
        public override AbstrPageEl CompileElement()
        {
            int    id   = 0;
            bool   sec  = false;
            bool   min  = false;
            bool   hour = false;
            AColor clr  = AColors.WHITE;
            int    px   = 0;
            int    py   = 0;
            int    sz   = 0;



            foreach (UIElement ch in Container.Children)
            {
                switch (ch.Uid)
                {
                case "spF":
                    StackPanel sp = (StackPanel)ch;

                    sec  = (bool)((CheckBox)sp.Children[0]).IsChecked;
                    min  = (bool)((CheckBox)sp.Children[1]).IsChecked;
                    hour = (bool)((CheckBox)sp.Children[2]).IsChecked;
                    break;

                case "tbS":
                    if (int.TryParse(((TextBox)ch).Text, out sz))
                    {
                        sz = (sz & byte.MaxValue);
                    }
                    else
                    {
                        sz = 0;
                    }
                    break;

                case "tbY":
                    if (int.TryParse(((TextBox)ch).Text, out py))
                    {
                        py = (py & byte.MaxValue);
                    }
                    else
                    {
                        py = 0;
                    }
                    break;

                case "tbX":
                    if (int.TryParse(((TextBox)ch).Text, out px))
                    {
                        px = (px & byte.MaxValue);
                    }
                    else
                    {
                        px = 0;
                    }
                    break;

                case "clrBox":
                    try
                    { clr = new AColor((ch as UIAcolorBox).GeBoxColor()); }
                    catch
                    { }
                    break;

                case "lblID":
                    if (!int.TryParse(
                            ((ch as Label).Content as string), out id))
                    {
                        id = 0;
                    }
                    break;
                }
            }

            AbstrPageEl p_out = new PageTime(
                (byte)px, (byte)py,
                clr,
                (byte)sz);

            ((PageTime)p_out).Second = sec;
            ((PageTime)p_out).Minute = min;
            ((PageTime)p_out).Hour   = hour;
            p_out.SetID(id);

            return(p_out);
        }
Example #14
0
 public Mood(double rStart, double rIncremente, double gStart, double gIncremente, double bStart, double bIncremente)
 {
     red   = new AColor(rStart, rIncremente);
     green = new AColor(gStart, gIncremente);
     blue  = new AColor(bStart, bIncremente);
 }
Example #15
0
        public override AbstrPageEl CompileElement()
        {
            string dt  = "";
            AColor clr = AColors.WHITE;
            int    px  = 0;
            int    py  = 0;
            int    sz  = 0;

            foreach (UIElement ch in Container.Children)
            {
                switch (ch.Uid)
                {
                case "tbT":
                    dt = ((TextBox)ch).Text;
                    break;

                case "tbS":
                    if (int.TryParse(((TextBox)ch).Text, out sz))
                    {
                        sz = (sz & byte.MaxValue);
                    }
                    else
                    {
                        sz = 0;
                    }
                    break;

                case "tbY":
                    if (int.TryParse(((TextBox)ch).Text, out py))
                    {
                        py = (py & byte.MaxValue);
                    }
                    else
                    {
                        py = 0;
                    }
                    break;

                case "tbX":
                    if (int.TryParse(((TextBox)ch).Text, out px))
                    {
                        px = (px & byte.MaxValue);
                    }
                    else
                    {
                        px = 0;
                    }
                    break;

                case "clrBox":
                    try
                    { clr = new AColor(((UIAcolorBox)ch).GeBoxColor()); }
                    catch
                    { }
                    break;
                }
            }
            AbstrPageEl p_out;

            p_out = new PageString(
                (byte)px, (byte)py,
                clr,
                (byte)sz,
                dt);

            return(p_out);
        }
Example #16
0
    private static void HeatIteration(AColor[,] rf, AColor[,] inp, AColor[,] precopy, Color paintcolor, int width, int height)
    {
        int y_minus_1 = 0;
        int y_plus_1  = 0;
        int x_minus_1 = 0;
        int x_plus_1  = 0;

        for (int y = 0; y < height; y++)
        {
            y_minus_1 = y - 1;
            y_plus_1  = y + 1;
            if (y_minus_1 < 0)
            {
                y_minus_1 = 0;
            }
            if (y_plus_1 > height - 1)
            {
                y_plus_1 = height - 1;
            }

            for (int x = 0; x < width; x++)
            {
                if (rf[x, y].R == paintcolor.R)
                {
                    x_minus_1 = x - 1;
                    x_plus_1  = x + 1;
                    if (x_minus_1 < 0)
                    {
                        x_minus_1 = 0;
                    }
                    if (x_plus_1 > width - 1)
                    {
                        x_plus_1 = width - 1;
                    }
                    int    cnt = 0;
                    AColor c1  = inp[x, y];
                    AColor c2  = inp[x_plus_1, y];
                    AColor c3  = inp[x_minus_1, y];
                    AColor c4  = inp[x, y_plus_1];
                    AColor c5  = inp[x, y_minus_1];
                    AColor pre = new AColor();

                    if (c1.R != paintcolor.R)
                    {
                        pre.R = pre.R + c1.R;
                        pre.G = pre.G + c1.G;
                        pre.B = pre.B + c1.B;
                        cnt   = cnt + 1;
                    }
                    if (c2.R != paintcolor.R)
                    {
                        pre.R = pre.R + c2.R;
                        pre.G = pre.G + c2.G;
                        pre.B = pre.B + c2.B;
                        cnt   = cnt + 1;
                    }
                    if (c3.R != paintcolor.R)
                    {
                        pre.R = pre.R + c3.R;
                        pre.G = pre.G + c3.G;
                        pre.B = pre.B + c3.B;
                        cnt   = cnt + 1;
                    }
                    if (c4.R != paintcolor.R)
                    {
                        pre.R = pre.R + c4.R;
                        pre.G = pre.G + c4.G;
                        pre.B = pre.B + c4.B;
                        cnt   = cnt + 1;
                    }
                    if (c5.R != paintcolor.R)
                    {
                        pre.R = pre.R + c5.R;
                        pre.G = pre.G + c5.G;
                        pre.B = pre.B + c5.B;
                        cnt   = cnt + 1;
                    }


                    if (cnt > 0)
                    {
                        pre.R         = pre.R / cnt;
                        pre.G         = pre.G / cnt;
                        pre.B         = pre.B / cnt;
                        precopy[x, y] = pre;
                    }
                }
            }
        }
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                if (rf[x, y].R == paintcolor.R)
                {
                    inp[x, y] = precopy[x, y];
                }
            }
        }
    }
 public LabelFieldAttribute(string label, FontStyle fontStyle = FontStyle.Normal, AColor color = AColor.None, int fontSize = 0) : base(label, fontStyle, color, UISize.Default, fontSize)
 {
 }
 public SeparatorAttribute(string label = "", FontStyle fontStyle = FontStyle.Normal, AColor color = AColor.None, UISize size = UISize.Default, int fontSize = 0) : base(label, fontStyle, color, size, fontSize)
 {
 }
 public PageTime(byte x, byte y, AColor clr, byte sz) :
     base(x, y, clr, sz, "")
 {
 }
Example #20
0
 public ColorSeparatorAttribute(AColor color) : base(color)
 {
 }
Example #21
0
 public FormaterAttribute(string label, FontStyle fontStyle = FontStyle.Normal, AColor color = AColor.None, UISize size = UISize.Default, int fontSize = 0)
     : this(label, fontStyle, GetColorByName(color).color, fontSize, (int)size)//i see that repeating, it is only way
 {
     if (color == AColor.None)
     {
         CustomColor = false;
     }
 }
Example #22
0
 public PageTime(byte x, byte y, AColor clr, byte sz)
 {
     SetPos(x, y);
     TextColor = clr;
     Size      = sz;
 }
 public BackgroundAttribute(AColor color) : base(color)
 {
 }