Example #1
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);
        }
Example #2
0
        /*void Awake()
         * {
         *  Debug.Log("MainWindow->Awake");
         *  EditorState.Instance.OnEnableSignal.Connect(OnEnableSlot);
         *  EditorState.Instance.OnDisableSignal.Connect(OnDisableSlot);
         * }*/

// ReSharper disable once UnusedMember.Local
        void OnEnable()
        {
            IconSetter.SetIcon(this);
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("*** OnEnable ***");
            }
#endif
            // process the post script creation addition (runs after the compile)
            //CreatedScriptAdditionProcessor.Instance.Process();
            PostCompileScriptProcessor.Instance.Process();

            /**
             * Initialize the PlayModeStateChangeEmitter instance
             * We are subscribing to it's ChangesAppliedSignal to react when changes applied
             * so we could then push changes to views (events, children and layout view)
             * */
            PlayModeStateChangeEmitter.Instance.ChangesAppliedSignal.Connect(ChangesAppliedSlot); // a single slot connects only once, i.e. no need to vorry about the duplication

            HierarchyChangeProcessor.Instance.ChangesProcessedSignal.Connect(HierarchyChangsProcessedSlot);

            /**
             * Subscribe to ButtonClickedSignal of the HierarchyViewDecorator
             * */
            HierarchyViewDecorator.Instance.ButtonClickedSignal.Connect(HierarchyWindowButtonClickedSlot);

            /**
             * Check prerequisites for displaying play mode overlay
             * */
            if (_initialHierarchyChangeDone)
            {
                if (EditorSettings.InspectorEnabled)
                {
                    OverlayPrerequisitesChecker.Check();
                }
            }

            //SerializationChangesUpdater.Instance.Process();

            /**
             * 3. Set the flag to false
             * Will be set to true from within OnHierarchyChange
             * */
            _initialHierarchyChangeDone = false;

            /**
             * 4.
             * */
            DesignModeStrategy.Start();

            /**
             * 5. Initialize the toolbox
             * */
            ToolboxInitializer.Initialize();

            /**
             * Selection change
             * */
            EditorState.Instance.SelectionChangeSignal.Connect(SelectionChangeSlot);

            /**
             * 6. Subscribes to game-view component double-clicks
             * */
            //DesignerOverlay.DoubleClickSignal.Connect(DoubleClickSlot);

            /**
             * Update bounds
             * */
            HandleBounds(_bounds);
        }