/// <summary> /// When overridden in the derived class, allows for handling the <see cref="ClientPeerTradeInfoHandlerBase{TChar,TItem,TItemInfo}.TradeCanceled"/> event. /// </summary> /// <param name="sourceCanceled">If it was the source character who canceled the trade.</param> protected override void OnTradeCanceled(bool sourceCanceled) { base.OnTradeCanceled(sourceCanceled); // Display the cancel message, using the appropriate one for if we were the one to cancel the trade if ((sourceCanceled && UserIsSource) || (!sourceCanceled && !UserIsSource)) { // We canceled if (GameMessageCallback != null) { GameMessageCallback.Raise(this, new ClientPeerTradeInfoHandlerEventArgs(GameMessage.PeerTradingTradeCanceledByYou, new string[] { OtherCharName })); } } else { // They canceled if (GameMessageCallback != null) { GameMessageCallback.Raise(this, new ClientPeerTradeInfoHandlerEventArgs(GameMessage.PeerTradingTradeCanceledByOther, new string[] { OtherCharName })); } } }
/// <summary> /// When overridden in the derived class, allows for handling the /// <see cref="ClientPeerTradeInfoHandlerBase{TChar,TItem,TItemInfo}.TradeOpened"/> event. /// </summary> protected override void OnTradeOpened() { base.OnTradeOpened(); if (GameMessageCallback != null) { GameMessageCallback.Raise(this, new ClientPeerTradeInfoHandlerEventArgs(GameMessage.PeerTradingTradeOpened, new string[] { OtherCharName })); } }
public void RegisterHandler(byte _handlerType, GameMessageCallback _cb) { GameMessageCallback cb; if (m_MessageCallbacksHandler.TryGetValue(_handlerType, out cb)) { m_MessageCallbacksHandler[_handlerType] = cb + _cb; } else { m_MessageCallbacksHandler.Add(_handlerType, _cb); } }