This commit is contained in:
dank074 2022-06-17 21:13:28 -05:00
parent 9d94443a95
commit ebd88e491d
2 changed files with 34 additions and 32 deletions

View File

@ -30,7 +30,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
NotificationUtilities.simpleAlert(LocalizeText(`navigator.cannotcreateevent.error.${ parser.errorCode }`), null, null, null, LocalizeText('navigator.cannotcreateevent.title')); NotificationUtilities.simpleAlert(LocalizeText(`navigator.cannotcreateevent.error.${ parser.errorCode }`), null, null, null, LocalizeText('navigator.cannotcreateevent.title'));
}, []); }, []);
UseMessageEventHook(CanCreateRoomEventEvent, onCanCreateRoomEventEvent); UseMessageEventHook(CanCreateRoomEventEvent, onCanCreateRoomEventEvent);
const onUserInfoEvent = useCallback((event: UserInfoEvent) => const onUserInfoEvent = useCallback((event: UserInfoEvent) =>
@ -92,7 +92,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
if(parser.roomEnter) if(parser.roomEnter)
{ {
setDoorData({ roomInfo: null, state: DoorStateType.NONE }); setDoorData({ roomInfo: null, state: DoorStateType.NONE });
setNavigatorData(prevValue => setNavigatorData(prevValue =>
{ {
const newValue = { ...prevValue }; const newValue = { ...prevValue };
@ -242,9 +242,9 @@ export const NavigatorMessageHandler: FC<{}> = props =>
setDoorData(prevValue => setDoorData(prevValue =>
{ {
const newValue = { ...prevValue }; const newValue = { ...prevValue };
newValue.state = DoorStateType.STATE_WRONG_PASSWORD; newValue.state = DoorStateType.STATE_WRONG_PASSWORD;
return newValue; return newValue;
}); });
return; return;

View File

@ -1,4 +1,4 @@
import { RoomBannedUsersComposer, RoomDataParser, RoomSettingsEvent, SaveRoomSettingsComposer } from '@nitrots/nitro-renderer'; import { RoomBannedUsersComposer, RoomDataParser, RoomSettingsDataEvent, SaveRoomSettingsComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api'; import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../../../common';
@ -22,46 +22,48 @@ export const NavigatorRoomSettingsView: FC<{}> = props =>
const [ roomData, setRoomData ] = useState<IRoomData>(null); const [ roomData, setRoomData ] = useState<IRoomData>(null);
const [ currentTab, setCurrentTab ] = useState(TABS[0]); const [ currentTab, setCurrentTab ] = useState(TABS[0]);
const onRoomSettingsEvent = useCallback((event: RoomSettingsEvent) => const onRoomSettingsEvent = useCallback((event: RoomSettingsDataEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if(!parser) return;
const data = parser.data;
setRoomData({ setRoomData({
roomId: parser.roomId, roomId: data.roomId,
roomName: parser.name, roomName: data.name,
roomDescription: parser.description, roomDescription: data.description,
categoryId: parser.categoryId, categoryId: data.categoryId,
userCount: parser.userCount, userCount: data.maximumVisitorsLimit,
tags: parser.tags, tags: data.tags,
tradeState: parser.tradeMode, tradeState: data.tradeMode,
allowWalkthrough: parser.allowWalkthrough, allowWalkthrough: data.allowWalkThrough,
lockState: parser.state, lockState: data.doorMode,
password: null, password: null,
allowPets: parser.allowPets, allowPets: data.allowPets,
allowPetsEat: parser.allowPetsEat, allowPetsEat: data.allowFoodConsume,
hideWalls: parser.hideWalls, hideWalls: data.hideWalls,
wallThickness: parser.thicknessWall, wallThickness: data.wallThickness,
floorThickness: parser.thicknessFloor, floorThickness: data.floorThickness,
chatSettings: { chatSettings: {
mode: parser.chatSettings.mode, mode: data.chatSettings.mode,
weight: parser.chatSettings.weight, weight: data.chatSettings.weight,
speed: parser.chatSettings.speed, speed: data.chatSettings.speed,
distance: parser.chatSettings.distance, distance: data.chatSettings.distance,
protection: parser.chatSettings.protection protection: data.chatSettings.protection
}, },
moderationSettings: { moderationSettings: {
allowMute: parser.moderationSettings.allowMute, allowMute: data.roomModerationSettings.allowMute,
allowKick: parser.moderationSettings.allowKick, allowKick: data.roomModerationSettings.allowKick,
allowBan: parser.moderationSettings.allowBan allowBan: data.roomModerationSettings.allowBan
} }
}); });
SendMessageComposer(new RoomBannedUsersComposer(parser.roomId)); SendMessageComposer(new RoomBannedUsersComposer(data.roomId));
}, []); }, []);
UseMessageEventHook(RoomSettingsEvent, onRoomSettingsEvent); UseMessageEventHook(RoomSettingsDataEvent, onRoomSettingsEvent);
const close = () => const close = () =>
{ {
@ -86,7 +88,7 @@ export const NavigatorRoomSettingsView: FC<{}> = props =>
case 'category': case 'category':
newValue.categoryId = Number(value); newValue.categoryId = Number(value);
break; break;
case 'max_visitors': case 'max_visitors':
newValue.userCount = Number(value); newValue.userCount = Number(value);
break; break;
case 'trade_state': case 'trade_state':
@ -176,7 +178,7 @@ export const NavigatorRoomSettingsView: FC<{}> = props =>
} }
if(!roomData) return null; if(!roomData) return null;
return ( return (
<NitroCardView uniqueKey="nitro-room-settings" className="nitro-room-settings"> <NitroCardView uniqueKey="nitro-room-settings" className="nitro-room-settings">
<NitroCardHeaderView headerText={ LocalizeText('navigator.roomsettings') } onCloseClick={ close } /> <NitroCardHeaderView headerText={ LocalizeText('navigator.roomsettings') } onCloseClick={ close } />