示例#1
0
        public static WindowSystemResourcesSettings GetSettings()
        {
#if UNITY_EDITOR
            if (Application.isPlaying == false)
            {
                WindowSystemResourcesSettings settings = null;

                var obj = GameObject.FindObjectOfType <WindowSystemResources>();
                if (obj == null)
                {
                    var objs = ME.EditorUtilities.GetObjectsOfType <WindowSystemResources>("Assets/", string.Empty, (w) => true, useCache: false);
                    if (objs.Length > 0)
                    {
                        settings = objs[0].settings as WindowSystemResourcesSettings;
                    }
                    else
                    {
                        Debug.LogError("No settings `WindowSystemResourcesSettings` found");
                    }
                }
                else
                {
                    settings = obj.settings as WindowSystemResourcesSettings;
                }

                return(settings);
            }
#endif

            return(WindowSystemResources.instance.settings as WindowSystemResourcesSettings);
        }
        public override void OnFlowSettingsGUI()
        {
            if (Resources.settings == null)
            {
                Resources.settings = Resources.GetSettingsFile();
            }

            var settings = Resources.settings;

            if (settings == null)
            {
                EditorGUILayout.HelpBox(string.Format(FlowAddon.MODULE_HAS_ERRORS, "Settings file not found (WindowSystemResourcesSettings)."), MessageType.Error);
            }
            else
            {
                GUILayout.Label(FlowAddon.MODULE_INSTALLED, EditorStyles.centeredGreyMiniLabel);

                if (this.editor == null)
                {
                    this.editor = Editor.CreateEditor(settings);
                }

                if (this.editor != null)
                {
                    this.editor.OnInspectorGUI();
                }
            }
        }
        protected override void OnInspectorGUI(WindowSystemResourcesSettings settings, WindowSystemResourcesServiceItem item, System.Action onReset, GUISkin skin)
        {
            //var data = FlowSystem.GetData();

            if (settings == null)
            {
                return;
            }

            var newValue = GUILayout.Toggle(settings.loadFromStreamingAssets, "Use Streaming Assets");

            if (settings.loadFromStreamingAssets == true)
            {
                UnityEditor.EditorGUILayout.HelpBox("StreamingAssets directory will be used to load AssetBundles", UnityEditor.MessageType.Info);
            }

            if (newValue != settings.loadFromStreamingAssets)
            {
                settings.loadFromStreamingAssets = newValue;
                UnityEditor.EditorUtility.SetDirty(settings);
            }

            UnityEditor.EditorGUI.BeginDisabledGroup(settings.loadFromStreamingAssets);
            {
                if (settings.url == null)
                {
                    settings.url = string.Empty;
                }

                GUILayout.Label("URL:");
                var newKey = GUILayout.TextArea(settings.url);
                if (newKey != settings.url)
                {
                    settings.url = newKey;
                    UnityEditor.EditorUtility.SetDirty(settings);
                }
            }
            UnityEditor.EditorGUI.EndDisabledGroup();
        }
 public override void EditorLoad(WindowSystemResourcesSettings settings, WindowSystemResourcesServiceItem item)
 {
 }