Exemplo n.º 1
0
        /// <summary>
        /// Loads the field from a given directory
        /// </summary>
        /// <param name="directory">field directory</param>
        /// <returns>whether the process was successful</returns>
        bool LoadField(string directory)
        {
            fieldPath = directory;

            fieldObject = new GameObject("Field");

            FieldDefinition.Factory = delegate(Guid guid, string name)
            {
                return(new UnityFieldDefinition(guid, name));
            };

            if (!File.Exists(directory + "\\definition.bxdf"))
            {
                return(false);
            }

            FieldDataHandler.Load(fieldPath);
            Controls.Init();

            string loadResult;

            fieldDefinition = (UnityFieldDefinition)BXDFProperties.ReadProperties(directory + "\\definition.bxdf", out loadResult);
            Debug.Log(loadResult);
            fieldDefinition.CreateTransform(fieldObject.transform);
            return(fieldDefinition.CreateMesh(directory + "\\mesh.bxda"));
        }
Exemplo n.º 2
0
    bool LoadField(string directory)
    {
        fieldObject = new GameObject("Field");

        FieldDefinition.Factory = delegate(Guid guid, string name)
        {
            return(new UnityFieldDefinition(guid, name));
        };

        string loadResult;

        fieldDefinition = (UnityFieldDefinition)BXDFProperties.ReadProperties(directory + "\\definition.bxdf", out loadResult);
        Debug.Log(loadResult);
        fieldDefinition.CreateTransform(fieldObject.transform);
        return(fieldDefinition.CreateMesh(directory + "\\mesh.bxda"));
    }
Exemplo n.º 3
0
    private void TryLoadField()
    {
        activeField = new GameObject("Field");

        FieldDefinition.Factory = delegate(Guid guid, string name)
        {
            return(new UnityFieldDefinition(guid, name));
        };

        Debug.Log(filePath);
        string loadResult;

        field = (UnityFieldDefinition)BXDFProperties.ReadProperties(filePath + "definition.bxdf", out loadResult);
        Debug.Log(loadResult);
        field.CreateTransform(activeField.transform);
        fieldLoaded = field.CreateMesh(filePath + "mesh.bxda");
    }
Exemplo n.º 4
0
    private void TryLoadField()
    {
        activeField = new GameObject("Field");

        FieldDefinition.Factory = delegate(Guid guid, string name)
        {
            return(new UnityFieldDefinition(guid, name));
        };
        try
        {
            string loadResult;
            UnityFieldDefinition field = (UnityFieldDefinition)BXDFProperties.ReadProperties(Application.dataPath + "//resources//ConfigurationEnvironment//definition.bxdf", out loadResult);
            Debug.Log(loadResult);
            field.CreateTransform(activeField.transform);
            bool fieldLoaded = field.CreateMesh(Application.dataPath + "//resources//ConfigurationEnvironment//mesh.bxda");
        }
        catch
        {
            Debug.Log("Field loading failed!");
        }
    }
Exemplo n.º 5
0
        /// <summary>
        /// Loads the field from a given directory
        /// </summary>
        /// <param name="directory">field directory</param>
        /// <returns>whether the process was successful</returns>
        bool LoadField(string directory)
        {
            if (string.IsNullOrEmpty(directory))
            {
                UserMessageManager.Dispatch("Field not found", 7);
            }
            fieldPath = directory;

            fieldObject = new GameObject("Field");

            FieldDefinition.Factory = delegate(Guid guid, string name)
            {
                return(new UnityFieldDefinition(guid, name));
            };

            bool isEmptyGrid = directory == "" || new DirectoryInfo(directory).Name == UnityFieldDefinition.EmptyGridName;

            if (!File.Exists(directory + Path.DirectorySeparatorChar + "definition.bxdf") && !isEmptyGrid)
            {
                return(false);
            }

            FieldDataHandler.LoadFieldMetaData(fieldPath);

            Controls.Load();
            Controls.UpdateFieldControls();
            if (!Controls.HasBeenSaved())
            {
                Controls.Save(true);
            }

            if (isEmptyGrid)
            {
                return(true);
            }
            fieldDefinition = (UnityFieldDefinition)BXDFProperties.ReadProperties(directory + Path.DirectorySeparatorChar + "definition.bxdf", out string loadResult);
            // Debug.Log("Field load result: " + loadResult);
            fieldDefinition.CreateTransform(fieldObject.transform);
            return(fieldDefinition.CreateMesh(directory + Path.DirectorySeparatorChar + "mesh.bxda"));
        }