mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Wired updates
This commit is contained in:
parent
0c06da54b9
commit
93274670ce
@ -1,4 +1,5 @@
|
||||
export * from './achievements';
|
||||
export * from './campaign';
|
||||
export * from './common';
|
||||
export * from './core';
|
||||
export * from './friends';
|
||||
@ -18,3 +19,4 @@ export * from './nitro/session';
|
||||
export * from './notification';
|
||||
export * from './user';
|
||||
export * from './utils';
|
||||
export * from './wired';
|
||||
|
1
src/api/wired/WiredDateToString.ts
Normal file
1
src/api/wired/WiredDateToString.ts
Normal file
@ -0,0 +1 @@
|
||||
export const WiredDateToString = (date: Date) => `${ date.getFullYear() }/${ ('0' + (date.getMonth() + 1)).slice(-2) }/${ ('0' + date.getDate()).slice(-2) }${ ('0' + date.getHours()).slice(-2) }:${ ('0' + date.getMinutes()).slice(-2) }`;
|
@ -1,6 +1,6 @@
|
||||
import { IRoomObject, IRoomObjectSpriteVisualization, NitroFilter, RoomObjectCategory } from '@nitrots/nitro-renderer';
|
||||
import { GetRoomEngine } from '../../../api';
|
||||
import { WiredSelectionFilter } from './WiredSelectionFilter';
|
||||
import { WiredSelectionFilter } from '.';
|
||||
import { GetRoomEngine } from '..';
|
||||
|
||||
export class WiredSelectionVisualizer
|
||||
{
|
9
src/api/wired/index.ts
Normal file
9
src/api/wired/index.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export * from './GetWiredTimeLocale';
|
||||
export * from './WiredActionLayoutCode';
|
||||
export * from './WiredConditionLayoutCode';
|
||||
export * from './WiredDateToString';
|
||||
export * from './WiredFurniType';
|
||||
export * from './WiredSelectionFilter';
|
||||
export * from './WiredSelectionVisualizer';
|
||||
export * from './WiredStringDelimeter';
|
||||
export * from './WiredTriggerLayoutCode';
|
@ -13,6 +13,7 @@ export interface IWiredContext
|
||||
setFurniIds: Dispatch<SetStateAction<number[]>>;
|
||||
actionDelay: number;
|
||||
setActionDelay: Dispatch<SetStateAction<number>>;
|
||||
saveWired: () => void;
|
||||
}
|
||||
|
||||
const WiredContext = createContext<IWiredContext>({
|
||||
@ -25,7 +26,8 @@ const WiredContext = createContext<IWiredContext>({
|
||||
furniIds: null,
|
||||
setFurniIds: null,
|
||||
actionDelay: null,
|
||||
setActionDelay: null
|
||||
setActionDelay: null,
|
||||
saveWired: null
|
||||
});
|
||||
|
||||
export const WiredContextProvider: FC<ProviderProps<IWiredContext>> = props =>
|
@ -2,7 +2,7 @@ import { WiredFurniActionEvent, WiredFurniConditionEvent, WiredFurniTriggerEvent
|
||||
import { FC, useCallback } from 'react';
|
||||
import { LocalizeText, NotificationAlertType, NotificationUtilities } from '../../api';
|
||||
import { UseMessageEventHook } from '../../hooks/messages';
|
||||
import { useWiredContext } from './context/WiredContext';
|
||||
import { useWiredContext } from './WiredContext';
|
||||
|
||||
export const WiredMessageHandler: FC<{}> = props =>
|
||||
{
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { ConditionDefinition, Triggerable, TriggerDefinition, UpdateActionMessageComposer, UpdateConditionMessageComposer, UpdateTriggerMessageComposer, WiredActionDefinition } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useMemo, useState } from 'react';
|
||||
import { IsOwnerOfFloorFurniture, SendMessageComposer } from '../../api';
|
||||
import { WiredEvent } from '../../events';
|
||||
import { UseUiEvent } from '../../hooks';
|
||||
import { FC, useState } from 'react';
|
||||
import { IsOwnerOfFloorFurniture, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../api';
|
||||
import { GetWiredLayout } from './common/GetWiredLayout';
|
||||
import { WiredContextProvider } from './context/WiredContext';
|
||||
import { WiredContextProvider } from './WiredContext';
|
||||
import { WiredMessageHandler } from './WiredMessageHandler';
|
||||
|
||||
export const WiredView: FC<{}> = props =>
|
||||
@ -15,40 +13,46 @@ export const WiredView: FC<{}> = props =>
|
||||
const [ furniIds, setFurniIds ] = useState<number[]>([]);
|
||||
const [ actionDelay, setActionDelay ] = useState<number>(null);
|
||||
|
||||
const wiredLayout = useMemo(() =>
|
||||
const saveWired = () =>
|
||||
{
|
||||
return GetWiredLayout(trigger);
|
||||
}, [ trigger ]);
|
||||
const save = (trigger: Triggerable) =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
if(trigger instanceof WiredActionDefinition)
|
||||
{
|
||||
SendMessageComposer(new UpdateActionMessageComposer(trigger.id, intParams, stringParam, furniIds, actionDelay, trigger.stuffTypeSelectionCode));
|
||||
}
|
||||
|
||||
else if(trigger instanceof TriggerDefinition)
|
||||
{
|
||||
SendMessageComposer(new UpdateTriggerMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode));
|
||||
}
|
||||
|
||||
else if(trigger instanceof ConditionDefinition)
|
||||
{
|
||||
SendMessageComposer(new UpdateConditionMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode));
|
||||
}
|
||||
}
|
||||
|
||||
const onWiredEvent = useCallback((event: WiredEvent) =>
|
||||
{
|
||||
if(!IsOwnerOfFloorFurniture(trigger.id))
|
||||
{
|
||||
|
||||
NotificationUtilities.confirm(LocalizeText('wiredfurni.nonowner.change.confirm.body'), () =>
|
||||
{
|
||||
save(trigger)
|
||||
}, null, null, null, LocalizeText('wiredfurni.nonowner.change.confirm.title'));
|
||||
}
|
||||
|
||||
if(trigger instanceof WiredActionDefinition)
|
||||
else
|
||||
{
|
||||
SendMessageComposer(new UpdateActionMessageComposer(trigger.id, intParams, stringParam, furniIds, actionDelay, trigger.stuffTypeSelectionCode));
|
||||
save(trigger);
|
||||
}
|
||||
|
||||
else if(trigger instanceof TriggerDefinition)
|
||||
{
|
||||
SendMessageComposer(new UpdateTriggerMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode));
|
||||
}
|
||||
|
||||
else if(trigger instanceof ConditionDefinition)
|
||||
{
|
||||
SendMessageComposer(new UpdateConditionMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode));
|
||||
}
|
||||
}, [ trigger, intParams, stringParam, furniIds, actionDelay ]);
|
||||
|
||||
UseUiEvent(WiredEvent.SAVE_WIRED, onWiredEvent);
|
||||
}
|
||||
|
||||
return (
|
||||
<WiredContextProvider value={ { trigger, setTrigger, intParams, setIntParams, stringParam, setStringParam, furniIds, setFurniIds, actionDelay, setActionDelay }}>
|
||||
<WiredContextProvider value={ { trigger, setTrigger, intParams, setIntParams, stringParam, setStringParam, furniIds, setFurniIds, actionDelay, setActionDelay, saveWired }}>
|
||||
<WiredMessageHandler />
|
||||
{ wiredLayout }
|
||||
{ (trigger !== null) &&
|
||||
GetWiredLayout(trigger) }
|
||||
</WiredContextProvider>
|
||||
);
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { WiredActionLayout } from '../../../api';
|
||||
import { WiredActionBotChangeFigureView } from '../views/actions/WiredActionBotChangeFigureView';
|
||||
import { WiredActionBotFollowAvatarView } from '../views/actions/WiredActionBotFollowAvatarView';
|
||||
import { WiredActionBotGiveHandItemView } from '../views/actions/WiredActionBotGiveHandItemView';
|
||||
@ -23,7 +24,6 @@ import { WiredActionResetView } from '../views/actions/WiredActionResetView';
|
||||
import { WiredActionSetFurniStateToView } from '../views/actions/WiredActionSetFurniStateToView';
|
||||
import { WiredActionTeleportView } from '../views/actions/WiredActionTeleportView';
|
||||
import { WiredActionToggleFurniStateView } from '../views/actions/WiredActionToggleFurniStateView';
|
||||
import { WiredActionLayout } from './WiredActionLayoutCode';
|
||||
|
||||
export const GetWiredActionLayout = (code: number) =>
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { WiredConditionlayout } from '../../../api';
|
||||
import { WiredConditionActorHasHandItemView } from '../views/conditions/WiredConditionActorHasHandItem';
|
||||
import { WiredConditionActorIsGroupMemberView } from '../views/conditions/WiredConditionActorIsGroupMemberView';
|
||||
import { WiredConditionActorIsOnFurniView } from '../views/conditions/WiredConditionActorIsOnFurniView';
|
||||
@ -13,7 +14,6 @@ import { WiredConditionFurniMatchesSnapshotView } from '../views/conditions/Wire
|
||||
import { WiredConditionTimeElapsedLessView } from '../views/conditions/WiredConditionTimeElapsedLessView';
|
||||
import { WiredConditionTimeElapsedMoreView } from '../views/conditions/WiredConditionTimeElapsedMoreView';
|
||||
import { WiredConditionUserCountInRoomView } from '../views/conditions/WiredConditionUserCountInRoomView';
|
||||
import { WiredConditionlayout } from './WiredConditionLayoutCode';
|
||||
|
||||
export const GetWiredConditionLayout = (code: number) =>
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { WiredTriggerLayout } from '../../../api';
|
||||
import { WiredTriggerAvatarEnterRoomView } from '../views/triggers/WiredTriggerAvatarEnterRoomView';
|
||||
import { WiredTriggerAvatarSaysSomethingView } from '../views/triggers/WiredTriggerAvatarSaysSomethingView';
|
||||
import { WiredTriggerAvatarWalksOffFurniView } from '../views/triggers/WiredTriggerAvatarWalksOffFurniView';
|
||||
@ -12,7 +13,6 @@ import { WiredTriggerGameEndsView } from '../views/triggers/WiredTriggerGameEnds
|
||||
import { WiredTriggerGameStartsView } from '../views/triggers/WiredTriggerGameStartsView';
|
||||
import { WiredTriggeScoreAchievedView } from '../views/triggers/WiredTriggerScoreAchievedView';
|
||||
import { WiredTriggerToggleFurniView } from '../views/triggers/WiredTriggerToggleFurniView';
|
||||
import { WiredTriggerLayout } from './WiredTriggerLayoutCode';
|
||||
|
||||
export const GetWiredTriggerLayout = (code: number) =>
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { GetSessionDataManager, LocalizeText } from '../../../api';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { GetSessionDataManager, LocalizeText, WiredFurniType, WiredSelectionVisualizer } from '../../../api';
|
||||
import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common';
|
||||
import { WiredEvent } from '../../../events';
|
||||
import { BatchUpdates, DispatchUiEvent } from '../../../hooks';
|
||||
import { WiredFurniType } from '../common/WiredFurniType';
|
||||
import { WiredSelectionVisualizer } from '../common/WiredSelectionVisualizer';
|
||||
import { useWiredContext } from '../context/WiredContext';
|
||||
import { BatchUpdates } from '../../../hooks';
|
||||
import { useWiredContext } from '../WiredContext';
|
||||
import { WiredFurniSelectorView } from './WiredFurniSelectorView';
|
||||
|
||||
export interface WiredBaseViewProps
|
||||
@ -22,21 +19,21 @@ export const WiredBaseView: FC<WiredBaseViewProps> = props =>
|
||||
const { wiredType = '', requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, validate = null, children = null, hasSpecialInput = false } = props;
|
||||
const [ wiredName, setWiredName ] = useState<string>(null);
|
||||
const [ wiredDescription, setWiredDescription ] = useState<string>(null);
|
||||
const { trigger = null, setTrigger = null, setIntParams = null, setStringParam = null, setFurniIds = null } = useWiredContext();
|
||||
const { trigger = null, setTrigger = null, setIntParams = null, setStringParam = null, setFurniIds = null, saveWired = null } = useWiredContext();
|
||||
|
||||
const onSave = useCallback(() =>
|
||||
const onSave = () =>
|
||||
{
|
||||
if(validate && !validate()) return;
|
||||
|
||||
if(save) save();
|
||||
|
||||
setTimeout(() => DispatchUiEvent(new WiredEvent(WiredEvent.SAVE_WIRED)), 1);
|
||||
}, [ save, validate ]);
|
||||
saveWired();
|
||||
}
|
||||
|
||||
const close = useCallback(() =>
|
||||
const close = () =>
|
||||
{
|
||||
setTrigger(null);
|
||||
}, [ setTrigger ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -81,7 +78,22 @@ export const WiredBaseView: FC<WiredBaseViewProps> = props =>
|
||||
});
|
||||
}
|
||||
});
|
||||
}, [trigger, setIntParams, setStringParam, setFurniIds, hasSpecialInput, requiresFurni]);
|
||||
|
||||
return () =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setIntParams([]);
|
||||
setStringParam(null);
|
||||
setFurniIds(prevValue =>
|
||||
{
|
||||
if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue);
|
||||
|
||||
return [];
|
||||
});
|
||||
});
|
||||
}
|
||||
}, [ trigger, hasSpecialInput, requiresFurni, setIntParams, setStringParam, setFurniIds ]);
|
||||
|
||||
return (
|
||||
<NitroCardView uniqueKey="nitro-wired" className="nitro-wired" theme="primary-slim">
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { FC, useCallback, useEffect } from 'react';
|
||||
import { LocalizeText } from '../../../api';
|
||||
import { FC, useCallback } from 'react';
|
||||
import { LocalizeText, WiredSelectionVisualizer } from '../../../api';
|
||||
import { Column, Text } from '../../../common';
|
||||
import { WiredSelectObjectEvent } from '../../../events';
|
||||
import { UseUiEvent } from '../../../hooks';
|
||||
import { WiredSelectionVisualizer } from '../common/WiredSelectionVisualizer';
|
||||
import { useWiredContext } from '../context/WiredContext';
|
||||
import { useWiredContext } from '../WiredContext';
|
||||
|
||||
export const WiredFurniSelectorView: FC<{}> = props =>
|
||||
{
|
||||
@ -14,13 +13,11 @@ export const WiredFurniSelectorView: FC<{}> = props =>
|
||||
{
|
||||
const furniId = event.objectId;
|
||||
|
||||
if(furniId === -1) return;
|
||||
|
||||
let newFurniIds: number[] = null;
|
||||
if(furniId <= 0) return;
|
||||
|
||||
setFurniIds(prevValue =>
|
||||
{
|
||||
newFurniIds = [ ...prevValue ];
|
||||
const newFurniIds = [ ...prevValue ];
|
||||
|
||||
const index = prevValue.indexOf(furniId);
|
||||
|
||||
@ -30,14 +27,12 @@ export const WiredFurniSelectorView: FC<{}> = props =>
|
||||
|
||||
WiredSelectionVisualizer.hide(furniId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(newFurniIds.length < trigger.maximumItemSelectionCount)
|
||||
{
|
||||
newFurniIds.push(furniId);
|
||||
|
||||
WiredSelectionVisualizer.show(furniId);
|
||||
}
|
||||
else if(newFurniIds.length < trigger.maximumItemSelectionCount)
|
||||
{
|
||||
newFurniIds.push(furniId);
|
||||
|
||||
WiredSelectionVisualizer.show(furniId);
|
||||
}
|
||||
|
||||
return newFurniIds;
|
||||
@ -45,35 +40,6 @@ export const WiredFurniSelectorView: FC<{}> = props =>
|
||||
}, [ trigger, setFurniIds ]);
|
||||
|
||||
UseUiEvent(WiredSelectObjectEvent.SELECT_OBJECT, onWiredSelectObjectEvent);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
setFurniIds(prevValue =>
|
||||
{
|
||||
if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue);
|
||||
|
||||
if(trigger.selectedItems && trigger.selectedItems.length)
|
||||
{
|
||||
WiredSelectionVisualizer.applySelectionShaderToFurni(trigger.selectedItems);
|
||||
|
||||
return trigger.selectedItems;
|
||||
}
|
||||
|
||||
return [];
|
||||
});
|
||||
|
||||
return () =>
|
||||
{
|
||||
setFurniIds(prevValue =>
|
||||
{
|
||||
WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue);
|
||||
|
||||
return [];
|
||||
});
|
||||
}
|
||||
}, [ trigger, setFurniIds ]);
|
||||
|
||||
return (
|
||||
<Column gap={ 1 }>
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { WiredActionDefinition } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredBaseView } from '../WiredBaseView';
|
||||
|
||||
export interface WiredActionBaseViewProps
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { GetSessionDataManager, LocalizeText } from '../../../../api';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { GetSessionDataManager, LocalizeText, WiredFurniType, WIRED_STRING_DELIMETER } from '../../../../api';
|
||||
import { Button, Column, Flex, LayoutAvatarImageView, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WIRED_STRING_DELIMETER } from '../../common/WiredStringDelimeter';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
const DEFAULT_FIGURE: string = 'hd-180-1.ch-210-66.lg-270-82.sh-290-81';
|
||||
@ -15,15 +13,7 @@ export const WiredActionBotChangeFigureView: FC<{}> = props =>
|
||||
const [ figure, setFigure ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const copyLooks = useCallback(() =>
|
||||
{
|
||||
setFigure(GetSessionDataManager().figure);
|
||||
}, []);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam((botName + WIRED_STRING_DELIMETER + figure));
|
||||
}, [ botName, figure, setStringParam ]);
|
||||
const save = () => setStringParam((botName + WIRED_STRING_DELIMETER + figure));
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -44,7 +34,7 @@ export const WiredActionBotChangeFigureView: FC<{}> = props =>
|
||||
</Column>
|
||||
<Flex center>
|
||||
<LayoutAvatarImageView figure={ figure } direction={ 4 } />
|
||||
<Button onClick={ copyLooks }>{ LocalizeText('wiredfurni.params.capture.figure') }</Button>
|
||||
<Button onClick={ event => setFigure(GetSessionDataManager().figure) }>{ LocalizeText('wiredfurni.params.capture.figure') }</Button>
|
||||
</Flex>
|
||||
</WiredActionBaseView>
|
||||
);
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionBotFollowAvatarView: FC<{}> = props =>
|
||||
@ -14,14 +11,14 @@ export const WiredActionBotFollowAvatarView: FC<{}> = props =>
|
||||
const [ followMode, setFollowMode ] = useState(-1);
|
||||
const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
const save = () =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
setIntParams([followMode]);
|
||||
setIntParams([ followMode ]);
|
||||
});
|
||||
}, [ followMode, botName, setStringParam, setIntParams ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -35,7 +32,7 @@ export const WiredActionBotFollowAvatarView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } hasSpecialInput={ true } save={ save }>
|
||||
<Column gap={ 1 }>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.bot.name') }</Text>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</Column>
|
||||
<Column gap={ 1 }>
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
const ALLOWED_HAND_ITEM_IDS: number[] = [ 2, 5, 7, 8, 9, 10, 27 ];
|
||||
@ -15,14 +13,14 @@ export const WiredActionBotGiveHandItemView: FC<{}> = props =>
|
||||
const [ handItemId, setHandItemId ] = useState(-1);
|
||||
const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
const save = () =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
setIntParams([ handItemId ]);
|
||||
});
|
||||
}, [ handItemId, botName, setStringParam, setIntParams ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -43,10 +41,7 @@ export const WiredActionBotGiveHandItemView: FC<{}> = props =>
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.handitem') }</Text>
|
||||
<select className="form-select form-select-sm" value={ handItemId } onChange={ event => setHandItemId(parseInt(event.target.value)) }>
|
||||
<option value="0">------</option>
|
||||
{ ALLOWED_HAND_ITEM_IDS.map(value =>
|
||||
{
|
||||
return <option key={ value } value={ value }>{ LocalizeText(`handitem${ value }`) }</option>
|
||||
}) }
|
||||
{ ALLOWED_HAND_ITEM_IDS.map(value => <option key={ value } value={ value }>{ LocalizeText(`handitem${ value }`) }</option>) }
|
||||
</select>
|
||||
</Column>
|
||||
</WiredActionBaseView>
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionBotMoveView: FC<{}> = props =>
|
||||
@ -11,10 +9,7 @@ export const WiredActionBotMoveView: FC<{}> = props =>
|
||||
const [ botName, setBotName ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
}, [ botName, setStringParam ]);
|
||||
const save = () => setStringParam(botName);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,12 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType, WIRED_STRING_DELIMETER } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WIRED_STRING_DELIMETER } from '../../common/WiredStringDelimeter';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionBotTalkToAvatarView: FC<{}> = props =>
|
||||
@ -16,14 +12,14 @@ export const WiredActionBotTalkToAvatarView: FC<{}> = props =>
|
||||
const [ talkMode, setTalkMode ] = useState(-1);
|
||||
const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
const save = () =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setStringParam(botName + WIRED_STRING_DELIMETER + message);
|
||||
setIntParams([ talkMode ]);
|
||||
});
|
||||
}, [ botName, message, talkMode, setStringParam, setIntParams ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,12 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType, WIRED_STRING_DELIMETER } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WIRED_STRING_DELIMETER } from '../../common/WiredStringDelimeter';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionBotTalkView: FC<{}> = props =>
|
||||
@ -16,14 +12,14 @@ export const WiredActionBotTalkView: FC<{}> = props =>
|
||||
const [ talkMode, setTalkMode ] = useState(-1);
|
||||
const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
const save = () =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setStringParam(botName + WIRED_STRING_DELIMETER + message);
|
||||
setIntParams([ talkMode ]);
|
||||
});
|
||||
}, [ botName, message, talkMode, setStringParam, setIntParams ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionBotTeleportView: FC<{}> = props =>
|
||||
@ -11,10 +9,7 @@ export const WiredActionBotTeleportView: FC<{}> = props =>
|
||||
const [ botName, setBotName ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
}, [ botName, setStringParam ]);
|
||||
const save = () => setStringParam(botName);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionCallAnotherStackView: FC<{}> = props =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionChaseView: FC<{}> = props =>
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionChatView: FC<{}> = props =>
|
||||
@ -11,10 +10,7 @@ export const WiredActionChatView: FC<{}> = props =>
|
||||
const [ message, setMessage ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(message);
|
||||
}, [ message, setStringParam ]);
|
||||
const save = () => setStringParam(message);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionFleeView: FC<{}> = props =>
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Button } from '../../../../common/Button';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionGiveRewardView: FC<{}> = props =>
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionGiveScoreToPredefinedTeamView: FC<{}> = props =>
|
||||
@ -16,10 +13,7 @@ export const WiredActionGiveScoreToPredefinedTeamView: FC<{}> = props =>
|
||||
const [ selectedTeam, setSelectedTeam ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ points, time, selectedTeam ]);
|
||||
}, [ points, time, selectedTeam, setIntParams ]);
|
||||
const save = () => setIntParams([ points, time, selectedTeam ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionGiveScoreView: FC<{}> = props =>
|
||||
@ -14,10 +12,7 @@ export const WiredActionGiveScoreView: FC<{}> = props =>
|
||||
const [ time, setTime ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ points, time ]);
|
||||
}, [ points, time, setIntParams ]);
|
||||
const save = () => setIntParams([ points, time ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionJoinTeamView: FC<{}> = props =>
|
||||
@ -12,10 +9,7 @@ export const WiredActionJoinTeamView: FC<{}> = props =>
|
||||
const [ selectedTeam, setSelectedTeam ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ selectedTeam ]);
|
||||
}, [ selectedTeam, setIntParams ]);
|
||||
const save = () => setIntParams([ selectedTeam ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionKickFromRoomView: FC<{}> = props =>
|
||||
@ -11,10 +9,7 @@ export const WiredActionKickFromRoomView: FC<{}> = props =>
|
||||
const [ message, setMessage ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(message);
|
||||
}, [ message, setStringParam ]);
|
||||
const save = () => setStringParam(message);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionLeaveTeamView: FC<{}> = props =>
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
const directionOptions: { value: number, icon: string }[] = [
|
||||
@ -35,10 +32,7 @@ export const WiredActionMoveAndRotateFurniView: FC<{}> = props =>
|
||||
const [ rotation, setRotation ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ movement, rotation ]);
|
||||
}, [ movement, rotation, setIntParams ]);
|
||||
const save = () => setIntParams([ movement, rotation ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
const directionOptions: { value: number, icon: string }[] = [
|
||||
@ -34,10 +31,7 @@ export const WiredActionMoveFurniToView: FC<{}> = props =>
|
||||
const [ movement, setMovement ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ movement, spacing ]);
|
||||
}, [ movement, spacing, setIntParams ]);
|
||||
const save = () => setIntParams([ movement, spacing ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
const directionOptions: { value: number, icon: string }[] = [
|
||||
@ -47,10 +44,7 @@ export const WiredActionMoveFurniView: FC<{}> = props =>
|
||||
const [ rotation, setRotation ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ movement, rotation ]);
|
||||
}, [ movement, rotation, setIntParams ]);
|
||||
const save = () => setIntParams([ movement, rotation ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionMuteUserView: FC<{}> = props =>
|
||||
@ -14,14 +12,14 @@ export const WiredActionMuteUserView: FC<{}> = props =>
|
||||
const [ message, setMessage ] = useState('');
|
||||
const { trigger = null, setIntParams = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
const save = () =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setIntParams([ time ]);
|
||||
setStringParam(message);
|
||||
});
|
||||
}, [ time, message, setIntParams, setStringParam ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionResetView: FC<{}> = props =>
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionSetFurniStateToView: FC<{}> = props =>
|
||||
@ -15,10 +12,7 @@ export const WiredActionSetFurniStateToView: FC<{}> = props =>
|
||||
const [ positionFlag, setPositionFlag ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ stateFlag, directionFlag, positionFlag ]);
|
||||
}, [ directionFlag, positionFlag, stateFlag, setIntParams ]);
|
||||
const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionTeleportView: FC<{}> = props =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionToggleFurniStateView: FC<{}> = props =>
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
const ALLOWED_HAND_ITEM_IDS: number[] = [ 2, 5, 7, 8, 9, 10, 27 ];
|
||||
@ -13,10 +11,7 @@ export const WiredConditionActorHasHandItemView: FC<{}> = props =>
|
||||
const [ handItemId, setHandItemId ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ handItemId ]);
|
||||
}, [ handItemId, setIntParams ]);
|
||||
const save = () => setIntParams([ handItemId ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionActorIsGroupMemberView: FC<{}> = props =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionActorIsOnFurniView: FC<{}> = props =>
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
const teamIds: number[] = [ 1, 2, 3, 4 ];
|
||||
@ -14,10 +11,7 @@ export const WiredConditionActorIsTeamMemberView: FC<{}> = props =>
|
||||
const [ selectedTeam, setSelectedTeam ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ selectedTeam ]);
|
||||
}, [ selectedTeam, setIntParams ]);
|
||||
const save = () => setIntParams([ selectedTeam ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionActorIsWearingBadgeView: FC<{}> = props =>
|
||||
@ -11,10 +9,7 @@ export const WiredConditionActorIsWearingBadgeView: FC<{}> = props =>
|
||||
const [ badge, setBadge ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(badge);
|
||||
}, [ badge, setStringParam ]);
|
||||
const save = () => setStringParam(badge);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionActorIsWearingEffectView: FC<{}> = props =>
|
||||
@ -11,10 +9,7 @@ export const WiredConditionActorIsWearingEffectView: FC<{}> = props =>
|
||||
const [ effect, setEffect ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ effect ]);
|
||||
}, [ effect, setIntParams ]);
|
||||
const save = () => setIntParams([ effect ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC, useCallback } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredBaseView } from '../WiredBaseView';
|
||||
|
||||
export interface WiredConditionBaseViewProps
|
||||
@ -13,10 +13,7 @@ export const WiredConditionBaseView: FC<WiredConditionBaseViewProps> = props =>
|
||||
{
|
||||
const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, hasSpecialInput = false, children = null } = props;
|
||||
|
||||
const onSave = useCallback(() =>
|
||||
{
|
||||
if(save) save();
|
||||
}, [ save ]);
|
||||
const onSave = () => (save && save());
|
||||
|
||||
return (
|
||||
<WiredBaseView wiredType="condition" requiresFurni={ requiresFurni } hasSpecialInput={ hasSpecialInput } save={ onSave }>
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredDateToString, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionDateRangeView: FC<{}> = props =>
|
||||
@ -13,12 +11,7 @@ export const WiredConditionDateRangeView: FC<{}> = props =>
|
||||
const [ endDate, setEndDate ] = useState('');
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const dateToString = useCallback((date: Date) =>
|
||||
{
|
||||
return `${date.getFullYear()}/${('0' + (date.getMonth() + 1)).slice(-2)}/${('0' + date.getDate()).slice(-2)}${('0' + date.getHours()).slice(-2)}:${('0' + date.getMinutes()).slice(-2)}`;
|
||||
}, []);
|
||||
|
||||
const save = useCallback(() =>
|
||||
const save = () =>
|
||||
{
|
||||
let startDateMili = 0;
|
||||
let endDateMili = 0;
|
||||
@ -33,7 +26,7 @@ export const WiredConditionDateRangeView: FC<{}> = props =>
|
||||
}
|
||||
|
||||
setIntParams([startDateMili, endDateMili]);
|
||||
}, [ startDate, endDate, setIntParams ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -48,11 +41,11 @@ export const WiredConditionDateRangeView: FC<{}> = props =>
|
||||
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setStartDate(dateToString(startDate));
|
||||
setEndDate(dateToString(endDate));
|
||||
setStartDate(WiredDateToString(startDate));
|
||||
setEndDate(WiredDateToString(endDate));
|
||||
});
|
||||
}
|
||||
}, [ trigger, dateToString ]);
|
||||
}, [ trigger ]);
|
||||
|
||||
return (
|
||||
<WiredConditionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } hasSpecialInput={ true } save={ save }>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionFurniHasAvatarOnView: FC<{}> = props =>
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionFurniHasFurniOnView: FC<{}> = props =>
|
||||
@ -12,10 +9,7 @@ export const WiredConditionFurniHasFurniOnView: FC<{}> = props =>
|
||||
const [ requireAll, setRequireAll ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ requireAll ]);
|
||||
}, [ requireAll, setIntParams ]);
|
||||
const save = () => setIntParams([ requireAll ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionFurniHasNotFurniOnView: FC<{}> = props =>
|
||||
@ -12,10 +9,7 @@ export const WiredConditionFurniHasNotFurniOnView: FC<{}> = props =>
|
||||
const [ requireAll, setRequireAll ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ requireAll ]);
|
||||
}, [ requireAll, setIntParams ]);
|
||||
const save = () => setIntParams([ requireAll ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionFurniIsOfTypeView: FC<{}> = props =>
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props =>
|
||||
@ -15,10 +12,7 @@ export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props =>
|
||||
const [ positionFlag, setPositionFlag ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ stateFlag, directionFlag, positionFlag ]);
|
||||
}, [ directionFlag, positionFlag, stateFlag, setIntParams ]);
|
||||
const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionTimeElapsedLessView: FC<{}> = props =>
|
||||
@ -13,10 +10,7 @@ export const WiredConditionTimeElapsedLessView: FC<{}> = props =>
|
||||
const [ time, setTime ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ time ]);
|
||||
}, [ time, setIntParams ]);
|
||||
const save = () => setIntParams([ time ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionTimeElapsedMoreView: FC<{}> = props =>
|
||||
@ -13,10 +10,7 @@ export const WiredConditionTimeElapsedMoreView: FC<{}> = props =>
|
||||
const [ time, setTime ] = useState(-1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ time ]);
|
||||
}, [ time, setIntParams ]);
|
||||
const save = () => setIntParams([ time ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionUserCountInRoomView: FC<{}> = props =>
|
||||
@ -14,10 +12,7 @@ export const WiredConditionUserCountInRoomView: FC<{}> = props =>
|
||||
const [ max, setMax ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ min, max ]);
|
||||
}, [ min, max, setIntParams ]);
|
||||
const save = () => setIntParams([ min, max ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarEnterRoomView: FC<{}> = props =>
|
||||
@ -14,11 +11,7 @@ export const WiredTriggerAvatarEnterRoomView: FC<{}> = props =>
|
||||
const [ avatarMode, setAvatarMode ] = useState(0);
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
if(avatarMode === 1) setStringParam(username);
|
||||
else setStringParam('');
|
||||
}, [ username, avatarMode, setStringParam ]);
|
||||
const save = () => setStringParam((avatarMode === 1) ? username : '');
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { GetSessionDataManager, LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { GetSessionDataManager, LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarSaysSomethingView: FC<{}> = props =>
|
||||
@ -14,14 +11,14 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = props =>
|
||||
const [ triggererAvatar, setTriggererAvatar ] = useState(-1);
|
||||
const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
const save = () =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setStringParam(message);
|
||||
setIntParams([ triggererAvatar ]);
|
||||
});
|
||||
}, [ message, triggererAvatar, setStringParam, setIntParams ]);
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarWalksOffFurniView: FC<{}> = props =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarWalksOnFurniView: FC<{}> = props =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC, useCallback } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredBaseView } from '../WiredBaseView';
|
||||
|
||||
export interface WiredTriggerBaseViewProps
|
||||
@ -13,10 +13,7 @@ export const WiredTriggerBaseView: FC<WiredTriggerBaseViewProps> = props =>
|
||||
{
|
||||
const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, hasSpecialInput = false, children = null } = props;
|
||||
|
||||
const onSave = useCallback(() =>
|
||||
{
|
||||
if(save) save();
|
||||
}, [ save ]);
|
||||
const onSave = () => (save && save());
|
||||
|
||||
return (
|
||||
<WiredBaseView wiredType="trigger" requiresFurni={ requiresFurni } hasSpecialInput={ hasSpecialInput } save={ onSave }>
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerBotReachedAvatarView: FC<{}> = props =>
|
||||
@ -11,10 +9,7 @@ export const WiredTriggerBotReachedAvatarView: FC<{}> = props =>
|
||||
const [ botName, setBotName ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
}, [ botName, setStringParam ]);
|
||||
const save = () => setStringParam(botName);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerBotReachedStuffView: FC<{}> = props =>
|
||||
@ -11,10 +9,7 @@ export const WiredTriggerBotReachedStuffView: FC<{}> = props =>
|
||||
const [ botName, setBotName ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
}, [ botName, setStringParam ]);
|
||||
const save = () => setStringParam(botName);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerCollisionView: FC<{}> = props =>
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeExecuteOnceView: FC<{}> = props =>
|
||||
@ -13,10 +10,7 @@ export const WiredTriggeExecuteOnceView: FC<{}> = props =>
|
||||
const [ time, setTime ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ time ]);
|
||||
}, [ time, setIntParams ]);
|
||||
const save = () => setIntParams([ time ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { FriendlyTime } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeExecutePeriodicallyLongView: FC<{}> = props =>
|
||||
@ -13,10 +11,7 @@ export const WiredTriggeExecutePeriodicallyLongView: FC<{}> = props =>
|
||||
const [ time, setTime ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ time ]);
|
||||
}, [ time, setIntParams ]);
|
||||
const save = () => setIntParams([ time ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeExecutePeriodicallyView: FC<{}> = props =>
|
||||
@ -13,10 +10,7 @@ export const WiredTriggeExecutePeriodicallyView: FC<{}> = props =>
|
||||
const [ time, setTime ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ time ]);
|
||||
}, [ time, setIntParams ]);
|
||||
const save = () => setIntParams([ time ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerGameEndsView: FC<{}> = props =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerGameStartsView: FC<{}> = props =>
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import ReactSlider from 'react-slider';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Column } from '../../../../common/Column';
|
||||
import { Text } from '../../../../common/Text';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { useWiredContext } from '../../context/WiredContext';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Column, Text } from '../../../../common';
|
||||
import { useWiredContext } from '../../WiredContext';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeScoreAchievedView: FC<{}> = props =>
|
||||
@ -12,10 +10,7 @@ export const WiredTriggeScoreAchievedView: FC<{}> = props =>
|
||||
const [ points, setPoints ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ points ]);
|
||||
}, [ points, setIntParams ]);
|
||||
const save = () => setIntParams([ points ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../common/WiredFurniType';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerToggleFurniView: FC<{}> = props =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user