Exemplo n.º 1
0
        private void DefaultMouseHandler(MouseEventArgs m)
        {
            Vector click = new Vector(m.X, m.Y);
            var    item  = playerItemsView.GetItem(click);

            if (item != null)
            {
                item.SellFrom(Form1.player);
                playerItemsView.RemoveItem(item);
            }
            else
            {
                item = shopItemsView.GetItem(click);
                if (item != null)
                {
                    if (Form1.player.Gold > item.Price)
                    {
                        Form1.player.Gold -= item.Price;
                        item.AddToInventory(Form1.player);
                        shopItemsView.RemoveItem(item);
                    }
                }
            }
            playerGold.Text = "Gold: " + Form1.player.Gold.ToString();
            if (exit.IsPressed(click))
            {
                Finished(true);
            }
        }
Exemplo n.º 2
0
        public void HandlePlayer_Mouse(System.Windows.Forms.MouseEventArgs m)
        {
            var item = playerEquipables.GetItem(new Vector(m.X, m.Y));

            if (item != null)
            {
                ((IEquipable)item).EquipOn(player);
                RefreshView();
            }
            else if (exit.IsPressed(new Vector(m.X, m.Y)))
            {
                Finished(true);
            }
        }
Exemplo n.º 3
0
        public void HandlePlayer_Mouse(System.Windows.Forms.MouseEventArgs m)
        {
            Vector where = new Vector(m.X, m.Y);
            var assembly = assemblies
                           .Where(kvp => kvp.Key.IsPressed(where))
                           .Where(kvp => kvp.Value.CanAssembly(player))
                           .FirstOrDefault();

            if (assembly.Value != null)
            {
                assembly.Value.Assembly(player);
                playerView = new EquipmentView();
                playerView.SetForScrap(player, 400);
            }

            if (exit.IsPressed(where))
            {
                Finished(true);
            }
        }