mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
Merge pull request #51 from Lorenzune/feature/wired-followups-20260324
Polish wired extra and trigger editors
This commit is contained in:
@@ -60,4 +60,6 @@ export class WiredActionLayoutCode
|
||||
public static MOVE_NO_ANIMATION_EXTRA: number = 59;
|
||||
public static ANIMATION_TIME_EXTRA: number = 60;
|
||||
public static MOVE_PHYSICS_EXTRA: number = 61;
|
||||
public static UNSEEN_EXTRA: number = 62;
|
||||
public static RANDOM_EXTRA: number = 63;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ import { WiredExtraAnimationTimeView } from '../extras/WiredExtraAnimationTimeVi
|
||||
import { WiredExtraMoveCarryUsersView } from '../extras/WiredExtraMoveCarryUsersView';
|
||||
import { WiredExtraMoveNoAnimationView } from '../extras/WiredExtraMoveNoAnimationView';
|
||||
import { WiredExtraMovePhysicsView } from '../extras/WiredExtraMovePhysicsView';
|
||||
import { WiredExtraRandomView } from '../extras/WiredExtraRandomView';
|
||||
import { WiredExtraUnseenView } from '../extras/WiredExtraUnseenView';
|
||||
|
||||
export const WiredActionLayoutView = (code: number) =>
|
||||
{
|
||||
@@ -177,6 +179,10 @@ export const WiredActionLayoutView = (code: number) =>
|
||||
return <WiredExtraAnimationTimeView />;
|
||||
case WiredActionLayoutCode.MOVE_PHYSICS_EXTRA:
|
||||
return <WiredExtraMovePhysicsView />;
|
||||
case WiredActionLayoutCode.UNSEEN_EXTRA:
|
||||
return <WiredExtraUnseenView />;
|
||||
case WiredActionLayoutCode.RANDOM_EXTRA:
|
||||
return <WiredExtraRandomView />;
|
||||
case WiredActionLayoutCode.SEND_SIGNAL:
|
||||
return <WiredActionSendSignalView />;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { Slider, Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredExtraBaseView } from './WiredExtraBaseView';
|
||||
@@ -37,9 +37,7 @@ export const WiredExtraAnimationTimeView: FC<{}> = () =>
|
||||
return (
|
||||
<WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 380 } }>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.anim_time.title') }</Text>
|
||||
<Text>{ LocalizeText('wiredfurni.params.anim_time.description') }</Text>
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.anim_time.value', [ 'ms' ], [ duration.toString() ]) }</Text>
|
||||
<Text bold>{ duration } ms</Text>
|
||||
<Slider min={ MIN_DURATION } max={ MAX_DURATION } step={ STEP_DURATION } value={ duration } onChange={ value => setDuration(normalizeDuration(Array.isArray(value) ? value[0] : Number(value))) } />
|
||||
</div>
|
||||
</WiredExtraBaseView>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Text } from '../../../../common';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredExtraBaseView } from './WiredExtraBaseView';
|
||||
|
||||
@@ -14,12 +13,5 @@ export const WiredExtraMoveNoAnimationView: FC<{}> = () =>
|
||||
setStringParam('');
|
||||
};
|
||||
|
||||
return (
|
||||
<WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 360 } }>
|
||||
<div className="flex flex-col gap-1">
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.mov_no_animation.title') }</Text>
|
||||
<Text>{ LocalizeText('wiredfurni.params.mov_no_animation.description') }</Text>
|
||||
</div>
|
||||
</WiredExtraBaseView>
|
||||
);
|
||||
return <WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 320 } } />;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Slider, Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredExtraBaseView } from './WiredExtraBaseView';
|
||||
|
||||
const MIN_PICK_AMOUNT = 1;
|
||||
const MIN_SKIP_EXECUTIONS = 0;
|
||||
const MAX_RANDOM_VALUE = 1000;
|
||||
|
||||
const normalizePickAmount = (value: number) =>
|
||||
{
|
||||
if(isNaN(value)) return MIN_PICK_AMOUNT;
|
||||
|
||||
return Math.max(MIN_PICK_AMOUNT, Math.min(MAX_RANDOM_VALUE, Math.floor(value)));
|
||||
};
|
||||
|
||||
const normalizeSkipExecutions = (value: number) =>
|
||||
{
|
||||
if(isNaN(value)) return MIN_SKIP_EXECUTIONS;
|
||||
|
||||
return Math.max(MIN_SKIP_EXECUTIONS, Math.min(MAX_RANDOM_VALUE, Math.floor(value)));
|
||||
};
|
||||
|
||||
export const WiredExtraRandomView: FC<{}> = () =>
|
||||
{
|
||||
const { trigger = null, setIntParams = null, setStringParam = null } = useWired();
|
||||
const [ pickAmount, setPickAmount ] = useState(MIN_PICK_AMOUNT);
|
||||
const [ skipExecutions, setSkipExecutions ] = useState(MIN_SKIP_EXECUTIONS);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
setPickAmount(normalizePickAmount((trigger.intData.length > 0) ? trigger.intData[0] : MIN_PICK_AMOUNT));
|
||||
setSkipExecutions(normalizeSkipExecutions((trigger.intData.length > 1) ? trigger.intData[1] : MIN_SKIP_EXECUTIONS));
|
||||
}, [ trigger ]);
|
||||
|
||||
const save = () =>
|
||||
{
|
||||
setIntParams([ normalizePickAmount(pickAmount), normalizeSkipExecutions(skipExecutions) ]);
|
||||
setStringParam('');
|
||||
};
|
||||
|
||||
return (
|
||||
<WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 380 } }>
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex flex-col gap-1">
|
||||
<Text>{ LocalizeText('wiredfurni.params.pickamount', [ 'picks' ], [ pickAmount.toString() ]) }</Text>
|
||||
<Slider
|
||||
max={ MAX_RANDOM_VALUE }
|
||||
min={ MIN_PICK_AMOUNT }
|
||||
step={ 1 }
|
||||
value={ pickAmount }
|
||||
onChange={ value => setPickAmount(normalizePickAmount(Array.isArray(value) ? value[0] : Number(value))) } />
|
||||
<Text small>{ pickAmount }</Text>
|
||||
</div>
|
||||
<div className="flex flex-col gap-1">
|
||||
<Text>{ LocalizeText('wiredfurni.params.skipactions', [ 'skips' ], [ skipExecutions.toString() ]) }</Text>
|
||||
<Slider
|
||||
max={ MAX_RANDOM_VALUE }
|
||||
min={ MIN_SKIP_EXECUTIONS }
|
||||
step={ 1 }
|
||||
value={ skipExecutions }
|
||||
onChange={ value => setSkipExecutions(normalizeSkipExecutions(Array.isArray(value) ? value[0] : Number(value))) } />
|
||||
<Text small>{ skipExecutions }</Text>
|
||||
</div>
|
||||
</div>
|
||||
</WiredExtraBaseView>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { FC } from 'react';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredExtraBaseView } from './WiredExtraBaseView';
|
||||
|
||||
export const WiredExtraUnseenView: FC<{}> = () =>
|
||||
{
|
||||
const { setIntParams = null, setStringParam = null } = useWired();
|
||||
|
||||
const save = () =>
|
||||
{
|
||||
setIntParams([]);
|
||||
setStringParam('');
|
||||
};
|
||||
|
||||
return <WiredExtraBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save } cardStyle={ { width: 320 } } />;
|
||||
};
|
||||
@@ -16,10 +16,11 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = () =>
|
||||
const [ hideMessage, setHideMessage ] = useState(false);
|
||||
const [ ownerOnly, setOwnerOnly ] = useState(false);
|
||||
const { trigger = null, setStringParam = null, setIntParams = null } = useWired();
|
||||
const isAnyTextMode = (matchMode === MATCH_ALL);
|
||||
|
||||
const save = () =>
|
||||
{
|
||||
setStringParam(message);
|
||||
setStringParam(isAnyTextMode ? '' : message);
|
||||
setIntParams([
|
||||
matchMode,
|
||||
hideMessage ? 1 : 0,
|
||||
@@ -39,7 +40,11 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = () =>
|
||||
<WiredTriggerBaseView hasSpecialInput={ true } requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_NONE } save={ save }>
|
||||
<div className="flex flex-col gap-1">
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.whatissaid') }</Text>
|
||||
<NitroInput type="text" value={ message } onChange={ event => setMessage(event.target.value) } />
|
||||
<NitroInput
|
||||
disabled={ isAnyTextMode }
|
||||
type="text"
|
||||
value={ isAnyTextMode ? '' : message }
|
||||
onChange={ event => setMessage(event.target.value) } />
|
||||
</div>
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-1">
|
||||
|
||||
Reference in New Issue
Block a user