Update triggers

This commit is contained in:
Bill 2021-06-29 02:20:50 -04:00
parent 49131d0137
commit 7e54c5a219
13 changed files with 65 additions and 75 deletions

View File

@ -47,4 +47,6 @@ export function GetWiredTriggerLayout(code: number): JSX.Element
case WiredTriggerLayout.TOGGLE_FURNI:
return <WiredTriggerToggleFurniView />;
}
return null;
}

View File

@ -18,27 +18,31 @@ export const WiredTriggerAvatarEnterRoomView: FC<{}> = props =>
const save = useCallback(() =>
{
if(avatarMode === 1)
setStringParam(username);
else
setStringParam('');
if(avatarMode === 1) setStringParam(username);
else setStringParam('');
}, [ username, avatarMode, setStringParam ]);
return (
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
<div className="form-check">
<input className="form-check-input" type="radio" name="avatarMode" id="avatarMode0" checked={ avatarMode === 0 } onChange={() => setAvatarMode(0)} />
<label className="form-check-label" htmlFor="avatarMode0">
{ LocalizeText('wiredfurni.params.anyavatar') }
</label>
<div className="form-group">
<label className="fw-bold">{ LocalizeText('wiredfurni.params.picktriggerer') }</label>
<div className="form-check">
<input className="form-check-input" type="radio" name="avatarMode" id="avatarMode0" checked={ (avatarMode === 0) } onChange={ event => setAvatarMode(0) } />
<label className="form-check-label" htmlFor="avatarMode0">
{ LocalizeText('wiredfurni.params.anyavatar') }
</label>
</div>
<div className="form-check">
<input className="form-check-input" type="radio" name="avatarMode" id="avatarMode1" checked={ (avatarMode === 1) } onChange={ event => setAvatarMode(1) } />
<label className="form-check-label" htmlFor="avatarMode1">
{ LocalizeText('wiredfurni.params.certainavatar') }
</label>
</div>
</div>
<div className="form-check">
<input className="form-check-input" type="radio" name="avatarMode" id="avatarMode1" checked={ avatarMode === 1 } onChange={() => setAvatarMode(1)} />
<label className="form-check-label" htmlFor="avatarMode1">
{ LocalizeText('wiredfurni.params.certainavatar') }
</label>
</div>
{ avatarMode === 1 && <input type="text" className="form-control form-control-sm" value={ username } onChange={ event => setUsername(event.target.value) } /> }
{ (avatarMode === 1) &&
<div className="form-group">
<input type="text" className="form-control form-control-sm" value={ username } onChange={ event => setUsername(event.target.value) } />
</div> }
</WiredTriggerBaseView>
);
}

View File

@ -20,28 +20,29 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = props =>
const save = useCallback(() =>
{
setStringParam(message);
setIntParams([triggererAvatar]);
setIntParams([ triggererAvatar ]);
}, [ message, triggererAvatar, setStringParam, setIntParams ]);
return (
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
<div className="form-group">
<div className="form-group mb-2">
<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 className="form-group">
<label className="fw-bold">{ LocalizeText('wiredfurni.params.picktriggerer') }</label>
<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>
</div>
</WiredTriggerBaseView>
);

View File

@ -4,7 +4,5 @@ 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>
);
return <WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_OR_BY_TYPE } save={ null } />;
}

View File

@ -4,7 +4,5 @@ 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>
);
return <WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_OR_BY_TYPE } save={ null } />;
}

View File

@ -4,7 +4,5 @@ import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
export const WiredTriggerCollisionView: FC<{}> = props =>
{
return (
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null }></WiredTriggerBaseView>
);
return <WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null } />;
}

View File

@ -1,6 +1,7 @@
import Slider from 'rc-slider/lib/Slider';
import { FC, useCallback, useEffect, useState } from 'react';
import { LocalizeText } from '../../../../../utils/LocalizeText';
import { GetWiredTimeLocale } from '../../../common/GetWiredTimeLocale';
import { useWiredContext } from '../../../context/WiredContext';
import { WiredFurniType } from '../../../WiredView.types';
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
@ -17,19 +18,17 @@ export const WiredTriggeExecuteOnceView: FC<{}> = props =>
const save = useCallback(() =>
{
setIntParams([time]);
}, [ time, setIntParams ]);
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>
<div className="fw-bold">{ LocalizeText('wiredfurni.params.settime', [ 'seconds' ], [ GetWiredTimeLocale(time) ]) }</div>
<Slider
defaultValue={ time }
dots={ true }
value={ time }
min={ 1 }
max={ 60 }
onChange={ event => setTime(event) }
/>
max={ 1200 }
onChange={ event => setTime(event) } />
</WiredTriggerBaseView>
);
}

View File

@ -1,3 +1,4 @@
import { FriendlyTime } from 'nitro-renderer';
import Slider from 'rc-slider/lib/Slider';
import { FC, useCallback, useEffect, useState } from 'react';
import { LocalizeText } from '../../../../../utils/LocalizeText';
@ -17,19 +18,17 @@ export const WiredTriggeExecutePeriodicallyLongView: FC<{}> = props =>
const save = useCallback(() =>
{
setIntParams([time]);
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>
<div className="fw-bold">{ LocalizeText('wiredfurni.params.setlongtime', [ 'time' ], [ FriendlyTime.format(time * 5).toString() ]) }</div>
<Slider
defaultValue={ time }
dots={ true }
value={ time }
min={ 1 }
max={ 600 }
onChange={ event => setTime(event) }
/>
max={ 120 }
onChange={ event => setTime(event) } />
</WiredTriggerBaseView>
);
}

View File

@ -1,6 +1,7 @@
import Slider from 'rc-slider/lib/Slider';
import { FC, useCallback, useEffect, useState } from 'react';
import { LocalizeText } from '../../../../../utils/LocalizeText';
import { GetWiredTimeLocale } from '../../../common/GetWiredTimeLocale';
import { useWiredContext } from '../../../context/WiredContext';
import { WiredFurniType } from '../../../WiredView.types';
import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
@ -17,19 +18,17 @@ export const WiredTriggeExecutePeriodicallyView: FC<{}> = props =>
const save = useCallback(() =>
{
setIntParams([time]);
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>
<div className="fw-bold">{ LocalizeText('wiredfurni.params.settime', [ 'seconds' ], [ GetWiredTimeLocale(time) ]) }</div>
<Slider
defaultValue={ time }
dots={ true }
value={ time }
min={ 1 }
max={ 60 }
onChange={ event => setTime(event) }
/>
onChange={ event => setTime(event) }/>
</WiredTriggerBaseView>
);
}

View File

@ -4,7 +4,5 @@ import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
export const WiredTriggerGameEndsView: FC<{}> = props =>
{
return (
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null }></WiredTriggerBaseView>
);
return <WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null } />;
}

View File

@ -4,7 +4,5 @@ import { WiredTriggerBaseView } from '../base/WiredTriggerBaseView';
export const WiredTriggerGameStartsView: FC<{}> = props =>
{
return (
<WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null }></WiredTriggerBaseView>
);
return <WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ null } />;
}

View File

@ -17,20 +17,18 @@ export const WiredTriggeScoreAchievedView: FC<{}> = props =>
const save = useCallback(() =>
{
setIntParams([points]);
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 }
value={ points }
min={ 1 }
max={ 1000 }
step={ 1 }
onChange={ event => setPoints(event) }
/>
onChange={ event => setPoints(event) } />
</WiredTriggerBaseView>
);
}

View File

@ -4,7 +4,5 @@ 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>
);
return <WiredTriggerBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID_OR_BY_TYPE } save={ null } />;
}