Esempio n. 1
0
        public static void Create(SerializedProperty propPath, SerializedProperty propMediaSource, string fileExtensions, bool autoLoadMedia, int mediaReferencePickerId = -1)
        {
            RecentItems.Load();
            RecentMenu menu = new RecentMenu();

            menu.FileBrowseButton(propPath, propMediaSource, fileExtensions, autoLoadMedia, mediaReferencePickerId);
        }
        private void SaveSettings()
        {
            _sectionMediaInfo.Save();
            _sectionDebug.Save();
            _sectionSettings.Save();
            _sectionAboutHelp.Save();

            foreach (AnimCollapseSection section in _settingSections)
            {
                section.Save();
            }
            foreach (AnimCollapseSection section in _platformSections)
            {
                section.Save();
            }

            _sectionDevModeState.Save();
            _sectionDevModeTexture.Save();
            _sectionDevModePlaybackQuality.Save();
            _sectionDevModeHapNotchLCDecoder.Save();
            _sectionDevModeBufferedFrames.Save();

            EditorPrefs.SetInt(SettingsPrefix + "PlatformIndex", _platformIndex);
            EditorPrefs.SetBool(SettingsPrefix + "ShowAlphaChannel", _showAlpha);
            EditorPrefs.SetBool(SettingsPrefix + "ShowPreview", _showPreview);
            EditorPrefs.SetBool(SettingsPrefix + "AllowDeveloperMode", _allowDeveloperMode);
            EditorPrefs.SetBool(SettingsPrefix + "HTTPHeadersToggle", _HTTPHeadersToggle);
            RecentItems.Save();
        }
 private static void LoadSettings()
 {
     _platformIndex      = EditorPrefs.GetInt(SettingsPrefix + "PlatformIndex", -1);
     _showAlpha          = EditorPrefs.GetBool(SettingsPrefix + "ShowAlphaChannel", false);
     _showPreview        = EditorPrefs.GetBool(SettingsPrefix + "ShowPreview", true);
     _allowDeveloperMode = EditorPrefs.GetBool(SettingsPrefix + "AllowDeveloperMode", false);
     _HTTPHeadersToggle  = EditorPrefs.GetBool(SettingsPrefix + "HTTPHeadersToggle", false);
     RecentItems.Load();
 }
Esempio n. 4
0
        private void Callback_Browse(object obj)
        {
            BrowseData         data             = (BrowseData)obj;
            SerializedProperty propFilePath     = data.propPath.FindPropertyRelative("_path");
            SerializedProperty propFilePathType = data.propPath.FindPropertyRelative("_pathType");
            string             startFolder      = EditorHelper.GetBrowsableFolder(propFilePath.stringValue, (MediaPathType)propFilePathType.enumValueIndex);
            string             videoPath        = propFilePath.stringValue;
            string             fullPath         = string.Empty;
            MediaPath          mediaPath        = new MediaPath();

            if (EditorHelper.OpenMediaFileDialog(startFolder, ref mediaPath, ref fullPath, data.extensions))
            {
                // Assign to properties
                propFilePath.stringValue        = mediaPath.Path.Replace("\\", "/");
                propFilePathType.enumValueIndex = (int)mediaPath.PathType;
                if (data.propMediaSource != null)
                {
                    data.propMediaSource.enumValueIndex = (int)MediaSource.Path;
                }

                // Mark as modified
                data.propPath.serializedObject.ApplyModifiedProperties();
                foreach (Object o in data.propPath.serializedObject.targetObjects)
                {
                    EditorUtility.SetDirty(o);
                }

                if (data.autoLoadMedia)
                {
                    MediaPlayer mediaPlayer = (MediaPlayer)data.propPath.serializedObject.targetObject;
                    if (mediaPlayer != null)
                    {
                        mediaPlayer.OpenMedia(mediaPlayer.MediaPath, autoPlay: true);
                    }
                }

                RecentItems.Add(fullPath);
            }
        }
Esempio n. 5
0
        private void Callback_Select(object obj)
        {
            RecentMenuItemData data = (RecentMenuItemData)obj;

            // Move it to the top of the list
            RecentItems.Add(data.path);

            // Resolve to relative path
            MediaPath mediaPath = EditorHelper.GetMediaPathFromFullPath(data.path);

            SerializedProperty propMediaPath     = data.propPath.FindPropertyRelative("_path");
            SerializedProperty propMediaPathType = data.propPath.FindPropertyRelative("_pathType");

            // Assign to properties
            propMediaPath.stringValue        = mediaPath.Path.Replace("\\", "/");
            propMediaPathType.enumValueIndex = (int)mediaPath.PathType;
            if (data.propMediaSource != null)
            {
                data.propMediaSource.enumValueIndex = (int)MediaSource.Path;
            }

            // Mark as modified
            data.propPath.serializedObject.ApplyModifiedProperties();
            foreach (Object o in data.propPath.serializedObject.targetObjects)
            {
                EditorUtility.SetDirty(o);
            }

            if (data.autoLoadMedia)
            {
                MediaPlayer mediaPlayer = (MediaPlayer)data.propPath.serializedObject.targetObject;
                if (mediaPlayer != null)
                {
                    mediaPlayer.OpenMedia(mediaPlayer.MediaPath, autoPlay: true);
                }
            }
        }
Esempio n. 6
0
 private void Callback_ClearMissingFiles()
 {
     RecentItems.ClearMissingFiles();
     RecentItems.Save();
 }
Esempio n. 7
0
 private void Callback_ClearList(object obj)
 {
     ((List <string>)obj).Clear();
     RecentItems.Save();
 }