public void Init(string title, IEditorWindow editorWindow, string editorPrefsTag,
                                 Type[] allowedTypes, StateMachineEditorStyle style,
                                 TimelineScrollArea.eTimeFormat timeFormat = TimelineScrollArea.eTimeFormat.Default)
                {
                    _title                    = title;
                    _editorPrefsTag           = editorPrefsTag;
                    _allowedEvents            = allowedTypes;
                    _style                    = style;
                    _timelineEditorTimeFormat = timeFormat;

                    string editorPrefsText = ProjectEditorPrefs.GetString(_editorPrefsTag, "");

                    try
                    {
                        _editorPrefs = Serializer.FromString <StateMachineEditorPrefs>(editorPrefsText);
                    }
                    catch
                    {
                        _editorPrefs = null;
                    }

                    if (_editorPrefs == null)
                    {
                        _editorPrefs = new StateMachineEditorPrefs();
                    }

                    SetEditorWindow(editorWindow);
                    CreateViews();
                }
Ejemplo n.º 2
0
    public static void ExportTour(ExportOptions exportOptions)
    {
        if (Tour.Instance == null)
        {
            EditorUtility.DisplayDialog("Error", "There is no tour object on this scene!", "Ok");
            return;
        }
        if (string.IsNullOrWhiteSpace(Tour.Instance.title))
        {
            EditorUtility.DisplayDialog("Error", "You must provide tour title", "Ok");
            return;
        }

        var excursionFolder = Path.Combine(exportOptions.FolderPath, Tour.Instance.title);
        Directory.CreateDirectory(excursionFolder);


        try
        {
            UnpackViewer(exportOptions.ViewerPack, excursionFolder);

            if (exportOptions.DesktopClientBuildPack != null)
            {
                UnpackDesktopClient(exportOptions.DesktopClientBuildPack, exportOptions.FolderPath);
            }

            if (!CopyLogo(excursionFolder, out var logoFileName))
            {
                return;
            }

            CreateConfigFile(excursionFolder, logoFileName);
            ProjectEditorPrefs.IncrementBuildNum();
            Exported.Tour tour = GenerateTour(excursionFolder, exportOptions);

            // Serialize and write
            File.WriteAllText(excursionFolder + "/tour.json", JsonUtility.ToJson(tour, true));
        }
        catch (Exception ex)
        {
            EditorUtility.DisplayDialog("Error", $"Error while exporting tour\n{ex.Message}\n{ex.StackTrace}", "Ok");
        }
        finally
        {
            EditorUtility.ClearProgressBar();
        }
        // Finish
    }
                public void Init(string title, IEditorWindow editorWindow, string editorPrefsTag)
                {
                    _title          = title;
                    _editorPrefsTag = editorPrefsTag;

                    string editorPrefsText = ProjectEditorPrefs.GetString(_editorPrefsTag, "");

                    _editorPrefs = Serializer.FromString <NodeGraphEditorPrefs>(editorPrefsText);

                    if (_editorPrefs == null)
                    {
                        _editorPrefs = new NodeGraphEditorPrefs();
                    }

                    SetEditorWindow(editorWindow);
                    CreateViews();
                }
Ejemplo n.º 4
0
                private void Init()
                {
                    string editorPrefsText = ProjectEditorPrefs.GetString(kEditorPrefKey, "");

                    try
                    {
                        _editorPrefs = Serializer.FromString <LocalisationEditorPrefs>(editorPrefsText);
                    }
                    catch
                    {
                        _editorPrefs = null;
                    }

                    if (_editorPrefs == null)
                    {
                        _editorPrefs = new LocalisationEditorPrefs();
                    }

                    _controlID = GUIUtility.GetControlID(FocusType.Passive);
                }
Ejemplo n.º 5
0
                private void SaveEditorPrefs()
                {
                    string prefsXml = Serializer.ToString(_editorPrefs);

                    ProjectEditorPrefs.SetString(kEditorPrefKey, prefsXml);
                }