private void UpdateCursorSourceRectangle(IMapCellState cellState)
        {
            _shouldDrawCursor = true;
            _cursorIndex      = CursorIndex.Standard;
            if (cellState.Character.HasValue || cellState.NPC.HasValue)
            {
                _cursorIndex = CursorIndex.HoverNormal;
            }
            else if (cellState.Sign.HasValue)
            {
                _shouldDrawCursor = false;
            }
            else if (cellState.Items.Any())
            {
                _cursorIndex = CursorIndex.HoverItem;
                UpdateMapItemLabel(new Optional <IItem>(cellState.Items.Last()));
            }
            else if (cellState.TileSpec != TileSpec.None)
            {
                UpdateCursorIndexForTileSpec(cellState.TileSpec);
            }

            if (!cellState.Items.Any())
            {
                UpdateMapItemLabel(Optional <IItem> .Empty);
            }
        }
Beispiel #2
0
        public void RightClick(IMapCellState cellState)
        {
            if (!cellState.Character.HasValue)
            {
                return;
            }

            //todo: context menu
        }
 private void CheckForClicks(MouseState currentMouseState, IMapCellState cellState)
 {
     if (currentMouseState.LeftButton == ButtonState.Released &&
         _previousMouseState.LeftButton == ButtonState.Pressed)
     {
         _mapInteractionController.LeftClick(cellState);
     }
     else if (currentMouseState.RightButton == ButtonState.Released &&
              _previousMouseState.RightButton == ButtonState.Pressed)
     {
         _mapInteractionController.RightClick(cellState);
     }
 }
Beispiel #4
0
        public void LeftClick(IMapCellState cellState)
        {
            var item = cellState.Items.OptionalFirst();

            if (item.HasValue)
            {
                if (!_inventorySpaceValidator.ItemFits(item.Value))
                {
                    _statusLabelSetter.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_INFORMATION, EOResourceID.STATUS_LABEL_ITEM_PICKUP_NO_SPACE_LEFT);
                }
                else
                {
                    HandlePickupResult(_mapActions.PickUpItem(item.Value), item.Value);
                }
            }
        }
Beispiel #5
0
        private void HandleWalkToTileSpec(IMapCellState cellState)
        {
            switch (cellState.TileSpec)
            {
            case TileSpec.ChairDown:     //todo: chairs
            case TileSpec.ChairLeft:
            case TileSpec.ChairRight:
            case TileSpec.ChairUp:
            case TileSpec.ChairDownRight:
            case TileSpec.ChairUpLeft:
            case TileSpec.ChairAll:
                break;

            case TileSpec.Chest:     //todo: chests
                //if (!walkValid)
                //{
                //    var chest = OldWorld.Instance.ActiveMapRenderer.MapRef.Chests.Single(_c => _c.X == destX && _c.Y == destY);
                //    if (chest != null)
                //    {
                //        string requiredKey = null;
                //        switch (Character.CanOpenChest(chest))
                //        {
                //            case ChestKey.Normal: requiredKey = "Normal Key"; break;
                //            case ChestKey.Silver: requiredKey = "Silver Key"; break;
                //            case ChestKey.Crystal: requiredKey = "Crystal Key"; break;
                //            case ChestKey.Wraith: requiredKey = "Wraith Key"; break;
                //            default:
                //                ChestDialog.Show(((EOGame)Game).API, (byte)chest.X, (byte)chest.Y);
                //                break;
                //        }

                //        if (requiredKey != null)
                //        {
                //            EOMessageBox.Show(DialogResourceID.CHEST_LOCKED, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                //            ((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING, EOResourceID.STATUS_LABEL_THE_CHEST_IS_LOCKED_EXCLAMATION,
                //                " - " + requiredKey);
                //        }
                //    }
                //    else
                //    {
                //        ChestDialog.Show(((EOGame)Game).API, destX, destY);
                //    }
                //}
                break;

            case TileSpec.BankVault:     //todo: locker
                //walkValid = Renderer.NoWall;
                //if (!walkValid)
                //{
                //    LockerDialog.Show(((EOGame)Game).API, destX, destY);
                //}
                break;

            case TileSpec.Board1:     //todo: boards
            case TileSpec.Board2:
            case TileSpec.Board3:
            case TileSpec.Board4:
            case TileSpec.Board5:
            case TileSpec.Board6:
            case TileSpec.Board7:
            case TileSpec.Board8:
                break;

            case TileSpec.Jukebox:     //todo: jukebox
                break;
            }
        }