Ejemplo n.º 1
0
        private void Request(NetMessageInfo info)
        {
            MapPlayer sender = _player.Server[info.Sender.Id];

            if (_trading)
            {
                sender.View?.FailedTrade();
                return;
            }
            else if (sender.Trade._requested && sender.Trade._target == _player)
            {
                _target = sender;
                m_state = new TradingState()
                {
                    InProgress = true,
                    ONE        = _player,
                    TWO        = sender,
                    ONE_Offer  = m_offer,
                    TWO_Offer  = sender.Trade.m_offer
                };
                sender.Trade.m_state = m_state;
                sender.Trade._regected.Destroy();
                sender.Trade._trading = _trading = true;
                UpdateState();
                return;
            }
            else if (!_requested)
            {
                _target    = sender;
                _requested = true;
                _view.RequestTrade(info.Sender.Id);
                _regected = new TradeRejector(_player, _target);
            }
        }