mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Notification Error Event (#108)
Co-authored-by: Snaiker <steveraki2000@gmail.com>
This commit is contained in:
parent
6dc2bbbf8c
commit
ae2f38c917
@ -1,4 +1,4 @@
|
|||||||
import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, ClubGiftNotificationEvent, ClubGiftSelectedEvent, HabboBroadcastMessageEvent, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, MaintenanceStatusMessageEvent, ModeratorCautionEvent, ModeratorMessageEvent, MOTDNotificationEvent, NotificationDialogMessageEvent, PetLevelNotificationEvent, PetReceivedMessageEvent, RespectReceivedEvent, RoomEnterEffect, RoomEnterEvent, UserBannedMessageEvent, Vector3d } from '@nitrots/nitro-renderer';
|
import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, ClubGiftNotificationEvent, ClubGiftSelectedEvent, ConnectionErrorEvent, HabboBroadcastMessageEvent, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, MaintenanceStatusMessageEvent, ModeratorCautionEvent, ModeratorMessageEvent, MOTDNotificationEvent, NotificationDialogMessageEvent, PetLevelNotificationEvent, PetReceivedMessageEvent, RespectReceivedEvent, RoomEnterEffect, RoomEnterEvent, UserBannedMessageEvent, Vector3d } from '@nitrots/nitro-renderer';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useBetween } from 'use-between';
|
import { useBetween } from 'use-between';
|
||||||
import { GetConfiguration, GetNitroInstance, GetRoomEngine, GetSessionDataManager, LocalizeBadgeName, LocalizeText, NotificationAlertItem, NotificationAlertType, NotificationBubbleItem, NotificationBubbleType, NotificationConfirmItem, PlaySound, ProductImageUtility, TradingNotificationType } from '../../api';
|
import { GetConfiguration, GetNitroInstance, GetRoomEngine, GetSessionDataManager, LocalizeBadgeName, LocalizeText, NotificationAlertItem, NotificationAlertType, NotificationBubbleItem, NotificationBubbleType, NotificationConfirmItem, PlaySound, ProductImageUtility, TradingNotificationType } from '../../api';
|
||||||
@ -352,6 +352,43 @@ const useNotificationState = () =>
|
|||||||
simpleAlert(LocalizeText('opening.hours.disconnected', [ 'h', 'm' ], [ parser.openHour.toString(), parser.openMinute.toString() ]), NotificationAlertType.DEFAULT, null, null, LocalizeText('opening.hours.title'));
|
simpleAlert(LocalizeText('opening.hours.disconnected', [ 'h', 'm' ], [ parser.openHour.toString(), parser.openMinute.toString() ]), NotificationAlertType.DEFAULT, null, null, LocalizeText('opening.hours.title'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useMessageEvent<ConnectionErrorEvent>(ConnectionErrorEvent, event =>
|
||||||
|
{
|
||||||
|
const parser = event.getParser();
|
||||||
|
|
||||||
|
switch(parser.errorCode)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case 0:
|
||||||
|
simpleAlert(LocalizeText('connection.server.error.desc', [ 'errorCode' ], [ parser.errorCode.toString() ]), NotificationAlertType.ALERT, null, null, LocalizeText('connection.server.error.title'));
|
||||||
|
break;
|
||||||
|
case 1001:
|
||||||
|
case 1002:
|
||||||
|
case 1003:
|
||||||
|
case 1004:
|
||||||
|
case 1005:
|
||||||
|
case 1006:
|
||||||
|
case 1007:
|
||||||
|
case 1008:
|
||||||
|
case 1009:
|
||||||
|
case 1010:
|
||||||
|
case 1011:
|
||||||
|
case 1012:
|
||||||
|
case 1013:
|
||||||
|
case 1014:
|
||||||
|
case 1015:
|
||||||
|
case 1016:
|
||||||
|
case 1017:
|
||||||
|
case 1018:
|
||||||
|
case 1019:
|
||||||
|
event.connection.dispose();
|
||||||
|
break;
|
||||||
|
case 4013:
|
||||||
|
simpleAlert(LocalizeText('connection.room.maintenance.desc'), NotificationAlertType.ALERT, null, null, LocalizeText('connection.room.maintenance.title'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const onRoomEnterEvent = useCallback(() =>
|
const onRoomEnterEvent = useCallback(() =>
|
||||||
{
|
{
|
||||||
if(modDisclaimerShown) return;
|
if(modDisclaimerShown) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user