-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added actions to position/scale/rotate on player/camera or any position, and to follow/unfollow player * fix: clone * feat: basic smart items working * feat: customize counter bar * fix: counter bar default value * feat: increment/decrease amount * feat: random and batch actions * feat: layers and hits * feat: refactor proximity to damage * feat: heal player integration * feat: support relative * feat: added health category * feat: upgrade @dcl/asset-packs * chore: fix test * feat: feedback * fix: follow player action
- Loading branch information
Showing
50 changed files
with
1,166 additions
and
73 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...@dcl/inspector/src/components/EntityInspector/ActionInspector/BatchAction/BatchAction.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.BatchActionContainer { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
} |
45 changes: 45 additions & 0 deletions
45
...@dcl/inspector/src/components/EntityInspector/ActionInspector/BatchAction/BatchAction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useCallback, useEffect, useMemo, useState } from 'react' | ||
import { ActionPayload, ActionType } from '@dcl/asset-packs' | ||
import { recursiveCheck } from 'jest-matcher-deep-close-to/lib/recursiveCheck' | ||
import { Block } from '../../../Block' | ||
import { Dropdown } from '../../../ui' | ||
import type { DropdownChangeEvent } from '../../../ui' | ||
import type { Props } from './types' | ||
|
||
import './BatchAction.css' | ||
|
||
function isValid(payload: Partial<ActionPayload<ActionType.RANDOM>>): payload is ActionPayload<ActionType.RANDOM> { | ||
return payload.actions !== undefined && payload.actions.length > 0 | ||
} | ||
|
||
const BatchAction: React.FC<Props> = ({ availableActions, value, onUpdate }: Props) => { | ||
const [payload, setPayload] = useState<Partial<ActionPayload<ActionType.RANDOM>>>({ | ||
...value | ||
}) | ||
|
||
useEffect(() => { | ||
if (!recursiveCheck(payload, value, 2) || !isValid(payload)) return | ||
onUpdate(payload) | ||
}, [payload, onUpdate]) | ||
|
||
const actions = useMemo(() => { | ||
return availableActions.map((action) => ({ value: action.name, label: action.name })) | ||
}, [availableActions]) | ||
|
||
const handleChangeAction = useCallback( | ||
({ target: { value } }: DropdownChangeEvent) => { | ||
setPayload({ ...payload, actions: value as any[] }) | ||
}, | ||
[payload, setPayload] | ||
) | ||
|
||
return ( | ||
<div className="BatchActionContainer"> | ||
<Block> | ||
<Dropdown label="Action(s)" options={actions} value={payload.actions} multiple onChange={handleChangeAction} /> | ||
</Block> | ||
</div> | ||
) | ||
} | ||
|
||
export default BatchAction |
3 changes: 3 additions & 0 deletions
3
packages/@dcl/inspector/src/components/EntityInspector/ActionInspector/BatchAction/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import BatchAction from './BatchAction' | ||
|
||
export { BatchAction } |
7 changes: 7 additions & 0 deletions
7
packages/@dcl/inspector/src/components/EntityInspector/ActionInspector/BatchAction/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Action, ActionPayload, ActionType } from '@dcl/asset-packs' | ||
|
||
export interface Props { | ||
availableActions: Action[] | ||
value: Partial<ActionPayload<ActionType.BATCH>> | ||
onUpdate: (value: ActionPayload<ActionType.BATCH>) => void | ||
} |
Oops, something went wrong.