예제 #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);
            }
        }
예제 #2
0
        void InitGui(ExperimentRunner experimentRunner)
        {
            gameObject.SetActive(true);
            int targetDisplay = experimentRunner.DesignFile.GetGuiSettings.TargetDisplay;

            if (Display.displays.Length > targetDisplay || Application.isEditor)
            {
                if (!Application.isEditor)
                {
                    Display.displays[targetDisplay].Activate();
                }

                Debug.Log($"{TuxLog.Prefix} Setting UI to show on Display {targetDisplay + 1}. Click here to highlight current settings file in project.", experimentRunner.DesignFile.GetGuiSettings);
                if (targetDisplay > 0 && experimentRunner.DesignFile.GetGuiSettings.WarnUserIfNotDisplayOne)
                {
                    Debug.LogWarning(TuxLog.Warn("UI is on secondary display. If you can't see UI, adjust settings. You can turn this warning off (click on this message)."), experimentRunner.DesignFile.GetGuiSettings);
                }
            }
            else
            {
                Debug.LogWarning($"{TuxLog.Prefix} Not enough displays plugged in to accommodate your UI settings. Reverting UI to display on {Display.displays.Length}");
                targetDisplay = Display.displays.Length;
            }

            Canvas.targetDisplay = targetDisplay;
            if (targetDisplay != 0)
            {
                placeholderCamera.targetDisplay = targetDisplay;
            }
        }
예제 #3
0
 void StartRunningBlock(Block block)
 {
     currentlyRunningBlock = block;
     Debug.Log("");
     TuxLog.Log($"{TuxLog.FormatOrange("Starting")} Block {BlockIndex(currentlyRunningBlock)+1} / {blocks.Count}");
     ExperimentEvents.BlockHasStarted(block);
     ExperimentEvents.StartPart(block);
 }
예제 #4
0
        void LogTrial(string filePath)
        {
            string successText = currentlyRunningTrial.CompletedSuccessfully ? "successfully" : "<color=red><b>unsuccessful</b></color>";

            TuxLog.Log($"{TuxLog.FormatGreen("Finished")} {currentlyRunningTrial.TrialText} {successText}. \tOutput Updated: {filePath} \n" +
                       $"Output Table for this trial:\n" +
                       $"{currentlyRunningTrial.Data.AsString(header: true)}");
        }
예제 #5
0
        void StartRunningTrial(Trial trial)
        {
            currentlyRunningTrial = trial;
            TuxLog.Log($"{TuxLog.FormatOrange("Starting")} {currentlyRunningTrial.TrialText}");

            ExperimentEvents.StartPart(trial);
            ExperimentEvents.TrialHasStarted(trial);
        }
예제 #6
0
 public void Start()
 {
     Running = true;
     if (currentTrialList.Count == 0)
     {
         TuxLog.LogError("No Trials Defined! You probably didn't set up a design file.");
         return;
     }
     StartRunningTrial(currentTrialList[0]);
 }
예제 #7
0
        List <string> GetBlockPermutationsStrings()
        {
            if (baseBlockTable.Rows.Count <= MaxBlockPermutationsAllowed && designFile.GetBlockOrderConfigurations.Count == 0)
            {
                return(baseBlockTable.BlockPermutationsStrings);
            }

            if (designFile.GetBlockOrderConfigurations.Count > 0)
            {
                return(GetBlockOrderConfigStrings());
            }

            TuxLog.LogError("There are too many block values to create a permutation table. " +
                            "Block orders must be defined manually using OrderConfig files. " +
                            "See documentation for more information");
            throw new BlockPermutationError("Too many block values for auto permutation");
        }
예제 #8
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);
        }
예제 #9
0
 void MissingReference(string missingReference)
 {
     TuxLog.LogError($"{nameof(ExperimentDesignFile2)} does not have {missingReference} defined. " +
                     $"Please drag {missingReference} into the proper place in the design file", this);
     valid = false;
 }