Beispiel #1
0
        public void RejectButtonHit()
        {
            if (_arrowPanelOut)
            {
                HideArrows();
                return;
            }

            _trade.RejectTrade(_playerController);
        }
Beispiel #2
0
        private void OnTradeBtn(Button b, TradeActions action, Direction counterOffer)
        {
            PlayerTrade playerTrade = null;

            foreach (KeyValuePair <PlayerTrade, Button> valuePair in _incomingTradeDictionary)
            {
                if (valuePair.Value == b)
                {
                    playerTrade = valuePair.Key;
                }
            }

            foreach (KeyValuePair <PlayerTrade, Button> valuePair in _outgoingTradeDictionary)
            {
                if (valuePair.Value == b)
                {
                    playerTrade = valuePair.Key;
                }
            }

            if (playerTrade == null)
            {
                throw new Exception("We got a problem bois...");
            }


            switch (action)
            {
            case TradeActions.TradeRejected:
                playerTrade.RejectTrade(_playerController);
                break;

            case TradeActions.TradeAccepted:
                playerTrade.AcceptTrade(counterOffer, _playerController);
                break;

            case TradeActions.TradeCanceled:
                playerTrade.CancelTrade(_playerController.playerTag);
                break;

            case TradeActions.TradeCanceledByGameHandler:
                playerTrade.CancelTrade(GameHandler.Current);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }
        }