Example #1
0
 public SeparatorAttribute(float thickness = DEFAULT_HEIGHT,
                           EColor color    = DEFAULT_COLOR)
 {
     Text      = "";
     Thickness = thickness;
     Color     = color;
 }
Example #2
0
 public SeparatorAttribute(string text,
                           float thickness = DEFAULT_HEIGHT,
                           EColor color    = DEFAULT_COLOR) : this(text)
 {
     Thickness = thickness;
     Color     = color;
 }
Example #3
0
    /// <summary>
    /// 직선 Match 3 ~ 4
    /// </summary>
    void MatchLine(Block targetBlock)
    {
        EColor eColor  = targetBlock.EColor;
        int    x       = targetBlock.X;
        int    y       = targetBlock.Y;
        bool   isMatch = false;

        // 6방향 매치 체크
        for (int i = 0; i < 6; i++)
        {
            Block searchBlock = GetBlock(x + SearchX[i], y + SearchY[i]);
            if (searchBlock != null && searchBlock.EColor == eColor)
            {
                searchBlock = GetBlock(x + SearchX[i + 3] % 6, y + SearchY[i + 3] % 6);
                if (searchBlock != null && searchBlock.EColor == eColor)
                {
                    isMatch = true;
                }

                searchBlock = GetBlock(x + SearchX[i + 6], y + SearchY[i + 6]);
                if (searchBlock != null && searchBlock.EColor == eColor)
                {
                    isMatch = true;
                }

                if (isMatch)
                {
                    hasMatch           = true;
                    targetBlock.bMatch = true;
                    MatchCount++;
                    //Debug.Log("Match " + targetBlock);
                }
            }
        }
    }
Example #4
0
        private async Task Endgame()
        {
            WaitingCanvas.Visibility = Visibility.Visible;
            string text = IsPlaying == EColor.Black ? "White" : "Black";

            TextBox.Text = $"{text} has won";
            Reset();
            await Task.Run(() => Thread.Sleep(3000));

            await Task.Run(Console.ReadLine);

            TextBox.Text = $"Removing remaining pieces off the board\n Please wait";

            List <Piece> pieces = board.PiecesOnTheBoard();

            foreach (var piece in pieces)
            {
                await SendPoints(piece.Pos, piece.ReturnToStorage(piece, board, true), cts.Token);

                board.Move(piece.Pos, piece.ReturnToStorage(piece, board, false));
                Reset();
            }

            board = new Board();
            WaitingCanvas.Visibility = Visibility.Collapsed;
            IsPlaying    = EColor.White;
            board.Filled = false;
            Reset();
            if (ComputerIsPlaying)
            {
                ComputerPlays();
            }
        }
Example #5
0
 public Vehicle(EManufacturer manufacturer, float maxSpeed, float price, EColor color)
 {
     this.manufacturer = manufacturer;
     this.MaxSpeed     = maxSpeed;
     this.Price        = price;
     this.color        = color;
 }
 public Dress(int style, EColor color, EDressCategory category) : base(style, typeAccessory.Dress)
 {
     this.Style    = style;
     this.type     = typeAccessory.Dress;
     this.Color    = color;
     this.Category = category;
 }
Example #7
0
        private Tuple <Point, Point> GetComputerPoints(EColor color)
        {
            Random       r      = new Random();
            List <Piece> pieces = new List <Piece>();

            pieces.AddRange(color == EColor.White ? board.WhitePieces.Where(piece => !piece.Taken) : board.BlackPieces.Where(piece => !piece.Taken));
            List <Tuple <Piece, Point, int> > results = new List <Tuple <Piece, Point, int> >();

            foreach (var piece in pieces)
            {
                List <Point> moves = piece.GenerateMoves(board);
                foreach (var point in moves)
                {
                    if (piece.Pos != point)
                    {
                        results.Add(board.GetPieceAt(point) == null ? new Tuple <Piece, Point, int>(piece, point, 0) : new Tuple <Piece, Point, int>(piece, point, board.GetPieceAt(point).Value));
                    }
                }
            }

            var maxResults = results.FindAll(tuple => tuple.Item3 == results.Max(tuple1 => tuple1.Item3));
            int index      = r.Next(0, maxResults.Count);

            var result = new Tuple <Point, Point>(maxResults[index].Item1.Pos, maxResults[index].Item2);

            return(result);
        }
Example #8
0
 /// <summary>
 /// Corrobora el color del instrumento
 /// </summary>
 private void SeleccionColor()
 {
     if (cmbBoxColorClasica.SelectedItem != null)
     {
         color = Validaciones.AsignacionColor(cmbBoxColorClasica.SelectedItem.ToString());
     }
 }
Example #9
0
        /// <summary>
        /// Obtiene un elemento del tipo Tela filtrando por Id
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public override Tela GetById(long entityId)
        {
            Tela tela = null;

            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();

            SqlCommand command = new SqlCommand();

            command.CommandType = System.Data.CommandType.Text;
            command.Connection  = connection;

            command.CommandText = string.Format($"SELECT * FROM {table} WHERE id = @id");
            command.Parameters.AddWithValue("@id", entityId);
            SqlDataReader dataReader = command.ExecuteReader();

            if (dataReader.Read() == false)
            {
                throw new Exception("Customer no encontrada");
            }
            ETipoTela tipoTela = (ETipoTela)Enum.Parse(typeof(ETipoTela), dataReader["tipoTela"].ToString());
            EColor    color    = (EColor)Enum.Parse(typeof(EColor), dataReader["color"].ToString());

            tela = new Tela(color, tipoTela, Convert.ToInt32(dataReader["cantidad"]), Convert.ToDateTime(dataReader["fechaIngreso"]));


            tela.Id = Convert.ToInt32(dataReader["id"]);
            dataReader.Close();
            connection.Close();
            return(tela);
        }
Example #10
0
    public static Color GetColor(EColor color)
    {
        switch (color)
        {
        case EColor.Red:
            return(Red);

        case EColor.Purple:
            return(Purple);

        case EColor.Blue:
            return(Blue);

        case EColor.BlueLight:
            return(BlueLight);

        case EColor.Green:
            return(Green);

        case EColor.Yellow:
            return(Yellow);

        case EColor.Orange:
            return(Orange);

        case EColor.White:
            return(White);
        }
        return(Color.red);
    }
Example #11
0
 public ButtonAttribute(string name, ESize size, EColor colorType)
 {
     Name     = name;
     SizeType = size;
     Style    = GetGUIStyle();
     BgColor  = ParseColorType(colorType);
 }
Example #12
0
        private void Render(Timer timer)
        {
            double averageFPS = Math.Round(timer.AverageFPS);
            double fps        = Math.Round(timer.FPS);

            m_Console.Canvas.SetColor(EColor.White, EColor.Black);
            m_Console.Canvas.Clear(0, 0, m_Console.Canvas.Width, 1);
            m_Console.Canvas.DrawText("FPS: " + fps + ", Average FPS: " + averageFPS, 0, 0);

            EColor textColor = 0;
            EColor bgColor   = 0;

            for (int x = 0; x < 16; ++x)
            {
                for (int y = 0; y < 16; ++y)
                {
                    m_Console.Canvas.SetColor(textColor, bgColor);
                    m_Console.Canvas.DrawRect(new Pixel(' ', textColor, bgColor), x * GRID_X, y * GRID_Y + 1, GRID_X, GRID_Y);
                    string textBin = Convert.ToString((int)textColor, 2).PadLeft(4, '0');
                    string bgBin   = Convert.ToString((int)bgColor, 2).PadLeft(4, '0');
                    m_Console.Canvas.DrawText(bgBin, x * GRID_X, y * GRID_Y + 1);
                    m_Console.Canvas.DrawText(textBin, x * GRID_X, y * GRID_Y + 2);
                    ++textColor;
                }
                ++bgColor;
                textColor = 0;
            }
            m_Console.Render();
        }
Example #13
0
 public Storage(Point point, EPieceType type, EColor color)
 {
     Point = point;
     Type  = type;
     Color = color;
     Taken = false;
 }
Example #14
0
        private EColor DetectCurrentBuildColor(CodeActivityContext context)
        {
            IBuildDetail buildDetail  = context.GetExtension <IBuildDetail>();
            EColor       successColor = GetColor(context.GetValue(SuccessColor), EColor.Green);

            EColor compilationFailedColor = GetColor(context.GetValue(CompilationFailedColor), EColor.Red);
            EColor testsFailedColor       = GetColor(context.GetValue(TestsFailedColor), EColor.Yellow);
            EColor buildRunningColor      = GetColor(context.GetValue(BuildRunningColor), EColor.Blue);

            switch (buildDetail.CompilationStatus)
            {
            case BuildPhaseStatus.Failed:
                return(compilationFailedColor);

            case BuildPhaseStatus.Succeeded:
                switch (buildDetail.TestStatus)
                {
                case BuildPhaseStatus.Failed:
                    return(testsFailedColor);

                case BuildPhaseStatus.Succeeded:
                    return(successColor);

                case BuildPhaseStatus.Unknown:                 //tests are running
                    return(buildRunningColor);
                }
                break;

            case BuildPhaseStatus.Unknown:
                return(buildRunningColor);
            }
            return(EColor.None);
        }
Example #15
0
 public Fungus(Point s, CDrawer c, EColor e)
 {
     this.canvas = c;
       this.start = s;
       this.e = e;
       this.color_strength = 64;
 }
Example #16
0
 public Fungus(Point s, CDrawer c, EColor e)
 {
   this.canvas = c;
   this.start = s;
   this.e = e;
   this.color_strength = 64;
 }
Example #17
0
    public void switchGreyPiece(bool flag)
    {
        if (flag)
        {
            if (previousColor == EColor.GREY || previousColor == EColor.NONE)
            {
                previousColor = currentColor;
            }

            currentColor = EColor.GREY;
        }
        else
        {
            if (previousColor != EColor.NONE && previousColor != EColor.GREY)
            {
                currentColor  = previousColor;
                previousColor = EColor.GREY;
            }
        }

        Sprite sprite = getSpriteByCurrentColor(currentColor);

        if (sprite == null || currentColor == EColor.NONE)
        {
            return;
        }

        foreach (SpriteRenderer piece in squaresSprite)
        {
            piece.sprite = sprite;
        }
    }
Example #18
0
    public Sprite getSpriteByCurrentColor(EColor color)
    {
        //print (color);

        switch (color)
        {
        case EColor.YELLOW:
            return(SPRITE_YELLOW);

        case EColor.GREEN:
            return(SPRITE_GREEN);

        case EColor.PURPLE:
            return(SPRITE_PURPLE);

        case EColor.BLUE:
            return(SPRITE_BLUE);

        case EColor.ORANGE:
            return(SPRITE_ORANGE);

        case EColor.PINK:
            return(SPRITE_PINK);

        case EColor.GREY:
            return(SPRITE_GREY);

        case EColor.RED:
            return(SPRITE_RED);
        }
        return(null);
    }
Example #19
0
 public Piece(Position position, EColor color, Board board)
 {
     Position      = position;
     Color         = color;
     _board        = board;
     _lastPosition = position;
 }
Example #20
0
        /// <summary>
        /// Crea el tipo de producto apropiado conforme a lo ingresado en el formulario
        /// </summary>
        /// <returns></returns>
        private void CargarCamposProducto()
        {
            ETipoMadera tipoMaderaPrincipal = (ETipoMadera)cmbMaderaPrincipal.SelectedItem;
            ETipoTela   tipoTela            = (ETipoTela)cmbTipoTela.SelectedItem;
            EColor      colorTela           = (EColor)cmbColorTela.SelectedItem;

            Madera maderaPrincipal;
            Tela   telaProducto;

            if (rbTorre.Checked)
            {
                maderaPrincipal = new Madera(tipoMaderaPrincipal, EForma.Tablon, Fabrica.CANTIDAD_MADERA_TORRE_PRINCIPAL);
                telaProducto    = new Tela(colorTela, tipoTela, Fabrica.CANTIDAD_TELA_TORRE);
                EModeloTorre modeloTorre       = (EModeloTorre)cmbModeloTorre.SelectedItem;
                ETipoMadera  tipoMaderaColumna = (ETipoMadera)cmbMaderaColumna.SelectedItem;

                Madera maderaColumna = new Madera(tipoMaderaColumna, EForma.Tubo, 1);

                if (chkYute.Checked)
                {
                    int metrosYute = (int)nudCantidadYute.Value;
                    bufferProducto = new Torre(maderaPrincipal, telaProducto, modeloTorre, maderaColumna, metrosYute);
                }
                else
                {
                    bufferProducto = new Torre(maderaPrincipal, telaProducto, modeloTorre, maderaColumna);
                }
            }
            else
            {
                maderaPrincipal = new Madera(tipoMaderaPrincipal, EForma.Tablon, Fabrica.CANTIDAD_MADERA_ESTANTE);
                telaProducto    = new Tela(colorTela, tipoTela, Fabrica.CANTIDAD_TELA_ESTANTE);
                bufferProducto  = new Estante(maderaPrincipal, telaProducto, (int)nudCantidadEstantes.Value);
            }
        }
Example #21
0
        /// <summary>
        /// Creates an AnimCurveAttribute instance with time clamped between 0 and the given max time, and value clamped between 0 and
        /// the given max value.
        /// </summary>
        /// <param name="_CurveColor">The color of the curve in the editor.</param>
        public AnimCurveAttribute(float _MaxTime, float _MaxValue, EColor _CurveColor)
        {
            m_MaxTime  = _MaxTime;
            m_MaxValue = _MaxValue;

            m_CurveColor = GetCurveColor(_CurveColor);
        }
        /// <summary>
        /// Corrobora el color del instrumento
        /// </summary>
        private void SeleccionColor()
        {
            if (cmbBoxColorAcustica.SelectedItem != null)
            {
                switch (cmbBoxColorAcustica.SelectedItem.ToString())
                {
                case "Natural":
                    color = EColor.Natural;
                    break;

                case "Negro":
                    color = EColor.Negro;
                    break;

                case "Verde":
                    color = EColor.Verde;
                    break;

                case "Azul":
                    color = EColor.Azul;
                    break;

                case "Rojo":
                    color = EColor.Rojo;
                    break;
                }
            }
        }
 public ProgressBarAttribute(string name = "", string maxValueName = "", int maxValue = 100, EColor color = EColor.Blue)
 {
     Name         = name;
     MaxValue     = maxValue;
     MaxValueName = maxValueName;
     Color        = color;
 }
Example #24
0
 void Start()
 {
     paintballColor = (EColor)Random.Range(0, System.Enum.GetValues(typeof(EColor)).Length - 1);
     sprite.color   = GameManager.instance.attribution.allColors[(int)paintballColor];
     manager        = GameObject.Find("Map").GetComponent <TilemapManager> ( );
     Destroy(this.gameObject, 5.0f);
 }
Example #25
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                Opcion = MessageBox.Show("Realmente desea Eliminar el Registro ?", "...::: Step One Ver 5.1:::...",
                                         MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                string Rpta = "";

                if (Opcion == DialogResult.OK)
                {
                    Rpta = EColor.Eliminar(TxtCod_color.Text);

                    if (Rpta.Equals("Y"))
                    {
                        Botones();
                        MensajeOk("Registro Eliminado Correctamente!");
                        Listar();
                    }
                    else
                    {
                        MensajeError(Rpta);
                    }
                }
                else
                {
                    MensajeError("Cancelando la Eliminacon de Registros!");
                }
            }
            catch (Exception ex)
            {
                MensajeError(ex.Message);
            }
        }
Example #26
0
 void Update()
 {
     if (color == EColor.Both && actualColor == _background.color)
     {
         actualColor = (_background.color == EColor.White) ? EColor.Black : EColor.White;
     }
 }
Example #27
0
        public void Listar()
        {
            try
            {
                Ds = EColor.Listar();

                TxtCod_color.Text  = Ds.Tables[0].Rows[0]["cod_color"].ToString();
                TxtCod_colorv.Text = Ds.Tables[0].Rows[0]["cod_color"].ToString();
                TxtDesc_color.Text = Ds.Tables[0].Rows[0]["desc_color"].ToString();
                TxtCampo1.Text     = Ds.Tables[0].Rows[0]["campo1"].ToString();
                TxtCampo2.Text     = Ds.Tables[0].Rows[0]["campo2"].ToString();
                TxtCampo3.Text     = Ds.Tables[0].Rows[0]["campo3"].ToString();
                TxtCampo4.Text     = Ds.Tables[0].Rows[0]["campo4"].ToString();
                TxtCampo5.Text     = Ds.Tables[0].Rows[0]["campo5"].ToString();
                TxtCampo6.Text     = Ds.Tables[0].Rows[0]["campo6"].ToString();
                TxtEditar.Text     = "Listar";
                Registros();
            }
            catch (Exception Ex)
            {
                TxtEditar.Text = "Nuevo";
                Limpiar();
                TxtCod_color.Focus();
                string rpta = Ex.Message;
                MensajeOk("Tabla Vacia, esta en modo Ingreso");
                Show();
            }
        }
Example #28
0
    Color SetColor(EColor eColor)
    {
        Color result = Color.white;

        switch (eColor)
        {
        case EColor.Red:
            result = Color.red; break;

        case EColor.Orange:
            result = orangeColor; break;

        case EColor.Yellow:
            result = Color.yellow; break;

        case EColor.Green:
            result = Color.green; break;

        case EColor.Blue:
            result = Color.blue; break;

        case EColor.Purple:
            result = purpleColor; break;
        }

        return(result);
    }
Example #29
0
 /// <summary>
 /// Creates a button for a method with arguments to call it from the inspector.
 /// </summary>
 /// <param name="color">Button's color.</param>
 /// <param name="buttonMode">Changes when the button should be enabled.</param>
 /// <param name="arguments">The parameters list of the method.</param>
 public ButtonAttribute(string label, EColor color, EButtonMode buttonMode = EButtonMode.AlwaysEnabled, params System.Object[] arguments)
 {
     Label      = label;
     Color      = Colors.FromEColor(color);
     ButtonMode = buttonMode;
     Arguments  = arguments;
 }
Example #30
0
 // Use this for initialization
 void Start()
 {
     if (color == EColor.Both)
     {
         color = EColor.White;
     }
 }
Example #31
0
        private void Render(Timer timer)
        {
            Canvas canvas = m_Console.Canvas;
            int    width  = m_Console.Width;
            int    height = m_Console.Height;

            double averageFPS = Math.Round(timer.AverageFPS);
            double fps        = Math.Round(timer.FPS);

            canvas.SetColor(EColor.White, EColor.Black);
            canvas.Clear(0, 0, canvas.Width, 1);
            canvas.DrawText("FPS: " + fps + ", Average FPS: " + averageFPS, 0, 0);
            ++m_Offset;

            for (int x = 0; x < width; ++x)
            {
                for (int y = 1; y < height; ++y)
                {
                    //console doesn't like changing colors between cells - so this is a worst case scenario
                    //bottleneck here is pInvoke to native code which might be still improved
                    char   c         = (char)('A' + ((m_Offset + x) % 23));
                    EColor textColor = (EColor)((m_Offset + x) % 16);
                    EColor bgColor   = (EColor)((m_Offset + x + y) % 16);
                    canvas.Plot(new Pixel(c, textColor, bgColor), x, y);
                }
            }
            m_Console.Render();
        }
Example #32
0
        /// <summary>
        /// Конструктор класса
        /// </summary>
        /// <param name="rect">Координаты текстуры</param>
        /// <param name="texture">Текстура</param>
        /// <param name="game">Ссылка на игру</param>
        /// <param name="camera">Ссылка на камеру</param>
        /// <param name="orientation">Ориентация стены</param>
        /// <param name="indexI">Индекс в карте уровня</param>
        /// <param name="indexJ">Индекс в карте уровня</param>
        /// <param name="isCLosed">Закрыта ли дверь</param>
        public Door(Rectangle rect, Texture2D texture, Game1 game, Camera camera, EColor color, DoorOrientation orientation, bool isCLosed = false, int indexI = -1, int indexJ = -1)
            : base(rect, texture, game, camera)
        {
            this.orientation = orientation;
                this.isClosed = isCLosed;

                this.indexI = indexI;
                this.indexJ = indexJ;

                this.color = color;
        }
Example #33
0
 public ChessPiece(ChessPiece piece)
 {
     _id = piece.Id;
     _isDied = piece._isDied;
     _color = piece._color;
     _type = piece._type;
     _value = piece._value;
     _point = piece._point;
     _texture2d = piece._texture2d;
     _position = piece._position;
 }
Example #34
0
 public Rook(int id, EColor color, Point position)
     : base(id, color, position)
 {
     _type = EType.Rook;
     _value = (int)EValue.Rook;
 }
Example #35
0
 /// <summary>
 /// Конструктор класса
 /// </summary>
 /// <param name="rect">Область, где должен быть расположен объект</param>
 /// <param name="texture">Текстура</param>
 /// <param name="game">Ссылка на игру</param>
 /// <param name="camera">Ссылка на камеру</param>
 public Key(Rectangle rect, Texture2D texture, Game1 game, Camera camera, EColor color)
     : base(rect, texture, game, camera)
 {
     this.color = color;
 }
Example #36
0
 public Horse(int id, EColor color, Point position)
     : base(id, color, position)
 {
     _type = EType.Horse;
     _value = (int)EValue.Horse;
 }
Example #37
0
 public ChessPiece(int id, EColor color, Point point)
 {
     _id = id;
     _color = color;
     _point = point;
 }
Example #38
0
 /// <summary>
 /// Khởi tạo
 /// </summary>
 public ChessPiece(EColor color)
 {
     _color = color;
 }
Example #39
0
 public Elephant(int id, EColor color, Point position)
     : base(id, color, position)
 {
     _type = EType.Elephant;
     _value = (int)EValue.Elephant;
 }
Example #40
0
 /// <summary>
 /// Khởi tạo
 /// </summary>
 /// <param name="id">Mã quân cờ</param>
 /// <param name="color">màu cờ</param>
 /// <param name="position">vị trí(điểm)</param>
 public Pawn(int id, EColor color, Point position)
     : base(id, color, position)
 {
     _type = EType.Pawn;
     _value = (int)EValue.Pawn;
 }
Example #41
0
 /// <summary>
 /// Sao chép 1 quân cờ
 /// </summary>
 /// <param name="piece"></param>
 public void Clone(ChessPiece piece)
 {
     _isDied = piece._isDied;
     _color = piece._color;
     _value = piece._value;
     _point = piece._point;
     _position = piece._position;
 }
Example #42
0
 public void SetColor(EColor color)
 {
     switch (color)
     {
         case EColor.blue:
             el_color.Fill = (RadialGradientBrush) Resources["gradient_blue"];
             break;
         case EColor.cyan:
             el_color.Fill = (RadialGradientBrush) Resources["gradient_cyan"];
             break;
         case EColor.green:
             el_color.Fill = (RadialGradientBrush) Resources["gradient_green"];
             break;
         case EColor.pink:
             el_color.Fill = (RadialGradientBrush) Resources["gradient_pink"];
             break;
         case EColor.red:
             el_color.Fill = (RadialGradientBrush) Resources["gradient_red"];
             break;
         case EColor.white:
             el_color.Fill = (RadialGradientBrush) Resources["gradient_white"];
             break;
         case EColor.yellow:
             el_color.Fill = (RadialGradientBrush) Resources["gradient_yellow"];
             break;
     }
 }
Example #43
0
 /// <summary>
 /// Đổi màu quân cờ
 /// </summary>
 public void ChangeColor()
 {
     if (_color == EColor.Black) _color = EColor.Red;
     else _color = EColor.Black;
 }
Example #44
0
 public King(int id, EColor color, Point position)
     : base(id, color, position)
 {
     _type = EType.King;
     _value = (int)EValue.King;
 }
Example #45
0
 public Guard(int id, EColor color, Point position)
     : base(id, color, position)
 {
     _type = EType.Guard;
     _value = (int)EValue.Guard;
 }
Example #46
0
 public Artillery(int id, EColor eColor, Point vector2)
     : base(id, eColor, vector2)
 {
     _type = EType.Artillery;
     _value = (int)EValue.Artillery;
 }