private static object RealOrFakeInputOrRecord(object realInput, object fakeInputParameter, FakeInput kind)
 {
     if (RECORDER.IsPlaying())
     {
         if (RECORDER.IsInputStopped())
         {
             print("Input now cannot be stopped. Please uncheck the option.");
         }
         if (!RECORDER.IsPlayPaused())
         {
             try
             {
                 realInput = GetCurrentFakeInput(kind, fakeInputParameter);
             }
             catch (Exception e)
             {
                 if (AtfInitializer.Instance.isDebugPrintOn)
                 {
                     print(e);
                 }
             }
             return(realInput);
         }
         else
         {
             return(realInput);
         }
     }
     else
     {
         if (RECORDER.IsRecording())
         {
             if (RECORDER.IsInputStopped())
             {
                 realInput = RECORDER.GetLastInput(kind, fakeInputParameter);
             }
             if (!RECORDER.IsRecordingPaused())
             {
                 RECORDER.Record(kind, realInput, fakeInputParameter);
             }
             return(realInput);
         }
         else
         {
             if (RECORDER.IsInputStopped())
             {
                 return(RECORDER.GetLastInput(kind, fakeInputParameter));
             }
             else
             {
                 RECORDER.SetLastInput(kind, realInput, fakeInputParameter);
                 return(realInput);
             }
         }
     }
 }
        private void OnGUI()
        {
            var stateLoaded = storage != null;

            if (EditorApplication.isPlaying)
            {
                GUILayout.Label("Storage Settings", EditorStyles.boldLabel);
                GUILayout.Label(
                    stateLoaded
                        ? $"Storage realisation: {storage.GetType().Name}"
                        : "Storage realisation: Waiting to focus...", EditorStyles.label);
                if (!stateLoaded)
                {
                    return;
                }

                GUILayout.Label($"Current recording name: {storage.GetCurrentRecordName()}", EditorStyles.boldLabel);

                EditorGUILayout.BeginHorizontal();
                _showDetailsOfSavedRecord   = EditorGUILayout.Toggle("Display saved details", _showDetailsOfSavedRecord);
                _showDetailsOfCurrentRecord = EditorGUILayout.Toggle("Display current details", _showDetailsOfCurrentRecord);
                EditorGUILayout.EndHorizontal();

                if (!recorder.IsPlaying() && !recorder.IsRecording())
                {
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("Save"))
                    {
                        storage.SaveStorage();
                    }
                    if (GUILayout.Button("Load"))
                    {
                        storage.LoadStorage();
                    }
                    if (GUILayout.Button("Scrap saved"))
                    {
                        storage.ScrapSavedStorage();
                    }
                    EditorGUILayout.EndHorizontal();
                }

                _fullPathForStorageExport = EditorGUILayout.TextField("Absolute path:", _fullPathForStorageExport);
                EditorGUILayout.BeginHorizontal();
                ImportExportButtons("Export saved storage", false);
                ImportExportButtons("Import saved storage", true);
                EditorGUILayout.EndHorizontal();

                GUILayout.Label("Current records", EditorStyles.boldLabel);
                AtfWindow.DoToolbarFor(_treeViewForCurrentNames, _searchFieldForCurrentNames);
                AtfWindow.DoTreeViewFor(_treeViewForCurrentNames);

                if (_showDetailsOfCurrentRecord)
                {
                    GUILayout.Label("Current commands and actions queues", EditorStyles.boldLabel);
                    AtfWindow.DoToolbarFor(_treeViewForCurrentKindsAndActions, _searchFieldForCurrentKindsAndActions);
                    AtfWindow.DoTreeViewFor(_treeViewForCurrentKindsAndActions);
                }

                GUILayout.Label("Saved records", EditorStyles.boldLabel);
                AtfWindow.DoToolbarFor(_treeViewForSavedNames, _searchFieldForSavedNames);
                AtfWindow.DoTreeViewFor(_treeViewForSavedNames);

                if (!_showDetailsOfSavedRecord)
                {
                    return;
                }
                GUILayout.Label("Saved commands and actions queues", EditorStyles.boldLabel);
                AtfWindow.DoToolbarFor(_treeViewForSavedKindsAndActions, _searchFieldForSavedKindsAndActions);
                AtfWindow.DoTreeViewFor(_treeViewForSavedKindsAndActions);
            }
            else
            {
                GUILayout.Label("Waiting for Play Mode...", EditorStyles.boldLabel);
            }
        }