-
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.
chore: helper functions for InputModifier (#1035)
* Initial implementation of helper function for InputModifier * Updated protocol, regenerated API and run a lint pass * Added addStandardModifier helper function * Fixed properties naming * Helper function iteration. Added documentation. * Helper function iteration. Added documentation. * Added helper function to @dcl/ecs/src/components/Index.ts * Lint fix * Updated index.ts and types.ts * Updated API * Updated types.ts and API * fix tests * Updated InputModifier helper and tests * update playground assetsmd * Removed unused import --------- Co-authored-by: Gonzalo DCL <[email protected]>
- Loading branch information
1 parent
c13aef2
commit 2c002ca
Showing
25 changed files
with
151 additions
and
62 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
44 changes: 44 additions & 0 deletions
44
packages/@dcl/ecs/src/components/extended/InputModifier.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,44 @@ | ||
import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine' | ||
import { InputModifier, PBInputModifier_StandardInput, PBInputModifier } from '../generated/index.gen' | ||
import {} from '../generated/InputModifier.gen' | ||
|
||
/** | ||
* @public | ||
*/ | ||
export interface InputModifierHelper { | ||
/** | ||
* @returns a input modifier mode | ||
*/ | ||
Standard: (standard: PBInputModifier_StandardInput) => PBInputModifier['mode'] | ||
} | ||
|
||
/** | ||
* @public | ||
*/ | ||
export interface InputModifierComponentDefinitionExtended | ||
extends LastWriteWinElementSetComponentDefinition<PBInputModifier> { | ||
/** | ||
* InputModifier helper with constructor | ||
*/ | ||
Mode: InputModifierHelper | ||
} | ||
|
||
const InputModifierHelper: InputModifierHelper = { | ||
Standard(standard: PBInputModifier_StandardInput) { | ||
return { | ||
$case: 'standard', | ||
standard | ||
} | ||
} | ||
} | ||
|
||
export function defineInputModifierComponent( | ||
engine: Pick<IEngine, 'defineComponentFromSchema'> | ||
): InputModifierComponentDefinitionExtended { | ||
const theComponent = InputModifier(engine) | ||
|
||
return { | ||
...theComponent, | ||
Mode: InputModifierHelper | ||
} | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.