mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
ℹ️ Release wired : wf_slc_furni_area
This commit is contained in:
@@ -26,4 +26,5 @@ export class WiredActionLayoutCode
|
||||
public static BOT_FOLLOW_AVATAR: number = 25;
|
||||
public static BOT_CHANGE_FIGURE: number = 26;
|
||||
public static BOT_TALK_DIRECT_TO_AVTR: number = 27;
|
||||
public static FURNI_AREA_SELECTOR: number = 28;
|
||||
}
|
||||
|
||||
@@ -163,8 +163,7 @@ export const NavigatorRoomSettingsBasicTabView: FC<NavigatorRoomSettingsTabViewP
|
||||
<Text>{ LocalizeText('navigator.roomsettings.allow_walk_through') }</Text>
|
||||
</Flex>
|
||||
<Text variant="danger" underline bold pointer className="d-flex justify-content-center align-items-center gap-1" onClick={ deleteRoom }>
|
||||
<FaTimes className="fa-icon" />
|
||||
{ LocalizeText('navigator.roomsettings.delete') }
|
||||
<FaTimes className="fa-icon" /> { LocalizeText('navigator.roomsettings.delete') }
|
||||
</Text>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GetSessionDataManager } from '@nitrots/nitro-renderer';
|
||||
import { FC, PropsWithChildren, useEffect, useState } from 'react';
|
||||
import { CSSProperties, FC, PropsWithChildren, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType, WiredSelectionVisualizer } from '../../../api';
|
||||
import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common';
|
||||
import { useWired } from '../../../hooks';
|
||||
@@ -12,11 +12,12 @@ export interface WiredBaseViewProps
|
||||
hasSpecialInput: boolean;
|
||||
save: () => void;
|
||||
validate?: () => boolean;
|
||||
cardStyle?: CSSProperties;
|
||||
}
|
||||
|
||||
export const WiredBaseView: FC<PropsWithChildren<WiredBaseViewProps>> = props =>
|
||||
{
|
||||
const { wiredType = '', requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, validate = null, children = null, hasSpecialInput = false } = props;
|
||||
const { wiredType = '', requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, validate = null, children = null, hasSpecialInput = false, cardStyle = undefined } = props;
|
||||
const [ wiredName, setWiredName ] = useState<string>(null);
|
||||
const [ wiredDescription, setWiredDescription ] = useState<string>(null);
|
||||
const [ needsSave, setNeedsSave ] = useState<boolean>(false);
|
||||
@@ -87,7 +88,7 @@ export const WiredBaseView: FC<PropsWithChildren<WiredBaseViewProps>> = props =>
|
||||
}, [ trigger, hasSpecialInput, requiresFurni, setIntParams, setStringParam, setFurniIds, setAllowsFurni ]);
|
||||
|
||||
return (
|
||||
<NitroCardView className="nitro-wired" theme="primary-slim" uniqueKey="nitro-wired">
|
||||
<NitroCardView className="nitro-wired" theme="primary-slim" uniqueKey="nitro-wired" style={ cardStyle }>
|
||||
<NitroCardHeaderView headerText={ LocalizeText('wiredfurni.title') } onCloseClick={ onClose } />
|
||||
<NitroCardContentView>
|
||||
<div className="flex flex-col gap-1">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WiredActionDefinition } from '@nitrots/nitro-renderer';
|
||||
import { FC, PropsWithChildren, useEffect } from 'react';
|
||||
import { CSSProperties, FC, PropsWithChildren, useEffect } from 'react';
|
||||
import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api';
|
||||
import { Slider, Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
@@ -10,11 +10,12 @@ export interface WiredActionBaseViewProps
|
||||
hasSpecialInput: boolean;
|
||||
requiresFurni: number;
|
||||
save: () => void;
|
||||
cardStyle?: CSSProperties;
|
||||
}
|
||||
|
||||
export const WiredActionBaseView: FC<PropsWithChildren<WiredActionBaseViewProps>> = props =>
|
||||
{
|
||||
const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, hasSpecialInput = false, children = null } = props;
|
||||
const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, hasSpecialInput = false, children = null, cardStyle = undefined } = props;
|
||||
const { trigger = null, actionDelay = 0, setActionDelay = null } = useWired();
|
||||
|
||||
useEffect(() =>
|
||||
@@ -23,7 +24,7 @@ export const WiredActionBaseView: FC<PropsWithChildren<WiredActionBaseViewProps>
|
||||
}, [ trigger, setActionDelay ]);
|
||||
|
||||
return (
|
||||
<WiredBaseView hasSpecialInput={ hasSpecialInput } requiresFurni={ requiresFurni } save={ save } wiredType="action">
|
||||
<WiredBaseView hasSpecialInput={ hasSpecialInput } requiresFurni={ requiresFurni } save={ save } wiredType="action" cardStyle={ cardStyle }>
|
||||
{ children }
|
||||
{ !!children && <hr className="m-0 bg-dark" /> }
|
||||
<div className="flex flex-col">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { WiredActionLayoutCode } from '../../../../api';
|
||||
import { WiredActionBotChangeFigureView } from './WiredActionBotChangeFigureView';
|
||||
import { WiredActionFurniAreaView } from '../selectors/WiredActionFurniAreaView';
|
||||
import { WiredActionBotFollowAvatarView } from './WiredActionBotFollowAvatarView';
|
||||
import { WiredActionBotGiveHandItemView } from './WiredActionBotGiveHandItemView';
|
||||
import { WiredActionBotMoveView } from './WiredActionBotMoveView';
|
||||
@@ -79,6 +80,8 @@ export const WiredActionLayoutView = (code: number) =>
|
||||
return <WiredActionTeleportView />;
|
||||
case WiredActionLayoutCode.TOGGLE_FURNI_STATE:
|
||||
return <WiredActionToggleFurniStateView />;
|
||||
case WiredActionLayoutCode.FURNI_AREA_SELECTOR:
|
||||
return <WiredActionFurniAreaView />;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
import { GetRoomEngine, RoomAreaSelectionManager } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Button, Text } from '../../../../common';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredActionBaseView } from '../actions/WiredActionBaseView';
|
||||
|
||||
export const WiredActionFurniAreaView: FC<{}> = props =>
|
||||
{
|
||||
const [ rootX, setRootX ] = useState(0);
|
||||
const [ rootY, setRootY ] = useState(0);
|
||||
const [ areaWidth, setAreaWidth ] = useState(0);
|
||||
const [ areaHeight, setAreaHeight ] = useState(0);
|
||||
const { trigger = null, setIntParams } = useWired();
|
||||
|
||||
const save = useCallback(() =>
|
||||
{
|
||||
setIntParams([ rootX, rootY, areaWidth, areaHeight ]);
|
||||
}, [ rootX, rootY, areaWidth, areaHeight, setIntParams ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
const callback = (x: number, y: number, w: number, h: number) =>
|
||||
{
|
||||
setRootX(x);
|
||||
setRootY(y);
|
||||
setAreaWidth(w);
|
||||
setAreaHeight(h);
|
||||
};
|
||||
|
||||
const activated = GetRoomEngine().areaSelectionManager.activate(callback, RoomAreaSelectionManager.HIGHLIGHT_BRIGHTEN);
|
||||
|
||||
if(activated)
|
||||
{
|
||||
if(trigger.intData.length >= 4 && trigger.intData[2] > 0 && trigger.intData[3] > 0)
|
||||
{
|
||||
GetRoomEngine().areaSelectionManager.setHighlight(
|
||||
trigger.intData[0],
|
||||
trigger.intData[1],
|
||||
trigger.intData[2],
|
||||
trigger.intData[3]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return () =>
|
||||
{
|
||||
GetRoomEngine().areaSelectionManager.deactivate();
|
||||
};
|
||||
}, [ trigger ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
|
||||
if(trigger.intData.length >= 4)
|
||||
{
|
||||
setRootX(trigger.intData[0]);
|
||||
setRootY(trigger.intData[1]);
|
||||
setAreaWidth(trigger.intData[2]);
|
||||
setAreaHeight(trigger.intData[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
setRootX(0);
|
||||
setRootY(0);
|
||||
setAreaWidth(0);
|
||||
setAreaHeight(0);
|
||||
}
|
||||
}, [ trigger ]);
|
||||
|
||||
const hasArea = areaWidth > 0 && areaHeight > 0;
|
||||
|
||||
return (
|
||||
<WiredActionBaseView hasSpecialInput={ true } requiresFurni={ 0 } save={ save } cardStyle={ { width: '385px', height: '365px' } }>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.area_selection') }</Text>
|
||||
<Text small>{ LocalizeText('wiredfurni.params.area_selection.info') }</Text>
|
||||
|
||||
{ hasArea &&
|
||||
<Text small>
|
||||
{ LocalizeText('wiredfurni.params.area_selection.selected', [ 'x', 'y', 'w', 'h' ], [ rootX.toString(), rootY.toString(), areaWidth.toString(), areaHeight.toString() ]) }
|
||||
</Text> }
|
||||
|
||||
<div className="flex gap-1">
|
||||
<Button fullWidth variant="primary" onClick={ () => GetRoomEngine().areaSelectionManager.startSelecting() }>
|
||||
{ LocalizeText('wiredfurni.params.area_selection.select') }
|
||||
</Button>
|
||||
<Button fullWidth variant="secondary" onClick={ () => GetRoomEngine().areaSelectionManager.clearHighlight() }>
|
||||
{ LocalizeText('wiredfurni.params.area_selection.clear') }
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</WiredActionBaseView>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user