private void GrillaWN_Tile_MoveTo(object sender, TileEventArgs e) { try { if (tileSeleccionado != null) { if (e.MovioA_Row >= 0) { int Indice = vectorSeleccionado.BuscarTile(tileSeleccionado.Col, tileSeleccionado.Row); vectorSeleccionado.OcultarEnGrilla(this); vectorSeleccionado.MoverTileA(Indice, e.MovioA_Col, e.MovioA_Row); if (vectorSeleccionado != null) { vectorSeleccionado.Mostrar(); } this.execMensaje(sender, e, MensajeValorTotal(), 0); } else { this.execMensaje(sender, e, "Se paso pa arriva", 0); } } } catch (Exception Ex) { this.execMensaje(sender, e, "No hay Vector seleccionado", 0); } }
private void GrillaWN_Tile_Click(object sender, TileEventArgs e) { try { if (vectorNuevo != null) { if (vectorNuevo.Mostrado == false) { foreach (Tiles T in vectorNuevo) { T.Col = e.Tile.Col; T.Row = e.Tile.Row; } MisVectores.Add(vectorNuevo); VectoresNuevos.Remove(vectorNuevo); vectorNuevo.Mostrar(); GuardarEnArchivos_Soldados(); } this.execMensaje(sender, e, MensajeValorTotal(), 0); } } catch (Exception Ex) { this.execMensaje(sender, e, Ex.Message, 0); } }
void Click_TimeOut(object sender, TouchActionEventArgs args, string Mensaje) { T.Stop(); T_DC.Stop(); TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact); tArgs.Tile = TileView_Seleccionado; EventHandler <TileEventArgs> handler = Tile_Click; if (handler != null) { handler(this, tArgs); } EventStatus = EnumEstadoEvento.Nulo; }
private void GrillaWN_Tile_ClickLento(object sender, TileEventArgs e) { if (vectorSeleccionado != null) { if (tileSeleccionado != null) { //Vector V = this.MisVectores.BuscarVectorByCR(tileSeleccionado.Col, tileSeleccionado.Row); ListaVectores L = this.MisVectores.VectoresEnCR(tileSeleccionado.Col, tileSeleccionado.Row); L.MoverAlFondo(vectorSeleccionado); vectorSeleccionado = L[0]; this.MisVectores.MoverAlFrente(vectorSeleccionado); vectorSeleccionado.MostrarEnColor(Color.DarkGoldenrod); int Indice = vectorSeleccionado.BuscarTile(tileSeleccionado.Col, tileSeleccionado.Row); tileSeleccionado = vectorSeleccionado[Indice]; } } }
private void GrillaWN_Tile_DobleClick(object sender, TileEventArgs e) { try { if (tileSeleccionado != null) { if (vectorSeleccionado != null) { vectorSeleccionado.OcultarEnGrilla(this); int Indice = vectorSeleccionado.BuscarTile(e.Tile.Col, e.Tile.Row); vectorSeleccionado.SubirTile(Indice); vectorSeleccionado.Mostrar(); } } } catch (Exception Ex) { } }
private void GrillaWN_Tile_MoveFrom(object sender, TileEventArgs e) { //vectorSeleccionado = null; //tileSeleccionado = null; //Si hay vector azul, lo selecciono. Y selecciono el tile para moverlo vectorSeleccionado = this.MisVectores.BuscarVectorByCR(e.Tile.Col, e.Tile.Row); if (vectorSeleccionado != null) { if (tileSeleccionado != null) { tileSeleccionado.MostrarTileEnGrilla(); } int Indice = vectorSeleccionado.BuscarTile(e.Tile.Col, e.Tile.Row); tileSeleccionado = vectorSeleccionado[Indice]; tileSeleccionado.MostrarEnColor(Color.DarkBlue); //this.execMensaje(sender, e, s + " Seleccionado despues= " + tileSeleccionado.ToString(), 0); } }
void OnTouchEffectAction(object sender, TouchActionEventArgs args) { EventHandler <TileEventArgs> handler; switch (args.Type) { case TouchActionType.Pressed: T.Stop(); TileView_Seleccionado = (TilesView)this.GetTilesViewByXY(args.Location.X, args.Location.Y); if (TileView_Seleccionado != null) { T = new Timer(TimeSpan.FromSeconds(3), () => ClickLento_TimeOut(sender, args, "TOut ")); T.Start(); /* Esta parte genera el eveno MoveFrom */ TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact); tArgs.Tile = TileView_Seleccionado; if (EventStatus != EnumEstadoEvento.Click) { handler = Tile_MoveFrom; if (handler != null) { EventStatus = EnumEstadoEvento.MoveFrom; handler(this, tArgs); } } else { EventStatus = EnumEstadoEvento.DobleClick; } } break; case TouchActionType.Moved: if (TileView_Seleccionado != null) { TilesView cuadro_Actual = this.GetTilesViewByXY(args.Location.X, args.Location.Y); if ((cuadro_Actual.Col != -1) || (cuadro_Actual.Row != -1)) { if ((!TileView_Seleccionado.MismaUbicacion(cuadro_Actual)) && ((EventStatus == EnumEstadoEvento.MoveTo) || (EventStatus == EnumEstadoEvento.MoveFrom))) { T.Stop(); TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact); tArgs.Tile = TileView_Seleccionado; tArgs.MovioA_Col = cuadro_Actual.Col; tArgs.MovioA_Row = cuadro_Actual.Row; TileView_Seleccionado = cuadro_Actual; EventStatus = EnumEstadoEvento.MoveTo; handler = Tile_MoveTo; if (handler != null) { handler(this, tArgs); } } } } break; case TouchActionType.Released: if (TileView_Seleccionado != null) { T.Stop(); T_DC.Stop(); if (EventStatus == EnumEstadoEvento.MoveFrom) { T_DC = new Timer(TimeSpan.FromSeconds(1), () => Click_TimeOut(sender, args, "TOut ")); T_DC.Start(); EventStatus = EnumEstadoEvento.Click; } if (EventStatus == EnumEstadoEvento.DobleClick) { handler = Tile_DobleClick; if (handler != null) { TileEventArgs tArgs = new TileEventArgs(args.Id, args.Type, args.Location, args.IsInContact); tArgs.Tile = TileView_Seleccionado; EventStatus = EnumEstadoEvento.Nulo; handler(this, tArgs); } } if (EventStatus == EnumEstadoEvento.MoveTo) { TileView_Seleccionado = null; EventStatus = EnumEstadoEvento.Nulo; } } break; } }