mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
feat: update room control widgets and menus
This commit is contained in:
@@ -28,7 +28,7 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
||||
const [ mode, setMode ] = useState(MODE_NORMAL);
|
||||
const { canRequestFriend = null } = useFriends();
|
||||
const { report = null } = useHelp();
|
||||
const { roomSession = null } = useRoom();
|
||||
const { roomSession = null, isHandItemBlocked = false } = useRoom();
|
||||
const { userRespectRemaining = 0, respectUser = null } = useSessionInfo();
|
||||
const { openInspectionForUser, showInspectButton } = useWiredTools();
|
||||
|
||||
@@ -49,6 +49,8 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
||||
|
||||
const canGiveHandItem = useMemo(() =>
|
||||
{
|
||||
if(isHandItemBlocked) return false;
|
||||
|
||||
let flag = false;
|
||||
|
||||
const roomObject = GetOwnRoomObject();
|
||||
@@ -61,7 +63,7 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
||||
}
|
||||
|
||||
return flag;
|
||||
}, []);
|
||||
}, [ isHandItemBlocked ]);
|
||||
|
||||
const processAction = (name: string) =>
|
||||
{
|
||||
|
||||
@@ -21,11 +21,13 @@ export const AvatarInfoWidgetOwnPetView: FC<AvatarInfoWidgetOwnPetViewProps> = p
|
||||
{
|
||||
const { avatarInfo = null, onClose = null } = props;
|
||||
const [ mode, setMode ] = useState(MODE_NORMAL);
|
||||
const { roomSession = null } = useRoom();
|
||||
const { roomSession = null, isHandItemBlocked = false } = useRoom();
|
||||
const { petRespectRemaining = 0, respectPet = null } = useSessionInfo();
|
||||
|
||||
const canGiveHandItem = useMemo(() =>
|
||||
{
|
||||
if(isHandItemBlocked) return false;
|
||||
|
||||
let flag = false;
|
||||
|
||||
const roomObject = GetOwnRoomObject();
|
||||
@@ -38,7 +40,7 @@ export const AvatarInfoWidgetOwnPetView: FC<AvatarInfoWidgetOwnPetViewProps> = p
|
||||
}
|
||||
|
||||
return flag;
|
||||
}, []);
|
||||
}, [ isHandItemBlocked ]);
|
||||
|
||||
const processAction = (name: string) =>
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ export const AvatarInfoWidgetPetView: FC<AvatarInfoWidgetPetViewProps> = props =
|
||||
{
|
||||
const { avatarInfo = null, onClose = null } = props;
|
||||
const [ mode, setMode ] = useState(MODE_NORMAL);
|
||||
const { roomSession = null } = useRoom();
|
||||
const { roomSession = null, isHandItemBlocked = false } = useRoom();
|
||||
const { petRespectRemaining = 0, respectPet = null } = useSessionInfo();
|
||||
|
||||
const canPickUp = useMemo(() =>
|
||||
@@ -31,6 +31,8 @@ export const AvatarInfoWidgetPetView: FC<AvatarInfoWidgetPetViewProps> = props =
|
||||
|
||||
const canGiveHandItem = useMemo(() =>
|
||||
{
|
||||
if(isHandItemBlocked) return false;
|
||||
|
||||
let flag = false;
|
||||
|
||||
const roomObject = GetOwnRoomObject();
|
||||
@@ -43,7 +45,7 @@ export const AvatarInfoWidgetPetView: FC<AvatarInfoWidgetPetViewProps> = props =
|
||||
}
|
||||
|
||||
return flag;
|
||||
}, []);
|
||||
}, [ isHandItemBlocked ]);
|
||||
|
||||
const processAction = (name: string) =>
|
||||
{
|
||||
|
||||
@@ -108,8 +108,15 @@ export const ContextMenuView: FC<ContextMenuViewProps> = ({
|
||||
|
||||
const update = () => {
|
||||
if (!elementRef.current) return;
|
||||
const bounds = GetRoomObjectBounds(GetRoomSession().roomId, objectId, category);
|
||||
const location = GetRoomObjectScreenLocation(GetRoomSession().roomId, objectId, category);
|
||||
const roomSession = GetRoomSession();
|
||||
|
||||
if (!roomSession) {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
const bounds = GetRoomObjectBounds(roomSession.roomId, objectId, category);
|
||||
const location = GetRoomObjectScreenLocation(roomSession.roomId, objectId, category);
|
||||
updatePosition(bounds, location);
|
||||
};
|
||||
|
||||
@@ -117,7 +124,7 @@ export const ContextMenuView: FC<ContextMenuViewProps> = ({
|
||||
ticker.add(update);
|
||||
|
||||
return () => ticker.remove(update);
|
||||
}, [objectId, category, updatePosition]);
|
||||
}, [objectId, category, updatePosition, onClose]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!fades) return;
|
||||
@@ -141,4 +148,4 @@ export const ContextMenuView: FC<ContextMenuViewProps> = ({
|
||||
{collapsable && <ContextMenuCaretView collapsed={isCollapsed} onClick={() => setIsCollapsed((prev) => !prev)} />}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useFurnitureAreaHideWidget } from '../../../../hooks';
|
||||
|
||||
export const FurnitureAreaHideView: FC<{}> = props =>
|
||||
{
|
||||
const { objectId = -1, isOn, setIsOn, wallItems, setWallItems, inverted, setInverted, invisibility, setInvisibility, onClose = null } = useFurnitureAreaHideWidget();
|
||||
const { objectId = -1, isOn, wallItems, setWallItems, inverted, setInverted, invisibility, setInvisibility, saveChanges = null, onClose = null } = useFurnitureAreaHideWidget();
|
||||
|
||||
if(objectId === -1) return null;
|
||||
|
||||
@@ -49,10 +49,10 @@ export const FurnitureAreaHideView: FC<{}> = props =>
|
||||
</Column>
|
||||
</Flex>
|
||||
</Column>
|
||||
<Button fullWidth variant="primary">
|
||||
<Button fullWidth variant="primary" onClick={ saveChanges }>
|
||||
{ LocalizeText(isOn ? 'widget.dimmer.button.off' : 'widget.dimmer.button.on') }
|
||||
</Button>
|
||||
</NitroCardContentView>
|
||||
</NitroCardView>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { FC } from 'react';
|
||||
import { FurnitureBackgroundColorView } from './FurnitureBackgroundColorView';
|
||||
import { FurnitureAreaHideView } from './FurnitureAreaHideView';
|
||||
import { FurnitureBadgeDisplayView } from './FurnitureBadgeDisplayView';
|
||||
import { FurnitureCraftingView } from './FurnitureCraftingView';
|
||||
import { FurnitureDimmerView } from './FurnitureDimmerView';
|
||||
@@ -23,6 +24,7 @@ export const FurnitureWidgetsView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<>
|
||||
<FurnitureAreaHideView />
|
||||
<FurnitureBackgroundColorView />
|
||||
<FurnitureBadgeDisplayView />
|
||||
<FurnitureCraftingView />
|
||||
|
||||
Reference in New Issue
Block a user