Exemplo n.º 1
0
    // when this behavior is used, enemies will queue a teleport on Turn 1, then teleport to a tile as far away from allies as possible.
    // this will not trigger in fear, and thus the edges of the grid will not enable the enemy to escape

    public override Dictionary <TileAction, double> ScoreGrid(GameObject[,] grid)
    {
        tiles = GridUtils.FlattenGridTiles(grid, true).Where(tile => tile.gameObject.activeInHierarchy).ToList();

        // find all valid targets that could do damage to this entity
        var targets = BehaviorUtils.GetAllEntitiesInTileList(tiles, BehaviorUtils.Hostility.FRIENDLY).Where(target => target.currentHP > 0);

        // get all the tiles that the targets can move to attack the aiEntity
        var targetRanges = targets.SelectMany(target => GridUtils.GenerateTileRing(grid, target.range + target.maxMoves, target.tile)).ToList();

        // get tiles that are valid to move to in this turn (all tiles that are not currently occupied)
        var nextTurnRange = tiles.Where(tile => tile.occupier == null).ToList();

        var edgeTiles = GridUtils.GetEdgesOfEnabledGrid(grid);

        // score each tile in valid teleport range to avoid range of targets
        var nextMoveMap = new Dictionary <TileAction, double>();

        nextTurnRange.ForEach(tile => {
            double score = targetRanges.Select(attackTile => {
                // score is first determined as inversely related to the distance to the attack range of allies
                double dist = Mathf.Abs(tile.x - attackTile.x) + Mathf.Abs(tile.y - attackTile.y) + 1;
                return(1 / dist);
            }).Sum();

            if (entity.currentHP == entity.maxHP)
            {
                // clamp to avoid being picked at high health
                score = double.MaxValue;
            }
            else
            {
                // boost when health is lower
                // this value will always be between 0 and 1, and will "boost" properly
                score *= (double)entity.currentHP / (double)entity.maxHP;
            }


            if (entity.lastSelectedBehavior is EvasiveTeleport)
            {
                // improve chance this behavior is picked. uses - instead of * in order to keep order of scoring per tile
                score -= 1;
            }
            nextMoveMap[new TileAction(tile, entity)] = score;
        });
        return(nextMoveMap);
    }
Exemplo n.º 2
0
    private void HandleTogglingUnit()
    {
        Vector3 mouseVector3 = GridUtils.GetMouseWorldPosition(Input.mousePosition);

        mouseVector3.z = 0;
        int mouseX, mouseY;

        _grid.GetCellPosition(mouseVector3, out mouseX, out mouseY);
        if (IsAlive() && IsUnitTurn(true) && !IsActive() && IsUnitClicked(mouseX, mouseY))
        {
            EndAction(ActionType.Activation);
        }
        else if (IsAlive() && IsUnitTurn() && IsActive() && IsUnitClicked(mouseX, mouseY))
        {
            EndAction(ActionType.Deactivation);
        }
    }
Exemplo n.º 3
0
        protected override void CreateHeaderTemplate(C1GridViewRow row)
        {
            if (row == null)
            {
                return;
            }

            var chk = row.FindControl("chkSelectAll") as CheckBox;

            if (chk == null)
            {
                GridUtils.GetCell(row, ReferenciaGeograficaVo.IndexCheck).Controls.Add(chk = new CheckBox {
                    ID = "chkSelectAll", AutoPostBack = true
                });
            }
            chk.CheckedChanged += ChkSelectAllCheckedChanged;
        }
Exemplo n.º 4
0
    private void HandleHoveringUnit()
    {
        Vector3 mouseVector3 = GridUtils.GetMouseWorldPosition(Input.mousePosition);

        mouseVector3.z = 0;
        int mouseX, mouseY;

        _grid.GetCellPosition(mouseVector3, out mouseX, out mouseY);

        bool isCellOccupied = (mouseX < _grid.GetGridWidth() && mouseY < _grid.GetGridHeight() && mouseX >= 0 && mouseY >= 0) && _grid.GetCell(mouseX, mouseY).GetPathNode().isOccupied;

        if (!IsActive() && mouseX == GetUnitXPosition() && mouseY == GetUnitYPosition() && !_isUnitHovered)
        {
            _isUnitHovered = true;
            _healtbar.SetSliderVisbility(true);

            if (!Turn.IsFirstUnitInTurnSelected())
            {
                ShowRangesOnHover();
                _unitListPanel.OnHoverUnit(this);
            }

            if (Turn.IsFirstUnitInTurnSelected() && !Turn.IsUnitTurn(GetStatistics().team))
            {
                _unitListPanel.OnHoverUnit(this);
            }
        }
        else if (!IsActive() && (mouseX != GetUnitXPosition() || mouseY != GetUnitYPosition()) && _isUnitHovered)
        {
            _isUnitHovered = false;
            _healtbar.SetSliderVisbility(false);

            if (!Turn.IsFirstUnitInTurnSelected() && !isCellOccupied)
            {
                Debug.Log("HANDLE HOVERING 7:" + mouseX + "-" + mouseY);

                _grid.HideRange();
                _unitListPanel.OnHoverOutUnit();
            }

            if (!isCellOccupied && !Turn.IsUnitTurn(GetStatistics().team))
            {
                _unitListPanel.OnHoverOutUnit();
            }
        }
    }
Exemplo n.º 5
0
 /// <summary>
 /// Displays the current actions behaivour with representative icons.
 /// </summary>
 /// <param name="e"></param>
 /// <param name="accion"></param>
 private void SetBehaivoursIcons(C1GridViewRowEventArgs e, AccionVo accion)
 {
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexGrabaEnBase).FindControl("imgGrabaEnBase")).ImageUrl               = accion.GrabaEnBase ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexCambiaMensaje).FindControl("imgCambiaMensaje")).ImageUrl           = accion.CambiaMensaje ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexEsPopUp).FindControl("imgEsPopUp")).ImageUrl                       = accion.EsPopUp ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexRequiereAtencion).FindControl("imgRequiereAtencion")).ImageUrl     = accion.RequiereAtencion ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexEsAlarmaSonora).FindControl("imgEsAlarmaSonora")).ImageUrl         = accion.EsAlarmaSonora ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexEnviaMails).FindControl("imgEnviaMails")).ImageUrl                 = accion.EsAlarmaDeMail ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexEnviaSms).FindControl("imgEnviaSms")).ImageUrl                     = accion.EsAlarmaSms ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexHabilitaUsuario).FindControl("imgHabilitaUsuario")).ImageUrl       = accion.Habilita ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexInHabilitaUsuario).FindControl("imgInhabilitaUsuario")).ImageUrl   = accion.Inhabilita ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexModificaIcono).FindControl("imgModificaIcono")).ImageUrl           = accion.ModificaIcono ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexPideFoto).FindControl("imgPideFoto")).ImageUrl                     = accion.PideFoto ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexEvaluaGeocerca).FindControl("imgEvaluaGeocerca")).ImageUrl         = accion.EvaluaGeocerca ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexReportaAssistCargo).FindControl("imgReportaAssistCargo")).ImageUrl = accion.ReportaAssistCargo ? TrueIcon : FalseIcon;
     ((Image)GridUtils.GetCell(e.Row, AccionVo.IndexEnviaReporte).FindControl("imgEnviaReporte")).ImageUrl             = accion.EnviaReporte ? TrueIcon : FalseIcon;
 }
Exemplo n.º 6
0
    /**
     * from Active grid...
     * currently souces from Active grid ... TBD if this will remain this way.... that is, returning a single Vector2 datum despite
     * the richness of wanting to know BOTH layer index AND cell position ... hmm.
     */
    public Vector2?GetCellPositionActiveOf(Sprite sprite)
    {
        GameObject children = this.gridActive;

        foreach (Transform child in children.transform)
        {
            SpriteRenderer sr          = child.GetComponent <SpriteRenderer>();
            Sprite         childSprite = sr.sprite;

            if (childSprite == sprite)
            {
                int index = child.GetSiblingIndex();
                Vector2 where = GridUtils.GetIndexAs2Dfrom1D(index);
                return(where);
            }
        }
        return(null);
    }
Exemplo n.º 7
0
        /// <summary>
        /// Shows the selected route fragment in the historic monitor or aletrs of any error situation.
        /// </summary>
        private void ShowSelectedRouteDetails()
        {
            var salida  = GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexSalida).Text + ' ' + GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexSalidaHora).Text;
            var entrada = GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexEntrada).Text + ' ' + GridUtils.GetCell(Grid.SelectedRow, MobileTourVo.IndexEntradaHora).Text;

            try
            {
                Convert.ToDateTime(salida);
                Convert.ToDateTime(entrada);
            }
            catch
            {
                ShowErrorPopup(CultureManager.GetSystemMessage("NO_GEOCERCA_INFO"));
                return;
            }

            ShowRouteDetails(salida, entrada);
        }
Exemplo n.º 8
0
        protected virtual void SendReportToMail()
        {
            var path = HttpContext.Current.Request.Url.AbsolutePath;

            path = Path.GetFileNameWithoutExtension(path) + ".xlsx";

            var builder = new GridToExcelBuilder(path, Usuario.ExcelFolder);

            var list = GridUtils.Search(Data, SearchString);

            builder.GenerateHeader(CultureManager.GetMenu(VariableName), new Dictionary <string, string>());
            builder.GenerateColumns(list);
            builder.GenerateFields(list);

            SetExcelSessionVars(builder.CloseAndSave());

            OpenWin(String.Concat(ApplicationPath, "Common/exportExcel.aspx"), CultureManager.GetSystemMessage("EXPORT_CSV_DATA"));
        }
Exemplo n.º 9
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, RankingTransportistasVo dataItem)
        {
            e.Row.Attributes.Remove("onclick");
            e.Row.Attributes.Add("cursor", "arrow");

            if (dataItem == null)
            {
                return;
            }

            GridUtils.GetCell(e.Row, RankingTransportistasVo.IndexPuntaje).BackColor    = GetColor(Convert.ToDouble(GridUtils.GetCell(e.Row, RankingTransportistasVo.IndexPuntaje).Text));
            GridUtils.GetCell(e.Row, RankingTransportistasVo.IndexKilometros).Text      = String.Format("{0:0.00}", dataItem.Kilometros);
            GridUtils.GetCell(e.Row, RankingTransportistasVo.IndexHorasMovimiento).Text = string.Format(CultureManager.GetLabel("MOVIMIENTO_SIN_EVENTOS"),
                                                                                                        dataItem.HorasMovimiento.Days,
                                                                                                        dataItem.HorasMovimiento.Hours,
                                                                                                        dataItem.HorasMovimiento.Minutes,
                                                                                                        dataItem.HorasMovimiento.Seconds);
        }
Exemplo n.º 10
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, SupportTicketVo ticket)
        {
            base.OnRowDataBound(grid, e, ticket);

            e.Row.BackColor = DAOFactory.SupportTicketDAO.GetColoresEstados()[ticket.CurrentState];

            GridUtils.GetCell(e.Row, SupportTicketVo.IndexFecha).Text        = ticket.Fecha.ToString("dd/MM/yyyy HH:mm");
            GridUtils.GetCell(e.Row, SupportTicketVo.IndexCurrentState).Text = DAOFactory.SupportTicketDAO.GetEstados()[ticket.CurrentState];

            var problema = DAOFactory.SupportTicketDAO.GetTiposProblema()[ticket.TipoProblema];

            problema += ": " + DAOFactory.SupportTicketDAO.GetCategoriasProblemaByTipo(ticket.TipoProblema)[ticket.Categoria < 0 ? 0 : ticket.Categoria];

            var desc = ticket.Descripcion.Length > 20 ? ticket.Descripcion.Substring(0, 20) + "..." : ticket.Descripcion;

            GridUtils.GetCell(e.Row, SupportTicketVo.IndexDescripcion).Text  = desc;
            GridUtils.GetCell(e.Row, SupportTicketVo.IndexTipoProblema).Text = problema;
        }
Exemplo n.º 11
0
        private void RotateToMouseDirection()
        {
            Ray     ray       = CameraManager.Instance.MainCamera.ScreenPointToRay(ControlManager.Instance.Battle_MousePosition);
            Vector3 intersect = GridUtils.GetIntersectWithLineAndPlane(ray.origin, ray.direction, Vector3.up, transform.position);

            Vector3 diff       = intersect - transform.position;
            float   nearFactor = 3f / (diff).magnitude;

            Quaternion rotation = Quaternion.LookRotation(diff);

            if (Mathf.Abs((rotation.eulerAngles - lastRotationByMouse.eulerAngles).magnitude) < 0.5f * nearFactor)
            {
                rotation = transform.rotation;
            }

            lastRotationByMouse = transform.rotation;
            transform.rotation  = Quaternion.Lerp(transform.rotation, rotation, Time.deltaTime * diff.magnitude * 3f);
        }
Exemplo n.º 12
0
        protected override void CreateRowTemplate(C1GridViewRow row)
        {
            var cellAjuste = GridUtils.GetCell(row, ConsolaTicketsVo.Index.Ajuste);
            var lnkAjuste  = cellAjuste.FindControl("lnkAjuste") as ResourceLinkButton;

            if (lnkAjuste == null)
            {
                lnkAjuste = new ResourceLinkButton
                {
                    ResourceName     = "Labels",
                    ID               = "lnkAjuste",
                    CommandName      = "TicketAjuste",
                    VariableName     = "Crear Ticket Ajuste",
                    CausesValidation = false
                };
                cellAjuste.Controls.Add(lnkAjuste);
            }
        }
Exemplo n.º 13
0
        public void OnSceneGUITest(SceneView sceneView)
        {
            if (target == null)
            {
#if UNITY_2019_1_OR_NEWER
                SceneView.duringSceneGui -= OnSceneGUITest;
#else
                SceneView.onSceneGUIDelegate -= OnSceneGUITest;
#endif
                return;
            }

            if (PrefabStageUtility.GetCurrentPrefabStage() == null)
            {
#if UNITY_2019_1_OR_NEWER
                SceneView.duringSceneGui -= OnSceneGUITest;
#else
                SceneView.onSceneGUIDelegate -= OnSceneGUITest;
#endif
                return;
            }

            try
            {
                var roomTemplate = (RoomTemplateSettings)target;
                var outline      = roomTemplate.GetOutline();

                if (outline == null)
                {
                    return;
                }

                var points = outline.GetPoints();
                var grid   = roomTemplate.GetComponentInChildren <Grid>();

                for (int i = 0; i < points.Count; i++)
                {
                    GridUtils.DrawRectangleOutline(grid, points[i].ToUnityIntVector3(), points[(i + 1) % points.Count].ToUnityIntVector3(), Color.yellow);
                }
            }
            catch (ArgumentException)
            {
            }
        }
Exemplo n.º 14
0
    public override bool DoBestAction(TilemapComponent tilemap, State currentState)
    {
        Debug.Log(String.Format("{0} chose to do {1} with score of {2}", entity, "RangedAttackV1", bestAction.Value));

        if (bestAction.Key.tile != entity.tile)
        {
            tilemap.MoveEntity(entity.tile, bestAction.Key.tile);
        }

        var attackRange = GridUtils.GenerateTileCircle(tilemap.grid, entity.range, entity.tile).ToList();

        if (attackRange.Contains(bestTarget.tile))
        {
            entity.MakeAttack(bestTarget);
            Debug.Log(String.Format("{0} chose to do {1} with score of {2} against {3}", entity, "RangedAttackV1", bestAction.Value, bestTarget));
        }

        return(true);
    }
Exemplo n.º 15
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, ReporteTicketVo dataItem)
        {
            e.Row.Attributes.Remove("onclick");

            var celda = GridUtils.GetCell(e.Row, ReporteTicketVo.IndexId);
            var id    = celda.Text;

            celda.Controls.Clear();
            var lnk = new LinkButton
            {
                ID            = id,
                ForeColor     = Color.Black,
                Text          = id,
                OnClientClick = "javascript:window.open('" + RedirectUrl + "?id=" + id + "', 'ticket'); return false;"
            };

            lnk.Font.Bold = true;
            celda.Controls.Add(lnk);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Calls the historic monitor with the appropiate filter values for displaying the current event.
        /// </summary>
        private void DisplayEvent()
        {
            var id = Convert.ToInt32(Grid.SelectedDataKey[0]);

            var eventTime = Convert.ToDateTime(GridUtils.GetCell(Grid.SelectedRow, MobileRouteEventVo.IndexEventTime).Text);
            var duration  = Convert.ToDateTime(GridUtils.GetCell(Grid.SelectedRow, MobileRouteEventVo.IndexDuration).Text).TimeOfDay.TotalMinutes;

            Session.Add("Distrito", District);
            Session.Add("Location", Location);
            Session.Add("TypeMobile", MobileType);
            Session.Add("Mobile", Mobile);
            Session.Add("InitialDate", eventTime.AddMinutes(-5));
            Session.Add("FinalDate", eventTime.AddMinutes(5 + duration));
            Session.Add("MessageCenterIndex", id);
            Session.Add("ShowMessages", 0);
            Session.Add("ShowPOIS", 0);

            OpenWin(String.Concat(ApplicationPath, "Monitor/MonitorHistorico/monitorHistorico.aspx"), "Monitor Historico");
        }
Exemplo n.º 17
0
        public void OnBeginDrag(PointerEventData eventData)
        {
            _isGrabbedFromTarget = eventData.hovered.Contains(targetMap.gameObject);
            _grabCell            = GridUtils.ScreenToCell(eventData.position, sceneCamera, _grid, rules.areaSize);
            _sprite = _selfGridSpriteMapper.GetSpriteAt(ref _grabCell);
            var grabPoint = transform.position + _grabCell + new Vector3(0.5f, 0.5f, 0);

            _grabOffset = grabPoint - GetWorldPoint(eventData.position);
            if (!_sprite)
            {
                return;
            }
            _grabbedShip = Instantiate(dragShipPrefab, _grabCell, Quaternion.identity);
            _grabbedShip.GetComponent <SpriteRenderer>().sprite = _sprite;
            if (removeFromSource)
            {
                sourceTileMap.SetTile(_grabCell, null);
            }
        }
Exemplo n.º 18
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, MobileUtilizationVo dataItem)
        {
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexHsTurno).Text         = string.Format("{0:0.00} hs", dataItem.HsTurno);
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexHsEsperadas).Text     = string.Format("{0:0.00} hs", dataItem.HsEsperadas);
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexHsTurnoReales).Text   = string.Format("{0:0.00} hs", dataItem.HsTurnoReales);
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexPorcentajeTurno).Text = string.Format("{0:0.00} %", dataItem.PorcentajeTurno);

            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexHsFueraTurno).Text         = string.Format("{0:0.00} hs", dataItem.HsFueraTurno);
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexHsRealesFueraTurno).Text   = string.Format("{0:0.00} hs", dataItem.HsRealesFueraTurno);
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexPorcentajeFueraTurno).Text = string.Format("{0:0.00} %", dataItem.PorcentajeFueraTurno);

            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexPorcentajeProd).Text       = string.Format("{0:0.00} %", dataItem.PorcentajeProd);
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexPorcentajeFueraTurno).Text = string.Format("{0:0.00} %", dataItem.MovFueraTurno);
            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexPorcentajeTotal).Text      = string.Format("{0:0.00} %", dataItem.PorcentajeTotal);

            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexPorcentajeProd).BackColor = Convert.ToDouble(GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexPorcentajeProd).Text.TrimEnd('%')) >= 0 ? Color.LightGreen : Color.Red;

            GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexHsFueraTurno).BackColor = Convert.ToDouble(GridUtils.GetCell(e.Row, MobileUtilizationVo.IndexHsFueraTurno).Text.TrimEnd('%')) < 0.01 ? Color.LightGreen : Color.Red;
        }
Exemplo n.º 19
0
        //protected abstract bool SendReportButton { get; }

        #endregion

        #region Page Event

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            GridUtils = new GridUtils <T>(Grid, this);
            GridUtils.GenerateCustomColumns += GridUtils_GenerateCustomColumns;
            GridUtils.CreateRowTemplate     += GridUtils_CreateRowTemplate;
            GridUtils.RowDataBound          += GridUtils_RowDataBound;
            GridUtils.SelectedIndexChanged  += GridUtils_SelectedIndexChanged;
            GridUtils.Binding += GridUtils_Binding;
            GridUtils.AggregateCustomFormat += GridUtils_AggregateCustomFormat;
            if (ScheduleButton)
            {
                BtScheduleGuardar.Click += BtScheduleGuardarClick;
            }
            if (SendReportButton)
            {
                SendReportOkButton.Click += ButtonOkSendReportClick;
            }
        }
Exemplo n.º 20
0
        protected override void CreateRowTemplate(C1GridViewRow row)
        {
            var idEntrada      = Grid.DataKeys[row.RowIndex].Values[FichadaVo.IndexKeyIdEntrada].ToString();
            var cellEntrada    = row.Cells[GridUtils.GetColumnIndex(FichadaVo.IndexHoraEntrada)];
            var entradaDeleted = Convert.ToBoolean(Grid.DataKeys[row.RowIndex].Values[FichadaVo.IndexKeyEntradaDeleted]);
            var entradaEdited  = Convert.ToBoolean(Grid.DataKeys[row.RowIndex].Values[FichadaVo.IndexKeyEntradaEdited]);

            CellEdit(cellEntrada, idEntrada, true, entradaDeleted, entradaEdited);

            var idSalida      = Grid.DataKeys[row.RowIndex].Values[FichadaVo.IndexKeyIdSalida].ToString();
            var cellSalida    = row.Cells[GridUtils.GetColumnIndex(FichadaVo.IndexHoraSalida)];
            var salidaDeleted = Convert.ToBoolean(Grid.DataKeys[row.RowIndex].Values[FichadaVo.IndexKeySalidaDeleted]);
            var salidaEdited  = Convert.ToBoolean(Grid.DataKeys[row.RowIndex].Values[FichadaVo.IndexKeySalidaEdited]);

            CellEdit(cellSalida, idSalida, false, salidaDeleted, salidaEdited);

            var cellEdit = row.Cells[GridUtils.GetColumnIndex(FichadaVo.IndexEdit)];

            EditButton(cellEdit, idEntrada, idSalida);
        }
Exemplo n.º 21
0
    private void Update()
    {
        if (isMoving)
        {
            float step      = moveSpeed * Time.deltaTime; // calculate distance to move
            var   targetPos = GridUtils.GetWorldPos(nextMove.pos);
            transform.position = Vector3.MoveTowards(transform.position, targetPos, step);

            float dist = Vector3.Distance(transform.position, targetPos);
            if (dist < Mathf.Epsilon)
            {
                nextMove = nextMove.parent;

                if (nextMove == null)
                {
                    isMoving = false;
                }
            }
        }
    }
Exemplo n.º 22
0
        static void DisplayPathtoPrincess(int n, char[,] grid, DiscretePoint bot, DiscretePoint princess)
        {
            List <Directions> directionses = new List <Directions>();
            Directions        dir;

            do
            {
                dir = GridUtils.GetBotDirection(bot, princess);
                if (dir != Directions.Stop)
                {
                    directionses.Add(dir);
                }
                bot.Move(dir);
            }while (dir != Directions.Stop);

            foreach (var directionse in directionses)
            {
                Console.WriteLine(directionse.ToString().ToUpper());
            }
        }
Exemplo n.º 23
0
        public override string NextStep(char[,] grid, DiscretePoint bot)
        {
            DiscretePoint dirty = null;

            dirty = FindNextClosestDirty(grid, bot);
            if (dirty != null)
            {
                var dir = GridUtils.GetBotDirection(bot, dirty);
                if (dir != Directions.Stop)
                {
                    return(dir.ToString().ToUpper());
                }
                else
                {
                    return("CLEAN");
                }
            }

            return(null);
        }
Exemplo n.º 24
0
        public void LocalPositionToGridTest()
        {
            float size = 2.5f;

            var gridPositionZero = new Vector(0, 0, 0);
            var gridPositionOne  = new Vector(size, 0, size);
            var gridPositionFive = new Vector(5 * size, 0, 5 * size);

            var localPositionZero = GridUtils.LocalPositionToGrid(gridPositionZero, size);

            Assert.That(localPositionZero == new Vector(), () => $"Expected {new Vector()} but got {localPositionZero}");

            var localPositionOne = GridUtils.LocalPositionToGrid(gridPositionOne, size);

            Assert.That(localPositionOne == new Vector(1, 1), () => $"Expected {new Vector(1, 1)} but got {localPositionOne}");

            var localPositionFive = GridUtils.LocalPositionToGrid(gridPositionFive, size);
            var result            = new Vector((int)Math.Round(gridPositionFive.X / size), (int)Math.Round(gridPositionFive.Z / size));

            Assert.That(localPositionFive == result, () => $"Expected {result} but got {localPositionFive}");
        }
Exemplo n.º 25
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, ReporteVencimientoVo dataItem)
        {
            var data = SearchData.Load(ViewState);

            if (dataItem.DiasAlVencimiento == 9999)
            {
                GridUtils.GetCell(e.Row, ReporteVencimientoVo.IndexDiasAlVencimiento).Text = "";
            }
            else if (dataItem.DiasAlVencimiento < 0)
            {
                e.Row.BackColor = Color.Red;
            }
            else if (dataItem.DiasAlVencimiento < data.DiasAviso)
            {
                e.Row.BackColor = Color.Yellow;
            }
            else
            {
                e.Row.BackColor = Color.Green;
            }
        }
Exemplo n.º 26
0
            protected override void updateDisplayImpl()
            {
                HashSet <IMyCubeGrid> grids = new HashSet <IMyCubeGrid>();
                List <IMyMechanicalConnectionBlock> temp = new List <IMyMechanicalConnectionBlock>(16);

                GridUtils.findAllGrids(Program.Me.CubeGrid, grids, temp, Program.GridTerminalSystem);

                string s = "BLOCKS: " + _blocksCount + " (pending: " + _pendingBlocksCount + ")\nGrids: " + _blockIterator._grids.Count + "\n"
                           + "g=" + _blockIterator._currentGridIndex + "; cur=" + _blockIterator._cur;

                s += "\n";
                foreach (IMyCubeGrid g in grids)
                {
                    s += g + ":\n" + "    Min=" + g.Min + "\n" + "    Max=" + g.Max + "\n";
                }

                foreach (IMyTextPanel panel in _textPanels)
                {
                    panel.WriteText(s);
                }
            }
Exemplo n.º 27
0
        protected override void OnRowCommand(C1GridView grid, C1GridViewCommandEventArgs e)
        {
            if (e.CommandName == "TicketAjuste")
            {
                var id = Convert.ToInt32(Grid.DataKeys[e.Row.RowIndex].Value);
                IdPedido.Set(id);
                var cellCodigo  = GridUtils.GetCell(e.Row, ConsolaTicketsVo.Index.Codigo);
                var cellTickets = GridUtils.GetCell(e.Row, ConsolaTicketsVo.Index.Tickets);
                var cellM3      = GridUtils.GetCell(e.Row, ConsolaTicketsVo.Index.M3);
                var cellCliente = GridUtils.GetCell(e.Row, ConsolaTicketsVo.Index.Cliente);
                var cellPunto   = GridUtils.GetCell(e.Row, ConsolaTicketsVo.Index.PuntoEntrega);

                litAjustePedido.Text        = cellCodigo.Text;
                lblAjusteCliente.Text       = cellCliente.Text;
                lblAjustePuntoEntrega.Text  = cellPunto.Text;
                lblAjusteTickets.Text       = cellTickets.Text;
                lblAjusteM3.Text            = cellM3.Text;
                dtTicketAjuste.SelectedDate = DateTime.UtcNow.ToDisplayDateTime();
                modalPanel.Show();
            }
        }
Exemplo n.º 28
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, ConsolaTicketsVo dataItem)
        {
            var cellTickets = GridUtils.GetCell(e.Row, ConsolaTicketsVo.Index.Tickets);
            var cellM3      = GridUtils.GetCell(e.Row, ConsolaTicketsVo.Index.M3);

            var tickets    = DAOFactory.TicketDAO.GetByPedido(dataItem.Id);
            var total      = tickets.Count();
            var pendientes = tickets.Count(x => x.Estado == Ticket.Estados.Pendiente);

            cellTickets.Text = string.Format("<strong>{0}</strong> ({1} pendientes)", total, pendientes);

            double i;
            var    m3total     = double.TryParse(dataItem.Cantidad.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out i) ? i : 0;
            var    m3Pendiente = m3total - tickets
                                 .Where(x => double.TryParse(x.CantidadCargaReal.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out i))
                                 .Sum(x => Convert.ToDouble(x.CantidadCargaReal.Replace(',', '.'), CultureInfo.InvariantCulture));

            cellM3.Text = string.Format("<strong>{0:0.0}</strong> ({1:0.0} pendientes)", dataItem.Cantidad, m3Pendiente);

            CreateRowTemplate(e.Row);
        }
Exemplo n.º 29
0
        protected override void OnPreLoad(EventArgs e)
        {
            if (MasterPage.ToolBar != null)
            {
                AddToolBarIcons();
                MasterPage.ToolBar.ItemCommand += ToolbarItemCommand;
                MasterPage.ToolBar.ResourceName = ResourceName;
                MasterPage.ToolBar.VariableName = VariableName;
            }

            base.OnPreLoad(e);

            if (!IsPostBack)
            {
                GridUtils.GenerateColumns();
                if (!GridUtils.AnyIncludedInSearch || HideSearch)
                {
                    MasterPage.PanelSearch.Visible = false;
                }
            }
        }
Exemplo n.º 30
0
        void CompositionRoot(GameContext context)
        {
            _runner                = new GameRunner();
            _enginesRoot           = new EnginesRoot(_runner.SubmissionScheduler);
            _entityFactory         = _enginesRoot.GenerateEntityFactory();
            _entityFunctions       = _enginesRoot.GenerateEntityFunctions();
            _entityConsumerFactory = _enginesRoot.GenerateConsumerFactory();

            _gameObjectFactory = new GameObjectFactory();
            _gridUtils         = new GridUtils(context.GridDefinition);
            _seed = context.Seed == 0 ? (uint)Random.Range(int.MinValue, int.MinValue) : context.Seed;

            AddMatchEngines(context);
            AddGridEngines(context);
            AddShipEngines(context);
            AddPlayerEngines(context);
            AddAiEngines(context);
            AddCoinEngines(context);

            _runner.Play();
        }