コード例 #1
0
        public bool Undo_redo_PEGI()
        {
            var changed = false;

            if (cache == null)
            {
                cache = new UndoCache();
            }

            if (cache.undo.GotData)
            {
                if (icon.Undo.Click("Press Z to undo (Scene View)", ref changed))
                {
                    cache.undo.ApplyTo(this);
                }
            }
            else
            {
                icon.UndoDisabled.write("Nothing to Undo (set number of undo frames in config)");
            }

            if (cache.redo.GotData)
            {
                if (icon.Redo.Click("X to Redo", ref changed))
                {
                    cache.redo.ApplyTo(this);
                }
            }
            else
            {
                icon.RedoDisabled.write("Nothing to Redo");
            }

            pegi.nl();

            return(changed);
        }
コード例 #2
0
        public bool Undo_redo_PEGI()
        {
            var changed = false;

            if (cache == null)
            {
                cache = new UndoCache();
            }
            if (recordedStrokes == null)
            {
                recordedStrokes = new List <string>();
            }
            if (recordedStrokesForUndoRedo == null)
            {
                recordedStrokesForUndoRedo = new List <string>();                                    // to sync strokes recording with Undo Redo
            }
            if (cache.undo.GotData)
            {
                if (icon.Undo.Click("Press Z to undo (Scene View)", ref changed))
                {
                    cache.undo.ApplyTo(this);
                }
            }
            else
            {
                icon.UndoDisabled.write("Nothing to Undo (set number of undo frames in config)");
            }

            if (cache.redo.GotData)
            {
                if (icon.Redo.Click("X to Redo", ref changed))
                {
                    cache.redo.ApplyTo(this);
                }
            }
            else
            {
                icon.RedoDisabled.write("Nothing to Redo");
            }

            pegi.nl();

#if UNITY_EDITOR
            if (recording)
            {
                ("Recording... " + recordedStrokes.Count + " vectors").nl();
                "Will Save As ".edit(70, ref saveName);

                if (icon.Close.Click("Stop, don't save"))
                {
                    recording = false;
                }
                if (icon.Done.Click("Finish & Save"))
                {
                    SaveRecording();
                }

                pegi.newLine();
            }
#endif

            return(changed);
        }