Exemplo n.º 1
0
        public void Validate()
        {
            bool wasValid = valid;

            valid = true;
            if (ColumnNamesSettings == null)
            {
                MissingReference(nameof(ColumnNamesSettings));
            }
            if (ControlSettings == null)
            {
                MissingReference(nameof(ControlSettings));
            }
            if (FileLocationSettings == null)
            {
                MissingReference(nameof(FileLocationSettings));
            }
            if (GuiSettings == null)
            {
                MissingReference(nameof(GuiSettings));
            }
            if (!wasValid && valid)
            {
                Debug.Log(TuxLog.Good($"{nameof(ExperimentDesignFile2)} Fixed."), this);
            }
        }
Exemplo n.º 2
0
        Type GetScriptTypeFromInspector <T>(TextAsset textAsset, bool optional = false) where T : ExperimentPart
        {
            string typeName = typeof(T).LastPartOfTypeName();

            if (textAsset == null)
            {
                if (optional)
                {
                    return(GetDefaultExperimentPart <T>());
                }
                throw new NullReferenceException($"{typeName} Script null. Create custom {typeName} script and drag into inspector");
            }

            Type returnType = GetType(textAsset.name);

            if (!returnType.IsSubclassOf(typeof(T)))
            {
                throw new NullReferenceException($"{typeName} Script that was dragged in is not subclass of {typeName} Class");
            }

            Debug.Log(TuxLog.Good($"Successfully linked with {returnType.LastPartOfTypeName()} script"), textAsset);
            return(returnType);
        }