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); } }
public void ResetState() { _regected?.Destroy(); m_state = null; _target = null; _trading = false; _regected = null; _requested = false; lock (_lock) m_offer.Clear(); }
private void TradeMgr_OnDestroy() { _regected?.Destroy(); if (_trading && _target.Trade._trading) { _target.Trade.Close(); } _view = null; m_offer = null; _target = null; _wPlayer = null; _player = null; _regected = null; }