mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
feat: update wired editor extras and selection handling
This commit is contained in:
@@ -81,9 +81,14 @@ export const WiredActionFurniToFurniView: FC<{}> = () =>
|
||||
if(mode === 'move' && !canEditMove) return;
|
||||
if(mode === 'target' && !canEditTarget) return;
|
||||
|
||||
const nextMoveIds = (selectionMode === 'move') ? [ ...furniIds ] : [ ...moveFurniIds ];
|
||||
const nextTargetIds = (selectionMode === 'target') ? [ ...furniIds ] : [ ...targetFurniIds ];
|
||||
|
||||
setMoveFurniIds(nextMoveIds);
|
||||
setTargetFurniIds(nextTargetIds);
|
||||
setSelectionMode(mode);
|
||||
setFurniIds([ ...(mode === 'move' ? moveFurniIds : targetFurniIds) ]);
|
||||
}, [ moveSource, targetSource, moveFurniIds, targetFurniIds, setFurniIds ]);
|
||||
setFurniIds([ ...(mode === 'move' ? nextMoveIds : nextTargetIds) ]);
|
||||
}, [ selectionMode, furniIds, moveSource, targetSource, moveFurniIds, targetFurniIds, setFurniIds ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@@ -153,10 +158,16 @@ export const WiredActionFurniToFurniView: FC<{}> = () =>
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
const nextMoveIds = (selectionMode === 'move') ? [ ...furniIds ] : [ ...moveFurniIds ];
|
||||
const nextTargetIds = (selectionMode === 'target') ? [ ...furniIds ] : [ ...targetFurniIds ];
|
||||
|
||||
setMoveFurniIds(nextMoveIds);
|
||||
setTargetFurniIds(nextTargetIds);
|
||||
|
||||
if(selectionMode === 'target')
|
||||
{
|
||||
setSelectionMode('move');
|
||||
setFurniIds([ ...moveFurniIds ]);
|
||||
setFurniIds([ ...nextMoveIds ]);
|
||||
}
|
||||
|
||||
setIntParams([
|
||||
@@ -164,8 +175,8 @@ export const WiredActionFurniToFurniView: FC<{}> = () =>
|
||||
targetSource
|
||||
]);
|
||||
|
||||
setStringParam(serializeIds(targetFurniIds));
|
||||
}, [ selectionMode, moveFurniIds, moveSource, targetSource, targetFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
setStringParam(serializeIds(nextTargetIds));
|
||||
}, [ selectionMode, furniIds, moveFurniIds, moveSource, targetSource, targetFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
|
||||
const selectionLimit = trigger?.maximumItemSelectionCount ?? 0;
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@ import { WiredActionToggleFurniStateView } from './WiredActionToggleFurniStateVi
|
||||
import { WiredActionUnfreezeView } from './WiredActionUnfreezeView';
|
||||
import { WiredExtraFilterFurniView } from '../extras/WiredExtraFilterFurniView';
|
||||
import { WiredExtraFilterUserView } from '../extras/WiredExtraFilterUserView';
|
||||
import { WiredExtraAnimationTimeView } from '../extras/WiredExtraAnimationTimeView';
|
||||
import { WiredExtraMoveCarryUsersView } from '../extras/WiredExtraMoveCarryUsersView';
|
||||
import { WiredExtraMoveNoAnimationView } from '../extras/WiredExtraMoveNoAnimationView';
|
||||
import { WiredExtraMovePhysicsView } from '../extras/WiredExtraMovePhysicsView';
|
||||
|
||||
export const WiredActionLayoutView = (code: number) =>
|
||||
{
|
||||
@@ -165,6 +169,14 @@ export const WiredActionLayoutView = (code: number) =>
|
||||
return <WiredExtraFilterFurniView />;
|
||||
case WiredActionLayoutCode.FILTER_USER_EXTRA:
|
||||
return <WiredExtraFilterUserView />;
|
||||
case WiredActionLayoutCode.MOVE_CARRY_USERS_EXTRA:
|
||||
return <WiredExtraMoveCarryUsersView />;
|
||||
case WiredActionLayoutCode.MOVE_NO_ANIMATION_EXTRA:
|
||||
return <WiredExtraMoveNoAnimationView />;
|
||||
case WiredActionLayoutCode.ANIMATION_TIME_EXTRA:
|
||||
return <WiredExtraAnimationTimeView />;
|
||||
case WiredActionLayoutCode.MOVE_PHYSICS_EXTRA:
|
||||
return <WiredExtraMovePhysicsView />;
|
||||
case WiredActionLayoutCode.SEND_SIGNAL:
|
||||
return <WiredActionSendSignalView />;
|
||||
}
|
||||
|
||||
@@ -115,17 +115,28 @@ export const WiredActionSendSignalView: FC<{}> = () =>
|
||||
if(mode === selectionMode) return;
|
||||
if(mode === 'furni' && furniSource !== SOURCE_SELECTED) return;
|
||||
|
||||
const nextAntennaIds = (selectionMode === 'antenna') ? [ ...furniIds ] : [ ...antennaIds ];
|
||||
const nextForwardFurniIds = (selectionMode === 'furni') ? [ ...furniIds ] : [ ...forwardFurniIds ];
|
||||
|
||||
setAntennaIds(nextAntennaIds);
|
||||
setForwardFurniIds(nextForwardFurniIds);
|
||||
setSelectionMode(mode);
|
||||
if(setFurniIds) setFurniIds([ ...((mode === 'antenna') ? antennaIds : forwardFurniIds) ]);
|
||||
}, [ selectionMode, furniSource, antennaIds, forwardFurniIds, setFurniIds ]);
|
||||
if(setFurniIds) setFurniIds([ ...((mode === 'antenna') ? nextAntennaIds : nextForwardFurniIds) ]);
|
||||
}, [ selectionMode, furniSource, furniIds, antennaIds, forwardFurniIds, setFurniIds ]);
|
||||
|
||||
const onChangeFurniSource = (next: number) =>
|
||||
{
|
||||
if(forwardFurniIds.length) setForwardFurniIds([]);
|
||||
const nextAntennaIds = (selectionMode === 'antenna') ? [ ...furniIds ] : [ ...antennaIds ];
|
||||
|
||||
setAntennaIds(nextAntennaIds);
|
||||
if(forwardFurniIds.length || selectionMode === 'furni')
|
||||
{
|
||||
setForwardFurniIds([]);
|
||||
}
|
||||
|
||||
if(selectionMode === 'furni')
|
||||
{
|
||||
if(setFurniIds) setFurniIds([ ...antennaIds ]);
|
||||
if(setFurniIds) setFurniIds([ ...nextAntennaIds ]);
|
||||
setSelectionMode('antenna');
|
||||
}
|
||||
|
||||
@@ -134,7 +145,19 @@ export const WiredActionSendSignalView: FC<{}> = () =>
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
const antennaSource = (antennaIds && antennaIds.length) ? antennaIds[0] : 0;
|
||||
const nextAntennaIds = (selectionMode === 'antenna') ? [ ...furniIds ] : [ ...antennaIds ];
|
||||
const nextForwardFurniIds = (selectionMode === 'furni') ? [ ...furniIds ] : [ ...forwardFurniIds ];
|
||||
|
||||
setAntennaIds(nextAntennaIds);
|
||||
setForwardFurniIds(nextForwardFurniIds);
|
||||
|
||||
if(selectionMode === 'furni')
|
||||
{
|
||||
setSelectionMode('antenna');
|
||||
if(setFurniIds) setFurniIds([ ...nextAntennaIds ]);
|
||||
}
|
||||
|
||||
const antennaSource = (nextAntennaIds && nextAntennaIds.length) ? nextAntennaIds[0] : 0;
|
||||
|
||||
setIntParams([
|
||||
antennaSource,
|
||||
@@ -145,8 +168,8 @@ export const WiredActionSendSignalView: FC<{}> = () =>
|
||||
0,
|
||||
]);
|
||||
|
||||
setStringParam(serializeForwardIds(forwardFurniIds));
|
||||
}, [ antennaIds, furniSource, userSource, signalPerFurni, signalPerUser, forwardFurniIds, setIntParams, setStringParam ]);
|
||||
setStringParam(serializeForwardIds(nextForwardFurniIds));
|
||||
}, [ selectionMode, furniIds, antennaIds, furniSource, userSource, signalPerFurni, signalPerUser, forwardFurniIds, setFurniIds, setIntParams, setStringParam ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user