mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Triggers
This commit is contained in:
parent
cf715ea94b
commit
dc559cf0b4
@ -1,4 +1,4 @@
|
||||
import { Triggerable, UpdateActionMessageComposer, WiredActionDefinition } from 'nitro-renderer';
|
||||
import { Triggerable, TriggerDefinition, UpdateActionMessageComposer, UpdateTriggerMessageComposer, WiredActionDefinition } from 'nitro-renderer';
|
||||
import { FC, useCallback, useMemo, useState } from 'react';
|
||||
import { GetConnection } from '../../api';
|
||||
import { WiredEvent } from '../../events';
|
||||
@ -29,6 +29,11 @@ export const WiredView: FC<WiredFurniSelectorViewProps> = props =>
|
||||
{
|
||||
GetConnection().send(new UpdateActionMessageComposer(trigger.id, intParams, stringParam, furniIds, actionDelay, trigger.stuffTypeSelectionCode));
|
||||
}
|
||||
|
||||
if(trigger instanceof TriggerDefinition)
|
||||
{
|
||||
GetConnection().send(new UpdateTriggerMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode));
|
||||
}
|
||||
}, [ trigger, intParams, stringParam, furniIds, actionDelay ]);
|
||||
|
||||
useUiEvent(WiredEvent.SAVE_WIRED, onWiredEvent);
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { Triggerable, WiredActionDefinition } from 'nitro-renderer';
|
||||
import { Triggerable, TriggerDefinition, WiredActionDefinition } from 'nitro-renderer';
|
||||
import { GetWiredActionLayout } from './GetWiredActionLayout';
|
||||
import { GetWiredTriggerLayout } from './GetWiredTriggerLayout';
|
||||
|
||||
export function GetWiredLayout(trigger: Triggerable): JSX.Element
|
||||
{
|
||||
if(trigger instanceof WiredActionDefinition) return GetWiredActionLayout(trigger.code);
|
||||
|
||||
if(trigger instanceof TriggerDefinition) return GetWiredTriggerLayout(trigger.code);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
50
src/views/wired/common/GetWiredTriggerLayout.tsx
Normal file
50
src/views/wired/common/GetWiredTriggerLayout.tsx
Normal file
@ -0,0 +1,50 @@
|
||||
import { WiredTriggerAvatarEnterRoomView } from '../views/triggers/avatar-enter-room/WiredTriggerAvatarEnterRoomView';
|
||||
import { WiredTriggerAvatarSaysSomethingView } from '../views/triggers/avatar-says-something/WiredTriggerAvatarSaysSomethingView';
|
||||
import { WiredTriggerAvatarWalksOffFurniView } from '../views/triggers/avatar-walks-off-furni/WiredTriggerAvatarWalksOffFurniView';
|
||||
import { WiredTriggerAvatarWalksOnFurniView } from '../views/triggers/avatar-walks-on-furni/WiredTriggerAvatarWalksOnFurni';
|
||||
import { WiredTriggerBotReachedAvatarView } from '../views/triggers/bot-reached-avatar/WiredTriggerBotReachedAvatarView';
|
||||
import { WiredTriggerBotReachedStuffView } from '../views/triggers/bot-reached-stuff/WiredTriggerBotReachedStuffView';
|
||||
import { WiredTriggerCollisionView } from '../views/triggers/collision/WiredTriggerCollisionView';
|
||||
import { WiredTriggeExecuteOnceView } from '../views/triggers/execute-once/WiredTriggerExecuteOnceView';
|
||||
import { WiredTriggeExecutePeriodicallyLongView } from '../views/triggers/execute-periodically-long/WiredTriggerExecutePeriodicallyLongView';
|
||||
import { WiredTriggeExecutePeriodicallyView } from '../views/triggers/execute-periodically/WiredTriggerExecutePeriodicallyView';
|
||||
import { WiredTriggerGameEndsView } from '../views/triggers/game-ends/WiredTriggerGameEndsView';
|
||||
import { WiredTriggerGameStartsView } from '../views/triggers/game-starts/WiredTriggerGameStartsView';
|
||||
import { WiredTriggeScoreAchievedView } from '../views/triggers/score-achieved/WiredTriggerScoreAchievedView';
|
||||
import { WiredTriggerToggleFurniView } from '../views/triggers/toggle-furni/WiredTriggerToggleFurniView';
|
||||
import { WiredTriggerLayout } from './WiredTriggerLayoutCode';
|
||||
|
||||
export function GetWiredTriggerLayout(code: number): JSX.Element
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
case WiredTriggerLayout.AVATAR_ENTERS_ROOM:
|
||||
return <WiredTriggerAvatarEnterRoomView />;
|
||||
case WiredTriggerLayout.AVATAR_SAYS_SOMETHING:
|
||||
return <WiredTriggerAvatarSaysSomethingView />;
|
||||
case WiredTriggerLayout.AVATAR_WALKS_OFF_FURNI:
|
||||
return <WiredTriggerAvatarWalksOffFurniView />;
|
||||
case WiredTriggerLayout.AVATAR_WALKS_ON_FURNI:
|
||||
return <WiredTriggerAvatarWalksOnFurniView />;
|
||||
case WiredTriggerLayout.BOT_REACHED_AVATAR:
|
||||
return <WiredTriggerBotReachedAvatarView />;
|
||||
case WiredTriggerLayout.BOT_REACHED_STUFF:
|
||||
return <WiredTriggerBotReachedStuffView />;
|
||||
case WiredTriggerLayout.COLLISION:
|
||||
return <WiredTriggerCollisionView />;
|
||||
case WiredTriggerLayout.EXECUTE_ONCE:
|
||||
return <WiredTriggeExecuteOnceView />;
|
||||
case WiredTriggerLayout.EXECUTE_PERIODICALLY:
|
||||
return <WiredTriggeExecutePeriodicallyView />;
|
||||
case WiredTriggerLayout.EXECUTE_PERIODICALLY_LONG:
|
||||
return <WiredTriggeExecutePeriodicallyLongView />;
|
||||
case WiredTriggerLayout.GAME_ENDS:
|
||||
return <WiredTriggerGameEndsView />;
|
||||
case WiredTriggerLayout.GAME_STARTS:
|
||||
return <WiredTriggerGameStartsView />;
|
||||
case WiredTriggerLayout.SCORE_ACHIEVED:
|
||||
return <WiredTriggeScoreAchievedView />;
|
||||
case WiredTriggerLayout.TOGGLE_FURNI:
|
||||
return <WiredTriggerToggleFurniView />;
|
||||
}
|
||||
}
|
17
src/views/wired/common/WiredTriggerLayoutCode.ts
Normal file
17
src/views/wired/common/WiredTriggerLayoutCode.ts
Normal file
@ -0,0 +1,17 @@
|
||||
export class WiredTriggerLayout
|
||||
{
|
||||
public static AVATAR_SAYS_SOMETHING: number = 0;
|
||||
public static AVATAR_WALKS_ON_FURNI: number = 1;
|
||||
public static AVATAR_WALKS_OFF_FURNI: number = 2;
|
||||
public static EXECUTE_ONCE: number = 3;
|
||||
public static TOGGLE_FURNI: number = 4;
|
||||
public static EXECUTE_PERIODICALLY: number = 6;
|
||||
public static AVATAR_ENTERS_ROOM: number = 7;
|
||||
public static GAME_STARTS: number = 8;
|
||||
public static GAME_ENDS: number = 9;
|
||||
public static SCORE_ACHIEVED: number = 10;
|
||||
public static COLLISION: number = 11;
|
||||
public static EXECUTE_PERIODICALLY_LONG: number = 12;
|
||||
public static BOT_REACHED_STUFF: number = 13;
|
||||
public static BOT_REACHED_AVATAR: number = 14;
|
||||
}
|
@ -35,7 +35,7 @@ export const WiredActionBotChangeFigureView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group">
|
||||
<label>{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
<div className="d-flex align-items-center justify-content-center">
|
||||
|
@ -25,7 +25,7 @@ export const WiredActionBotFollowAvatarView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group mb-2">
|
||||
<label>{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
<div className="form-check">
|
||||
|
@ -27,10 +27,10 @@ export const WiredActionBotGiveHandItemView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group mb-2">
|
||||
<label>{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
<div>{ LocalizeText('wiredfurni.tooltip.handitem') }</div>
|
||||
<div className="fw-bold">{ LocalizeText('wiredfurni.tooltip.handitem') }</div>
|
||||
<select className="form-select" value={ handItemId } onChange={ (e) => setHandItemId(Number(e.target.value)) }>
|
||||
<option value="0">------</option>
|
||||
{allowedHanditemIds && allowedHanditemIds.map(value =>
|
||||
|
@ -22,7 +22,7 @@ export const WiredActionBotMoveView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID } save={ save }>
|
||||
<div className="form-group">
|
||||
<label>{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
</WiredActionBaseView>
|
||||
|
@ -30,11 +30,11 @@ export const WiredActionBotTalkToAvatarView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group mb-2">
|
||||
<label>{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
<div className="form-group mb-2">
|
||||
<label>{ LocalizeText('wiredfurni.params.message') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.message') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 64 } value={ message } onChange={ event => setMessage(event.target.value) } />
|
||||
</div>
|
||||
<div className="form-check">
|
||||
|
@ -30,11 +30,11 @@ export const WiredActionBotTalkView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group mb-2">
|
||||
<label>{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
<div className="form-group mb-2">
|
||||
<label>{ LocalizeText('wiredfurni.params.message') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.message') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 64 } value={ message } onChange={ event => setMessage(event.target.value) } />
|
||||
</div>
|
||||
<div className="form-check">
|
||||
|
@ -22,7 +22,7 @@ export const WiredActionBotTeleportView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID } save={ save }>
|
||||
<div className="form-group">
|
||||
<label>{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
</WiredActionBaseView>
|
||||
|
@ -22,7 +22,7 @@ export const WiredActionChatView: FC<{}> = props =>
|
||||
return (
|
||||
<WiredActionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group">
|
||||
<label>{ LocalizeText('wiredfurni.params.message') }</label>
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.message') }</label>
|
||||
<input type="text" className="form-control form-control-sm" value={ message } onChange={ event => setMessage(event.target.value) } />
|
||||
</div>
|
||||
</WiredActionBaseView>
|
||||
|
@ -60,9 +60,11 @@ export const WiredBaseView: FC<WiredBaseViewProps> = props =>
|
||||
<div className="fw-bold">{ wiredName }</div>
|
||||
</div>
|
||||
<div>{ wiredDescription }</div>
|
||||
<hr className="my-1 mb-2 bg-dark" />
|
||||
<div>
|
||||
{ children }
|
||||
{ !children ? null : <>
|
||||
<hr className="my-1 mb-2 bg-dark" />
|
||||
{ children }
|
||||
</> }
|
||||
</div>
|
||||
{ (requiresFurni !== WiredFurniType.STUFF_SELECTION_OPTION_NONE) &&
|
||||
<>
|
||||
|
@ -0,0 +1,10 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarEnterRoomView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null }></WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { GetSessionDataManager } from '../../../../../api';
|
||||
import { LocalizeText } from '../../../../../utils/LocalizeText';
|
||||
import { useWiredContext } from '../../../context/WiredContext';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarSaysSomethingView: FC<{}> = props =>
|
||||
{
|
||||
const [ message, setMessage ] = useState('');
|
||||
const [ triggererAvatar, setTriggererAvatar ] = useState(-1);
|
||||
const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setMessage(trigger.stringData);
|
||||
setTriggererAvatar((trigger.intData.length > 0) ? trigger.intData[0] : 0);
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(message);
|
||||
setIntParams([triggererAvatar]);
|
||||
}, [ message, triggererAvatar, setStringParam, setIntParams ]);
|
||||
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group">
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.whatissaid') }</label>
|
||||
<input type="text" className="form-control form-control-sm" value={ message } onChange={ event => setMessage(event.target.value) } />
|
||||
</div>
|
||||
<hr className="my-1 mb-2 bg-dark" />
|
||||
<div className="fw-bold">{ LocalizeText('wiredfurni.params.picktriggerer') }</div>
|
||||
<div className="form-check">
|
||||
<input className="form-check-input" type="radio" name="triggererAvatar" id="triggererAvatar0" checked={ triggererAvatar === 0 } onChange={() => setTriggererAvatar(0)} />
|
||||
<label className="form-check-label" htmlFor="triggererAvatar0">
|
||||
{ LocalizeText('wiredfurni.params.anyavatar') }
|
||||
</label>
|
||||
</div>
|
||||
<div className="form-check">
|
||||
<input className="form-check-input" type="radio" name="triggererAvatar" id="triggererAvatar1" checked={ triggererAvatar === 1 } onChange={() => setTriggererAvatar(1)} />
|
||||
<label className="form-check-label" htmlFor="triggererAvatar1">
|
||||
{ GetSessionDataManager().userName }
|
||||
</label>
|
||||
</div>
|
||||
</WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarWalksOffFurniView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_OR_BY_TYPE } save={ null }></WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerAvatarWalksOnFurniView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_OR_BY_TYPE } save={ null }></WiredTriggerBaseView>
|
||||
);
|
||||
}
|
20
src/views/wired/views/triggers/base/WiredTriggerBaseView.tsx
Normal file
20
src/views/wired/views/triggers/base/WiredTriggerBaseView.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import { FC, useCallback } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredBaseView } from '../../base/WiredBaseView';
|
||||
import { WiredTriggerBaseViewProps } from './WiredTriggerBaseView.types';
|
||||
|
||||
export const WiredTriggerBaseView: FC<WiredTriggerBaseViewProps> = props =>
|
||||
{
|
||||
const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, children = null } = props;
|
||||
|
||||
const onSave = useCallback(() =>
|
||||
{
|
||||
if(save) save();
|
||||
}, [ save ]);
|
||||
|
||||
return (
|
||||
<WiredBaseView wiredType="trigger" requiresFurni={ requiresFurni } save={ onSave }>
|
||||
{ children }
|
||||
</WiredBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
export interface WiredTriggerBaseViewProps
|
||||
{
|
||||
requiresFurni: number;
|
||||
save: () => void;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../../utils/LocalizeText';
|
||||
import { useWiredContext } from '../../../context/WiredContext';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerBotReachedAvatarView: FC<{}> = props =>
|
||||
{
|
||||
const [ botName, setBotName ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setBotName(trigger.stringData);
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
}, [ botName, setStringParam ]);
|
||||
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group">
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
</WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../../utils/LocalizeText';
|
||||
import { useWiredContext } from '../../../context/WiredContext';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerBotReachedStuffView: FC<{}> = props =>
|
||||
{
|
||||
const [ botName, setBotName ] = useState('');
|
||||
const { trigger = null, setStringParam = null } = useWiredContext();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setBotName(trigger.stringData);
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setStringParam(botName);
|
||||
}, [ botName, setStringParam ]);
|
||||
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="form-group">
|
||||
<label className="fw-bold">{ LocalizeText('wiredfurni.params.bot.name') }</label>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 32 } value={ botName } onChange={ event => setBotName(event.target.value) } />
|
||||
</div>
|
||||
</WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerCollisionView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null }></WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import Slider from 'rc-slider/lib/Slider';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../../utils/LocalizeText';
|
||||
import { useWiredContext } from '../../../context/WiredContext';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeExecuteOnceView: FC<{}> = props =>
|
||||
{
|
||||
const [ time, setTime ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setTime((trigger.intData.length > 0) ? trigger.intData[0] : 0);
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([time]);
|
||||
}, [ time, setIntParams ]);
|
||||
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="fw-bold">{ LocalizeText('wiredfurni.params.settime', [ 'seconds' ], [ time.toString() ]) }</div>
|
||||
<Slider
|
||||
defaultValue={ time }
|
||||
dots={ true }
|
||||
min={ 1 }
|
||||
max={ 60 }
|
||||
onChange={ event => setTime(event) }
|
||||
/>
|
||||
</WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import Slider from 'rc-slider/lib/Slider';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../../utils/LocalizeText';
|
||||
import { useWiredContext } from '../../../context/WiredContext';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeExecutePeriodicallyLongView: FC<{}> = props =>
|
||||
{
|
||||
const [ time, setTime ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setTime((trigger.intData.length > 0) ? trigger.intData[0] : 0);
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([time]);
|
||||
}, [ time, setIntParams ]);
|
||||
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="fw-bold">{ LocalizeText('wiredfurni.params.setlongtime', [ 'time' ], [ time.toString() ]) }</div>
|
||||
<Slider
|
||||
defaultValue={ time }
|
||||
dots={ true }
|
||||
min={ 1 }
|
||||
max={ 600 }
|
||||
onChange={ event => setTime(event) }
|
||||
/>
|
||||
</WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import Slider from 'rc-slider/lib/Slider';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../../utils/LocalizeText';
|
||||
import { useWiredContext } from '../../../context/WiredContext';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeExecutePeriodicallyView: FC<{}> = props =>
|
||||
{
|
||||
const [ time, setTime ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setTime((trigger.intData.length > 0) ? trigger.intData[0] : 0);
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([time]);
|
||||
}, [ time, setIntParams ]);
|
||||
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="fw-bold">{ LocalizeText('wiredfurni.params.settime', [ 'seconds' ], [ time.toString() ]) }</div>
|
||||
<Slider
|
||||
defaultValue={ time }
|
||||
dots={ true }
|
||||
min={ 1 }
|
||||
max={ 60 }
|
||||
onChange={ event => setTime(event) }
|
||||
/>
|
||||
</WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerGameEndsView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null }></WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerGameStartsView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null }></WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
import Slider from 'rc-slider/lib/Slider';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../../utils/LocalizeText';
|
||||
import { useWiredContext } from '../../../context/WiredContext';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggeScoreAchievedView: FC<{}> = props =>
|
||||
{
|
||||
const [ points, setPoints ] = useState(1);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setPoints((trigger.intData.length > 0) ? trigger.intData[0] : 0);
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([points]);
|
||||
}, [ points, setIntParams ]);
|
||||
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="fw-bold">{ LocalizeText('wiredfurni.params.setscore', [ 'points' ], [ points.toString() ]) }</div>
|
||||
<Slider
|
||||
defaultValue={ points }
|
||||
dots={ true }
|
||||
min={ 1 }
|
||||
max={ 1000 }
|
||||
step={ 1 }
|
||||
onChange={ event => setPoints(event) }
|
||||
/>
|
||||
</WiredTriggerBaseView>
|
||||
);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../WiredView.types';
|
||||
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
|
||||
|
||||
export const WiredTriggerToggleFurniView: FC<{}> = props =>
|
||||
{
|
||||
return (
|
||||
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_OR_BY_TYPE } save={ null }></WiredTriggerBaseView>
|
||||
);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user