示例#1
0
        private void GenerateWrappers()
        {
            if (_state != ObjectBuilderState.GeneratingWrapper)
            {
                _state = ObjectBuilderState.GeneratingWrapper;
                _currentObjectIndex = 0;
            }

            if (_currentObjectIndex >= _objectsToBuild.Count)
            {
                GoToTheNextBuildState();
                _currentObjectIndex = 0;

                string jsonModels = JsonConvert.SerializeObject(_objectsToBuild.ToArray(), Formatting.None,
                                                                new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });

                File.WriteAllText(TEMP_FILE_NAME, jsonModels);

                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

                return;
            }

            _currentStatusString = "Generating wrappers...";

            ObjectBuildDescription buildObject = _objectsToBuild[_currentObjectIndex];

            WrapperGenerator.GenerateWrapper(buildObject.ContainedObjectDescriptor);

            _currentObjectIndex++;
        }
示例#2
0
 private void Cleanup()
 {
     foreach (ObjectBuildDescription objectBuildDescription in _objectsToBuild)
     {
         WrapperGenerator.RemoveWrapperIfNeeded(objectBuildDescription.ContainedObjectDescriptor);
     }
 }