How to use the oni-save-parser.getAccessoryOfType function in oni-save-parser

To help you get started, we’ve selected a few oni-save-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RoboPhred / oni-duplicity / src / services / save-editor / duplicants / appearance / selectors.ts View on Github external
accessorizerBehavior => {
                if(!accessorizerBehavior) return null;
                const accessory = getAccessoryOfType(accessorizerBehavior.parsedData.accessories, type);
                if (!accessory) return null;
                return accessory.guid.Guid;
            }
        );
github RoboPhred / oni-duplicity / src / pages / SaveEditor / pages / Duplicants / pages / Appearance / component.tsx View on Github external
render() {
        const { duplicant } = this.props;
        const accessorizer = duplicant.getBehavior(AccessorizerBehavior);
        if (!accessorizer) return <div>Error: No AccessorizerBehavior found</div>;
        const accessories = accessorizer.templateData.accessories;

        const eyesAccessory = getAccessoryOfType(accessories, "eyes");
        const headAccessory = getAccessoryOfType(accessories, "headshape");
        const hairAccessory = getAccessoryOfType(accessories, "hair");
        const mouthAccessory = getAccessoryOfType(accessories, "mouth");
        const bodyAccessory = getAccessoryOfType(accessories, "body");

        const eyes = eyesAccessory ? eyesAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const head = headAccessory ? headAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const hair = hairAccessory ? hairAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const mouth = mouthAccessory ? mouthAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const body = bodyAccessory ? bodyAccessory.guid.Guid : "[Error: Accessory Not Found]";

        return (
            <div>
                
                
                
                
                
            </div>
github RoboPhred / oni-duplicity / src / pages / SaveEditor / pages / Duplicants / pages / Appearance / component.tsx View on Github external
render() {
        const { duplicant } = this.props;
        const accessorizer = duplicant.getBehavior(AccessorizerBehavior);
        if (!accessorizer) return <div>Error: No AccessorizerBehavior found</div>;
        const accessories = accessorizer.templateData.accessories;

        const eyesAccessory = getAccessoryOfType(accessories, "eyes");
        const headAccessory = getAccessoryOfType(accessories, "headshape");
        const hairAccessory = getAccessoryOfType(accessories, "hair");
        const mouthAccessory = getAccessoryOfType(accessories, "mouth");
        const bodyAccessory = getAccessoryOfType(accessories, "body");

        const eyes = eyesAccessory ? eyesAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const head = headAccessory ? headAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const hair = hairAccessory ? hairAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const mouth = mouthAccessory ? mouthAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const body = bodyAccessory ? bodyAccessory.guid.Guid : "[Error: Accessory Not Found]";

        return (
            <div>
                
                
                
                
                
            </div>
        );
github RoboPhred / oni-duplicity / src / components / DuplicantPortrait.tsx View on Github external
style={{
          left: 126 * scale,
          top: 150 * scale,
          transform: `scale(${scale})`
        }}
      &gt;
github RoboPhred / oni-duplicity / src / pages / SaveEditor / pages / Duplicants / pages / Appearance / component.tsx View on Github external
render() {
        const { duplicant } = this.props;
        const accessorizer = duplicant.getBehavior(AccessorizerBehavior);
        if (!accessorizer) return <div>Error: No AccessorizerBehavior found</div>;
        const accessories = accessorizer.templateData.accessories;

        const eyesAccessory = getAccessoryOfType(accessories, "eyes");
        const headAccessory = getAccessoryOfType(accessories, "headshape");
        const hairAccessory = getAccessoryOfType(accessories, "hair");
        const mouthAccessory = getAccessoryOfType(accessories, "mouth");
        const bodyAccessory = getAccessoryOfType(accessories, "body");

        const eyes = eyesAccessory ? eyesAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const head = headAccessory ? headAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const hair = hairAccessory ? hairAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const mouth = mouthAccessory ? mouthAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const body = bodyAccessory ? bodyAccessory.guid.Guid : "[Error: Accessory Not Found]";

        return (
            <div>
                
                
                </div>
github RoboPhred / oni-duplicity / src / pages / SaveEditor / pages / Duplicants / pages / Appearance / component.tsx View on Github external
render() {
        const { duplicant } = this.props;
        const accessorizer = duplicant.getBehavior(AccessorizerBehavior);
        if (!accessorizer) return <div>Error: No AccessorizerBehavior found</div>;
        const accessories = accessorizer.templateData.accessories;

        const eyesAccessory = getAccessoryOfType(accessories, "eyes");
        const headAccessory = getAccessoryOfType(accessories, "headshape");
        const hairAccessory = getAccessoryOfType(accessories, "hair");
        const mouthAccessory = getAccessoryOfType(accessories, "mouth");
        const bodyAccessory = getAccessoryOfType(accessories, "body");

        const eyes = eyesAccessory ? eyesAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const head = headAccessory ? headAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const hair = hairAccessory ? hairAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const mouth = mouthAccessory ? mouthAccessory.guid.Guid : "[Error: Accessory Not Found]";
        const body = bodyAccessory ? bodyAccessory.guid.Guid : "[Error: Accessory Not Found]";

        return (
            <div>
                
                
                
                </div>
github RoboPhred / oni-duplicity / src / pages / DuplicantEditorPage / components / DuplicantEditor / components / Appearance / Appearance.tsx View on Github external
function getOrdinalOfType(
  accessories: Accessory[],
  type: AccessoryType
): number {
  const accessory = getAccessoryOfType(accessories, type);
  if (accessory == null) {
    return 1;
  }

  return ordinalFromAccessory(accessory.guid.Guid);
}
github RoboPhred / oni-duplicity / src / pages / SaveEditor / components / editors / game-objects / MinionEditor / components / MinionAppearanceTab / derived-state.ts View on Github external
return createSelector(accessorizerBehavior, behavior => {
    if (!behavior) {
      return null;
    }

    const { accessories } = behavior.templateData;

    const accessory = getAccessoryOfType(accessories, accessoryType);
    if (!accessory) {
      return null;
    }

    return getAccessoryName(accessory);
  });
}