コード例 #1
0
        private void autoSell(OwnedGum gum)
        {
            MarketGum mGum = _game.CurrentCity.FindGum(gum);

            _game.Player.SellGum(mGum, gum.Quantity);
            outputGameState();
        }
コード例 #2
0
ファイル: BuySellForm.cs プロジェクト: timclaason/GumWars
        public BuySellForm(MarketGum gum, Player player, Actions action)
        {
            _gum    = gum;
            _player = player;

            if (action == Actions.Buy || action == Actions.Sell)
            {
                double affordAmount = player.Money / (double)gum.CurrentPrice;
                _afford = (int)Math.Floor(affordAmount);
            }

            _action = action;
            InitializeComponent();
        }
コード例 #3
0
        private void showSellForm(OwnedGum gum)
        {
            MarketGum marketGum = _game.CurrentCity.FindGum(gum);

            if (marketGum == null)
            {
                return;
            }

            if (gum != null)
            {
                BuySellForm buySellForm = new BuySellForm(marketGum, _game.Player, Actions.Sell);
                buySellForm.ShowDialog(this);
                outputGameState();
            }
        }
コード例 #4
0
        private void doubleClickMarketRow(int rowNumber)
        {
            if (_game.DaysLeft == 0)
            {
                MessageBox.Show("You cannot buy when there are 0 days left");
                return;
            }

            foreach (DataGridViewRow row in _grdMarket.Rows)
            {
                if (row.Index != rowNumber)
                {
                    continue;
                }
                MarketGum gum = row.DataBoundItem as MarketGum;
                if (gum != null)
                {
                    BuySellForm buySellForm = new BuySellForm(gum, _game.Player, Actions.Buy);
                    buySellForm.ShowDialog(this);
                    outputGameState();
                }
            }
        }