mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
relationship in contextmenu
This commit is contained in:
parent
7364fa3d99
commit
ec34cb3bb5
@ -1,5 +1,7 @@
|
|||||||
import { NitroEvent, RoomEngineUseProductEvent, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionDanceEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserDataUpdateEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer';
|
import { NitroEvent, RoomEngineUseProductEvent, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionDanceEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserDataUpdateEvent, RoomWidgetEnum, SetRelationshipStatusComposer } from '@nitrots/nitro-renderer';
|
||||||
|
import { SendMessageComposer } from '../../..';
|
||||||
import { GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../..';
|
import { GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../..';
|
||||||
|
import { MessengerFriend } from '../../../../../components/friends/common/MessengerFriend';
|
||||||
import { FurniCategory } from '../../../../../components/inventory/common/FurniCategory';
|
import { FurniCategory } from '../../../../../components/inventory/common/FurniCategory';
|
||||||
import { RoomWidgetAvatarInfoEvent, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateUserDataEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../events';
|
import { RoomWidgetAvatarInfoEvent, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateUserDataEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../events';
|
||||||
import { RoomWidgetAvatarExpressionMessage, RoomWidgetChangePostureMessage, RoomWidgetDanceMessage, RoomWidgetMessage, RoomWidgetRoomObjectMessage, RoomWidgetUseProductMessage, RoomWidgetUserActionMessage } from '../messages';
|
import { RoomWidgetAvatarExpressionMessage, RoomWidgetChangePostureMessage, RoomWidgetDanceMessage, RoomWidgetMessage, RoomWidgetRoomObjectMessage, RoomWidgetUseProductMessage, RoomWidgetUserActionMessage } from '../messages';
|
||||||
@ -82,6 +84,22 @@ export class RoomWidgetAvatarInfoHandler extends RoomWidgetHandler
|
|||||||
this.container.roomSession.sendPostureMessage(postureMessage.posture);
|
this.container.roomSession.sendPostureMessage(postureMessage.posture);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case RoomWidgetUserActionMessage.RELATIONSHIP_NONE: {
|
||||||
|
SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_NONE));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RoomWidgetUserActionMessage.RELATIONSHIP_HEART: {
|
||||||
|
SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_HEART));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RoomWidgetUserActionMessage.RELATIONSHIP_SMILE: {
|
||||||
|
SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_SMILE));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RoomWidgetUserActionMessage.RELATIONSHIP_BOBBA: {
|
||||||
|
SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_BOBBA));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -206,6 +224,10 @@ export class RoomWidgetAvatarInfoHandler extends RoomWidgetHandler
|
|||||||
RoomWidgetDanceMessage.DANCE,
|
RoomWidgetDanceMessage.DANCE,
|
||||||
RoomWidgetAvatarExpressionMessage.AVATAR_EXPRESSION,
|
RoomWidgetAvatarExpressionMessage.AVATAR_EXPRESSION,
|
||||||
RoomWidgetChangePostureMessage.CHANGE_POSTURE,
|
RoomWidgetChangePostureMessage.CHANGE_POSTURE,
|
||||||
|
RoomWidgetUserActionMessage.RELATIONSHIP_NONE,
|
||||||
|
RoomWidgetUserActionMessage.RELATIONSHIP_HEART,
|
||||||
|
RoomWidgetUserActionMessage.RELATIONSHIP_SMILE,
|
||||||
|
RoomWidgetUserActionMessage.RELATIONSHIP_BOBBA
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,11 @@ export class RoomWidgetUserActionMessage extends RoomWidgetMessage
|
|||||||
public static AMBASSADOR_MUTE_USER_10MIN: string = 'RWUAM_AMBASSADOR_MUTE_10MIN';
|
public static AMBASSADOR_MUTE_USER_10MIN: string = 'RWUAM_AMBASSADOR_MUTE_10MIN';
|
||||||
public static AMBASSADOR_MUTE_USER_60MIN: string = 'RWUAM_AMBASSADOR_MUTE_60MIN';
|
public static AMBASSADOR_MUTE_USER_60MIN: string = 'RWUAM_AMBASSADOR_MUTE_60MIN';
|
||||||
public static AMBASSADOR_MUTE_USER_18HOUR: string = 'RWUAM_AMBASSADOR_MUTE_18HOUR';
|
public static AMBASSADOR_MUTE_USER_18HOUR: string = 'RWUAM_AMBASSADOR_MUTE_18HOUR';
|
||||||
|
public static RELATIONSHIP_NONE: string = 'RWUAM_RELATIONSHIP_NONE';
|
||||||
|
public static RELATIONSHIP_HEART: string = 'RWUAM_RELATIONSHIP_HEART';
|
||||||
|
public static RELATIONSHIP_SMILE: string = 'RWUAM_RELATIONSHIP_SMILE';
|
||||||
|
public static RELATIONSHIP_BOBBA: string = 'RWUAM_RELATIONSHIP_BOBBA';
|
||||||
|
|
||||||
|
|
||||||
private _userId: number;
|
private _userId: number;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|||||||
import { RoomControllerLevel, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
import { RoomControllerLevel, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useEffect, useMemo, useState } from 'react';
|
import { FC, useEffect, useMemo, useState } from 'react';
|
||||||
import { GetOwnRoomObject, GetUserProfile, LocalizeText, RoomWidgetMessage, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUserActionMessage } from '../../../../api';
|
import { GetOwnRoomObject, GetUserProfile, LocalizeText, RoomWidgetMessage, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUserActionMessage } from '../../../../api';
|
||||||
|
import { Base, Flex } from '../../../../common';
|
||||||
import { BatchUpdates } from '../../../../hooks';
|
import { BatchUpdates } from '../../../../hooks';
|
||||||
import { useRoomContext } from '../../RoomContext';
|
import { useRoomContext } from '../../RoomContext';
|
||||||
import { ContextMenuHeaderView } from '../context-menu/ContextMenuHeaderView';
|
import { ContextMenuHeaderView } from '../context-menu/ContextMenuHeaderView';
|
||||||
@ -20,6 +21,7 @@ const MODE_MODERATE_BAN = 2;
|
|||||||
const MODE_MODERATE_MUTE = 3;
|
const MODE_MODERATE_MUTE = 3;
|
||||||
const MODE_AMBASSADOR = 4;
|
const MODE_AMBASSADOR = 4;
|
||||||
const MODE_AMBASSADOR_MUTE = 5;
|
const MODE_AMBASSADOR_MUTE = 5;
|
||||||
|
const MODE_RELATIONSHIP = 6;
|
||||||
|
|
||||||
export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = props =>
|
export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = props =>
|
||||||
{
|
{
|
||||||
@ -108,6 +110,10 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
|||||||
//userData.canBeAskedAsFriend = false;
|
//userData.canBeAskedAsFriend = false;
|
||||||
messageType = RoomWidgetUserActionMessage.SEND_FRIEND_REQUEST;
|
messageType = RoomWidgetUserActionMessage.SEND_FRIEND_REQUEST;
|
||||||
break;
|
break;
|
||||||
|
case 'relationship':
|
||||||
|
hideMenu = false;
|
||||||
|
setMode(MODE_RELATIONSHIP);
|
||||||
|
break;
|
||||||
case 'respect':
|
case 'respect':
|
||||||
let newRespectsLeft = 0;
|
let newRespectsLeft = 0;
|
||||||
|
|
||||||
@ -182,6 +188,19 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
|||||||
case 'ambassador_mute_18hour':
|
case 'ambassador_mute_18hour':
|
||||||
messageType = RoomWidgetUserActionMessage.AMBASSADOR_MUTE_USER_18HOUR;
|
messageType = RoomWidgetUserActionMessage.AMBASSADOR_MUTE_USER_18HOUR;
|
||||||
break;
|
break;
|
||||||
|
case 'rship_heart':
|
||||||
|
messageType = RoomWidgetUserActionMessage.RELATIONSHIP_HEART;
|
||||||
|
break;
|
||||||
|
case 'rship_smile':
|
||||||
|
messageType = RoomWidgetUserActionMessage.RELATIONSHIP_SMILE;
|
||||||
|
break;
|
||||||
|
case 'rship_bobba':
|
||||||
|
messageType = RoomWidgetUserActionMessage.RELATIONSHIP_BOBBA;
|
||||||
|
break;
|
||||||
|
case 'rship_none':
|
||||||
|
messageType = RoomWidgetUserActionMessage.RELATIONSHIP_NONE;
|
||||||
|
console.log('here')
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(messageType) message = new RoomWidgetUserActionMessage(messageType, userData.webID);
|
if(messageType) message = new RoomWidgetUserActionMessage(messageType, userData.webID);
|
||||||
@ -222,6 +241,11 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
|||||||
<ContextMenuListItemView onClick={ event => processAction('respect') }>
|
<ContextMenuListItemView onClick={ event => processAction('respect') }>
|
||||||
{ LocalizeText('infostand.button.respect', [ 'count' ], [ respectsLeft.toString() ]) }
|
{ LocalizeText('infostand.button.respect', [ 'count' ], [ respectsLeft.toString() ]) }
|
||||||
</ContextMenuListItemView>}
|
</ContextMenuListItemView>}
|
||||||
|
{ !userData.canBeAskedAsFriend &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('relationship') }>
|
||||||
|
{LocalizeText('infostand.link.relationship')}
|
||||||
|
<FontAwesomeIcon icon="chevron-right" className="right" />
|
||||||
|
</ContextMenuListItemView> }
|
||||||
{ !userData.isIgnored &&
|
{ !userData.isIgnored &&
|
||||||
<ContextMenuListItemView onClick={ event => processAction('ignore') }>
|
<ContextMenuListItemView onClick={ event => processAction('ignore') }>
|
||||||
{ LocalizeText('infostand.button.ignore') }
|
{ LocalizeText('infostand.button.ignore') }
|
||||||
@ -341,6 +365,27 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
|||||||
{ LocalizeText('generic.back') }
|
{ LocalizeText('generic.back') }
|
||||||
</ContextMenuListItemView>
|
</ContextMenuListItemView>
|
||||||
</>}
|
</>}
|
||||||
|
{ (mode === MODE_RELATIONSHIP) &&
|
||||||
|
<>
|
||||||
|
<Flex className="menu-list-split-3">
|
||||||
|
<ContextMenuListItemView onClick={event => processAction('rship_heart')}>
|
||||||
|
<Base pointer className="nitro-friends-spritesheet icon-heart" />
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={event => processAction('rship_smile')}>
|
||||||
|
<Base pointer className="nitro-friends-spritesheet icon-smile" />
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={event => processAction('rship_bobba')}>
|
||||||
|
<Base pointer className="nitro-friends-spritesheet icon-bobba" />
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
</Flex>
|
||||||
|
<ContextMenuListItemView onClick={event => processAction('rship_none')}>
|
||||||
|
{ LocalizeText('avatar.widget.clear_relationship') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={event => processAction('back')}>
|
||||||
|
<FontAwesomeIcon icon="chevron-left" className="left" />
|
||||||
|
{ LocalizeText('generic.back') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
</> }
|
||||||
</ContextMenuView>
|
</ContextMenuView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user