mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Changing details
This commit is contained in:
parent
3d413ac5ba
commit
2b80b15fda
@ -6,11 +6,11 @@ import { useAvatarInfoWidget, useMessageEvent } from '../../../../hooks';
|
|||||||
|
|
||||||
export const PetTrainingPanelWidgetView: FC<{}> = props =>
|
export const PetTrainingPanelWidgetView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
const { avatarInfo = null, petTrainInformation = null, setTrainPetInformation = null } = useAvatarInfoWidget();
|
const { avatarInfo = null, petTrainInformation = null, setPetTrainInformation = null } = useAvatarInfoWidget();
|
||||||
|
|
||||||
useMessageEvent<DesktopViewEvent>(DesktopViewEvent, event =>
|
useMessageEvent<DesktopViewEvent>(DesktopViewEvent, event =>
|
||||||
{
|
{
|
||||||
setTrainPetInformation(null);
|
setPetTrainInformation(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
useMessageEvent<PetTrainingPanelMessageEvent>(PetTrainingPanelMessageEvent, event =>
|
useMessageEvent<PetTrainingPanelMessageEvent>(PetTrainingPanelMessageEvent, event =>
|
||||||
@ -19,7 +19,7 @@ export const PetTrainingPanelWidgetView: FC<{}> = props =>
|
|||||||
|
|
||||||
if (!parser) return;
|
if (!parser) return;
|
||||||
|
|
||||||
setTrainPetInformation(parser);
|
setPetTrainInformation(parser);
|
||||||
});
|
});
|
||||||
|
|
||||||
const processPetAction = (petId: number, type: string) =>
|
const processPetAction = (petId: number, type: string) =>
|
||||||
@ -33,20 +33,20 @@ export const PetTrainingPanelWidgetView: FC<{}> = props =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<NitroCardView uniqueKey="user-settings" className="user-settings-window no-resize" theme="primary-slim">
|
<NitroCardView uniqueKey="user-settings" className="user-settings-window no-resize" theme="primary-slim">
|
||||||
<NitroCardHeaderView headerText={ LocalizeText('widgets.pet.commands.title') } onCloseClick={ () => setTrainPetInformation(null) } />
|
<NitroCardHeaderView headerText={ LocalizeText('widgets.pet.commands.title') } onCloseClick={ () => setPetTrainInformation(null) } />
|
||||||
<NitroCardContentView className="text-black">
|
<NitroCardContentView className="text-black">
|
||||||
<Flex alignItems="center" justifyContent="center" gap={ 2 }>
|
<Flex alignItems="center" justifyContent="center" gap={ 2 }>
|
||||||
<Grid columnCount={ 2 }>
|
<Grid columnCount={ 2 }>
|
||||||
<Column fullWidth overflow="hidden" className="body-image pet p-1">
|
<Column fullWidth overflow="hidden" className="body-image pet p-1">
|
||||||
<LayoutPetImageView figure={ (avatarInfo as AvatarInfoPet)?.petFigure } posture={ (avatarInfo as AvatarInfoPet)?.posture } direction={ 2 } />
|
<LayoutPetImageView figure={ (avatarInfo as AvatarInfoPet)?.petFigure } posture={ (avatarInfo as AvatarInfoPet)?.posture } direction={ 2 } />
|
||||||
</Column>
|
</Column>
|
||||||
<Text variant="white" small wrap>{ (avatarInfo as AvatarInfoPet)?.name }</Text>
|
<Text variant="black" small wrap>{ (avatarInfo as AvatarInfoPet)?.name }</Text>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Grid columnCount={ 2 }>
|
<Grid columnCount={ 2 }>
|
||||||
{
|
{
|
||||||
(petTrainInformation.commands && petTrainInformation.commands.length > 0) && petTrainInformation.commands.map((command, index) =>
|
(petTrainInformation.commands && petTrainInformation.commands.length > 0) && petTrainInformation.commands.map((command, index) =>
|
||||||
<Button key={ index } disabled={ !petTrainInformation.enabledCommands.includes(command) } onClick={ () => processPetAction(petTrainInformation.petId, LocalizeText('pet.command.' + command)) }>{ LocalizeText('pet.command.' + command) }</Button>
|
<Button key={ index } disabled={ !petTrainInformation.enabledCommands.includes(command) } onClick={ () => processPetAction(petTrainInformation.petId, LocalizeText(`pet.command.${ command }`)) }>{ LocalizeText(`pet.command.${ command }`) }</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -14,7 +14,7 @@ const useAvatarInfoWidgetState = () =>
|
|||||||
const [ nameBubbles, setNameBubbles ] = useState<AvatarInfoName[]>([]);
|
const [ nameBubbles, setNameBubbles ] = useState<AvatarInfoName[]>([]);
|
||||||
const [ productBubbles, setProductBubbles ] = useState<UseProductItem[]>([]);
|
const [ productBubbles, setProductBubbles ] = useState<UseProductItem[]>([]);
|
||||||
const [ confirmingProduct, setConfirmingProduct ] = useState<UseProductItem>(null);
|
const [ confirmingProduct, setConfirmingProduct ] = useState<UseProductItem>(null);
|
||||||
const [ petTrainInformation, setTrainPetInformation ] = useState<PetTrainingMessageParser>(null);
|
const [ petTrainInformation, setPetTrainInformation ] = useState<PetTrainingMessageParser>(null);
|
||||||
const [ pendingPetId, setPendingPetId ] = useState<number>(-1);
|
const [ pendingPetId, setPendingPetId ] = useState<number>(-1);
|
||||||
const [ isDecorating, setIsDecorating ] = useState(false);
|
const [ isDecorating, setIsDecorating ] = useState(false);
|
||||||
const { friends = [] } = useFriends();
|
const { friends = [] } = useFriends();
|
||||||
@ -66,7 +66,7 @@ const useAvatarInfoWidgetState = () =>
|
|||||||
const getObjectInfo = (objectId: number, category: number) =>
|
const getObjectInfo = (objectId: number, category: number) =>
|
||||||
{
|
{
|
||||||
let info: IAvatarInfo = null;
|
let info: IAvatarInfo = null;
|
||||||
setTrainPetInformation(null);
|
setPetTrainInformation(null);
|
||||||
|
|
||||||
switch(category)
|
switch(category)
|
||||||
{
|
{
|
||||||
@ -274,7 +274,7 @@ const useAvatarInfoWidgetState = () =>
|
|||||||
useObjectDeselectedEvent(event =>
|
useObjectDeselectedEvent(event =>
|
||||||
{
|
{
|
||||||
setAvatarInfo(null);
|
setAvatarInfo(null);
|
||||||
setTrainPetInformation(null);
|
setPetTrainInformation(null);
|
||||||
setProductBubbles([]);
|
setProductBubbles([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ const useAvatarInfoWidgetState = () =>
|
|||||||
roomSession.isDecorating = isDecorating;
|
roomSession.isDecorating = isDecorating;
|
||||||
}, [ roomSession, isDecorating ]);
|
}, [ roomSession, isDecorating ]);
|
||||||
|
|
||||||
return { avatarInfo, setAvatarInfo, activeNameBubble, setActiveNameBubble, nameBubbles, productBubbles, confirmingProduct, petTrainInformation, setTrainPetInformation, isDecorating, setIsDecorating, removeNameBubble, removeProductBubble, updateConfirmingProduct, getObjectName };
|
return { avatarInfo, setAvatarInfo, activeNameBubble, setActiveNameBubble, nameBubbles, productBubbles, confirmingProduct, petTrainInformation, setPetTrainInformation, isDecorating, setIsDecorating, removeNameBubble, removeProductBubble, updateConfirmingProduct, getObjectName };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useAvatarInfoWidget = useAvatarInfoWidgetState;
|
export const useAvatarInfoWidget = useAvatarInfoWidgetState;
|
||||||
|
Loading…
Reference in New Issue
Block a user