How to use the oni-save-parser.SerializationTypeCode.Dictionary 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-structure / structure / gameObjects / behaviors / default.ts View on Github external
}
      } else if (LIST_TYPES.indexOf(code) !== -1) {
        i++;

        if (
          getTypeCode(typeInfo.subTypes![0].info) ===
          SerializationTypeCode.UserDefined
        ) {
          const arrayTypeInfo = typeInfo.subTypes![0];
          template = templates.find(x => x.name === arrayTypeInfo.templateName);
          if (template == null) {
            // Unknown template.
            return null;
          }
        }
      } else if (code === SerializationTypeCode.Dictionary) {
        i++;
        if (
          getTypeCode(typeInfo.subTypes![1].info) ===
          SerializationTypeCode.UserDefined
        ) {
          const arrayTypeInfo = typeInfo.subTypes![1];
          template = templates.find(x => x.name === arrayTypeInfo.templateName);
          if (template == null) {
            // Unknown template.
            return null;
          }
        }
      }
    }

    return template.name;
github RoboPhred / oni-duplicity / src / pages / SaveEditor / components / editors / TemplateObjectEditor / derived-state.ts View on Github external
i++;
        if (i === templatePath.length) {
          // Targeting an array but no index yet.
          break;
        }

        if (
          getTypeCode(typeInfo.subTypes![0].info) ===
          SerializationTypeCode.UserDefined
        ) {
          typeInfo = typeInfo.subTypes![0];
          template = oniSave.templates.find(
            x => x.name === typeInfo.templateName
          );
        }
      } else if (typeCode === SerializationTypeCode.Dictionary) {
        i++;
        if (i === templatePath.length) {
          // Targeting a dict but no index yet.
          break;
        }

        // Select key or value
        i++;
        if (i === templatePath.length) {
          // Targeting an index, but no key or value.
          // Fake a value for the ui.
          typeInfo = {
            info: SerializationTypeInfo.Pair,
            subTypes: typeInfo.subTypes
          };
          break;
github RoboPhred / oni-duplicity / src / pages / SaveEditor / components / fields / from-typeinfo.tsx View on Github external
short ? (
          
            [Edit Array]
          
        ) : (
          
        );
    case SerializationTypeCode.Boolean:
      return (props: EditorFieldProps) => ;
    case SerializationTypeCode.Byte:
      return (props: EditorFieldProps) => (
        
      );
    case SerializationTypeCode.Colour:
      return (props: EditorFieldProps) => ;
    case SerializationTypeCode.Dictionary:
      return (props: EditorFieldProps) =>
        short ? (
          
            [Edit Dictionary]
          
        ) : (
          
        );
    case SerializationTypeCode.Double:
      return (props: EditorFieldProps) => (
        
      );
    case SerializationTypeCode.Enumeration:
      return (props: EditorFieldProps) => (
        
      );