This commit is contained in:
Bill 2021-07-08 04:26:04 -04:00
parent 7893de3a34
commit 2f96c83c44

View File

@ -1,6 +1,6 @@
import { IRoomSession, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomPreviewer, RoomSessionEvent, TradingCancelComposer, TradingCloseComposer, TradingOpenComposer } from 'nitro-renderer'; import { IRoomSession, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomPreviewer, RoomSessionEvent, TradingCancelComposer, TradingCloseComposer, TradingOpenComposer } from 'nitro-renderer';
import { FC, useCallback, useEffect, useReducer, useState } from 'react'; import { FC, useCallback, useEffect, useReducer, useState } from 'react';
import { GetConnection, GetRoomEngine } from '../../api'; import { GetRoomEngine } from '../../api';
import { InventoryEvent, InventoryTradeRequestEvent } from '../../events'; import { InventoryEvent, InventoryTradeRequestEvent } from '../../events';
import { useRoomEngineEvent } from '../../hooks/events/nitro/room/room-engine-event'; import { useRoomEngineEvent } from '../../hooks/events/nitro/room/room-engine-event';
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event'; import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
@ -45,7 +45,7 @@ export const InventoryView: FC<InventoryViewProps> = props =>
case TradeState.TRADING_STATE_RUNNING: case TradeState.TRADING_STATE_RUNNING:
SendMessageHook(new TradingCloseComposer()); SendMessageHook(new TradingCloseComposer());
return; return;
case TradeState.TRADING_STATE_CONFIRMING: default:
SendMessageHook(new TradingCancelComposer()); SendMessageHook(new TradingCancelComposer());
return; return;
} }
@ -81,7 +81,7 @@ export const InventoryView: FC<InventoryViewProps> = props =>
case InventoryTradeRequestEvent.REQUEST_TRADE: { case InventoryTradeRequestEvent.REQUEST_TRADE: {
const tradeEvent = (event as InventoryTradeRequestEvent); const tradeEvent = (event as InventoryTradeRequestEvent);
GetConnection().send(new TradingOpenComposer(tradeEvent.objectId)); SendMessageHook(new TradingOpenComposer(tradeEvent.objectId));
} }
} }
}, [ isVisible, close ]); }, [ isVisible, close ]);