public void PlayModeStartedSlot(object[] parameters)
        {
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("PlayModeChangeProcessorHandlingDesignerOverlay->PlayModeStartedSlot");
            }
#endif
            //_changesCached = false;

            if (EditorSettings.InspectorEnabled && Application.isEditor && Application.isPlaying /* && null == DesignerOverlay.Instance*/)
            {
                //if (FontMapper.IsMapping(DipSwitches.DefaultFontMapperId))
                if (null != FontMapper.GetDefault())
                {
                    // ReSharper disable once UnusedVariable
                    DesignerOverlay.Attach();
                    //overlay.Font = FontMapper.GetWithFallback(DipSwitches.DefaultFontMapperId).Font; // set font
                }
            }
        }
Пример #2
0
        //public bool ShowHelp;

        internal void Render()
        {
            EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar);

            _watchChanges    = EditorSettings.WatchChanges;
            _oldWatchChanges = _watchChanges;
            _watchChanges    = GUILayout.Toggle(_watchChanges, GuiContentCache.Instance.MonitorChanges,
                                                EditorSettings.UseDarkSkin ? StyleCache.Instance.Toggle : StyleCache.Instance.GreenToggle, // no green toggle for Pro users
                                                GUILayout.ExpandWidth(false), GUILayout.Height(30));
            if (_watchChanges != _oldWatchChanges)
            {
                EditorSettings.WatchChanges = _watchChanges;
                EditorState.Instance.WatchChangesChanged();
            }

            GUI.enabled = _watchChanges;

            _autoSave    = EditorSettings.AutoSave;
            _oldAutoSave = _autoSave;
            _autoSave    = GUILayout.Toggle(_autoSave, GuiContentCache.Instance.AutoSave, StyleCache.Instance.Toggle, GUILayout.ExpandWidth(false), GUILayout.Height(30));
            if (_autoSave != _oldAutoSave)
            {
                EditorSettings.AutoSave = _autoSave;
            }

            GUI.enabled = true;

            /*if (EditorSettings.InspectorEnabled && Application.isEditor && Application.isPlaying/* && null == DesignerOverlay.Instance#1#)
             * {
             *  //if (FontMapper.IsMapping(DipSwitches.DefaultFontMapperId))
             *  if (null != FontMapper.GetDefault())
             *  {
             * // ReSharper disable once UnusedVariable
             *      DesignerOverlay overlay = (DesignerOverlay)Framework.GetComponent<DesignerOverlay>(true); // add if non-existing
             *      //overlay.Font = FontMapper.GetWithFallback(DipSwitches.DefaultFontMapperId).Font; // set font
             *  }
             * }*/

            _inspectorEnabled = GUILayout.Toggle(EditorSettings.InspectorEnabled, GuiContentCache.Instance.Inspect, StyleCache.Instance.Toggle, GUILayout.Height(30));
            if (_inspectorEnabled != EditorSettings.InspectorEnabled)
            {
                EditorSettings.InspectorEnabled = _inspectorEnabled;
                if (_inspectorEnabled)
                {
                    OverlayPrerequisitesChecker.Check();
                    DesignerOverlay.Attach();
                    DesignerOverlay.Instance.Select(null);

                    /*if (EditorSettings.InspectorEnabled)
                     *  return;*/// we must go enable the designer overlay instance
                }

                if (null != DesignerOverlay.Instance)
                {
                    DesignerOverlay.Instance.enabled = _inspectorEnabled;
                    if (!_inspectorEnabled)
                    {
                        DesignerOverlay.Instance.Deselect();
                    }
                }
            }

            _liveMediaQueries    = EditorSettings.LiveStyling;
            _oldLiveMediaQueries = _liveMediaQueries;
            _liveMediaQueries    = GUILayout.Toggle(_liveMediaQueries, GuiContentCache.Instance.LiveStyling, StyleCache.Instance.Toggle, GUILayout.ExpandWidth(false), GUILayout.Height(30));
            if (_liveMediaQueries != _oldLiveMediaQueries)
            {
                EditorSettings.LiveStyling = _liveMediaQueries;
                Gui.LiveMediaQueries       = _liveMediaQueries;
                if (_liveMediaQueries)
                {
                    EditorUtility.DisplayDialog("Live styling turned ON",
                                                @"Live styling is working in play mode, editor only.

When turned ON:
A. styles are being re-processed upon each stylesheet change
B. media queries are being run upon each screen resize

Also the media queries are being run upon each screen resize. 

This is processor intensive so turn it OFF when not needed (or else the editor might not be so responsive).", "OK");

                    Gui.ProcessStyles(); // fhen switched ON
                }
            }

            GUILayout.FlexibleSpace();

#if TRIAL
            if (GUILayout.Button(GuiContentCache.Instance.Purchase, StyleCache.Instance.Button, GUILayout.Height(30)))
            {
                //Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/3796");
                PurchaseDialog.Instance.ShowUtility();
            }
#endif

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(1);
        }