Beispiel #1
0
    //~ [MenuItem ("TDTK/LayerEditor")]
    //~ static void Init(){
    //~ // Get existing open window or if none, make a new one:
    //~ window = (LayerEditor)EditorWindow.GetWindow(typeof (LayerEditor));
    //~ window.minSize=new Vector2(300, 300);

    //~ layerCreep=PlayerPrefs .GetInt("CreepLayer", 31);
    //~ layerCreepF=PlayerPrefs .GetInt("CreepFLayer", 30);

    //~ layerTower=PlayerPrefs .GetInt("TowerLayer", 29);
    //~ layerPlatform=PlayerPrefs .GetInt("PlatformLayer", 28);

    //~ GetSpawnManager();
    //~ }

    public override void OnInspectorGUI()
    {
        LayerManager lm = (LayerManager)target;

        Undo.SetSnapshotTarget(lm, "LayerManager");

        GUI.changed = false;

        lm.layerCreep    = EditorGUILayout.LayerField("Creep Layer:", lm.layerCreep);
        lm.layerCreepF   = EditorGUILayout.LayerField("CreepF Layer:", lm.layerCreepF);
        lm.layerTower    = EditorGUILayout.LayerField("Tower Layer:", lm.layerTower);
        lm.layerPlatform = EditorGUILayout.LayerField("Platform Layer:", lm.layerPlatform);
        lm.layerOverlay  = EditorGUILayout.LayerField("Overlay Layer:", lm.layerOverlay);
        lm.layerMiscUI   = EditorGUILayout.LayerField("Misc UI Layer:", lm.layerMiscUI);
        lm.layerTerrain  = EditorGUILayout.LayerField("Terrain/Cam Layer:", lm.layerTerrain);

        //~ lm.layerCreep=Mathf.Clamp(lm.layerCreep, 0, 31);
        //~ lm.layerCreepF=Mathf.Clamp(lm.layerCreepF, 0, 31);
        //~ lm.layerTower=Mathf.Clamp(lm.layerTower, 0, 31);
        //~ lm.layerPlatform=Mathf.Clamp(lm.layerPlatform, 0, 31);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(lm);
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
        }
        Undo.ClearSnapshotTarget();
    }
    // OnInspectorGUI
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        Undo.SetSnapshotTarget(m_Component, "OVRCameraController");

        {
            /*
             * m_Component.NeckPosition         = EditorGUILayout.Vector3Field("Neck Position", m_Component.NeckPosition);
             * m_Component.EyeCenterPosition    = EditorGUILayout.Vector3Field("Eye Center Position", m_Component.EyeCenterPosition);
             * OVREditorGUIUtility.Separator();
             * m_Component.TrackerRotatesY  = EditorGUILayout.Toggle("Tracker Rotates Y", m_Component.TrackerRotatesY);
             * OVREditorGUIUtility.Separator();
             * m_Component.BackgroundColor  = EditorGUILayout.ColorField("Background Color", m_Component.BackgroundColor);
             * OVREditorGUIUtility.Separator();
             */
            DrawDefaultInspector();
        }

        if (GUI.changed)
        {
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
            EditorUtility.SetDirty(target);
        }

        Undo.ClearSnapshotTarget();
    }
    public override void OnInspectorGUI()
    {
        var curEvent = Event.current;
        var snapshot = (curEvent.type != EventType.Repaint && curEvent.type != EventType.Layout) || SGT_AuxWindowHelper.instance != null;

        if (snapshot == true)
        {
            var undoTargets = new ObjectList();

            Target.BuildUndoTargets(undoTargets);

            Undo.SetSnapshotTarget(undoTargets.ToArray(), "Change to " + Target.name);
            Undo.CreateSnapshot();
        }

        SGT_EditorGUI.ResetAll();

        OnInspector();

        if (SGT_EditorGUI.InspectorModified == true)
        {
            SGT_EditorGUI.InspectorModified = false;

            if (snapshot == true)
            {
                Undo.RegisterSnapshot();

                EditorUtility.SetDirty(target);
            }

            Repaint();
        }
    }
Beispiel #4
0
    // OnInspectorGUI
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;
                #pragma warning disable 0618
        Undo.SetSnapshotTarget(m_Component, "OVRPlayerController");
                #pragma warning restore 0618
        {
            m_Component.Acceleration      = EditorGUILayout.Slider("Acceleration", m_Component.Acceleration, 0, 1);
            m_Component.Damping           = EditorGUILayout.Slider("Damping", m_Component.Damping, 0, 1);
            m_Component.BackAndSideDampen = EditorGUILayout.Slider("Back and Side Dampen", m_Component.BackAndSideDampen, 0, 1);
//			m_Component.JumpForce         = EditorGUILayout.Slider("Jump Force",            m_Component.JumpForce,        0, 10);
            m_Component.RotationAmount = EditorGUILayout.Slider("Rotation Amount", m_Component.RotationAmount, 0, 5);

            OVREditorGUIUtility.Separator();

            m_Component.GravityModifier = EditorGUILayout.Slider("Gravity Modifier", m_Component.GravityModifier, 0, 1);

            OVREditorGUIUtility.Separator();
        }

        if (GUI.changed)
        {
                        #pragma warning disable 0618
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
            EditorUtility.SetDirty(m_Component);
        }

        Undo.ClearSnapshotTarget();
                #pragma warning restore 0618
    }
Beispiel #5
0
    public static void CheckUndo(Object[] target, string description = "Undo Audio Change")
    {
        src     = null;
        srcObjs = target;

        Event e = Event.current;

        if (e.type == EventType.MouseDown && e.button == 0 || e.type == EventType.KeyUp && (e.keyCode == KeyCode.Tab))
        {
            // When the LMB is pressed or the TAB key is released,
            // store a snapshot, but don't register it as an undo
            // ( so that if nothing changes we avoid storing a useless undo)
            Undo.SetSnapshotTarget(srcObjs, description);
            Undo.CreateSnapshot();
            Undo.ClearSnapshotTarget();
            listeningForGuiChanges = true;
            guiChanged             = false;
        }

        if (listeningForGuiChanges && guiChanged)
        {
            // Some GUI value changed after pressing the mouse.
            // Register the previous snapshot as a valid undo.
            Undo.SetSnapshotTarget(srcObjs, description);
            Undo.RegisterSnapshot();
            Undo.ClearSnapshotTarget();
            listeningForGuiChanges = false;
        }
    }
Beispiel #6
0
    // OnInspectorGUI
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        Undo.SetSnapshotTarget(m_Component, "OVRPlayerController");

        {
            m_Component.Acceleration      = EditorGUILayout.Slider("Acceleration", m_Component.Acceleration, 0, 1);
            m_Component.Damping           = EditorGUILayout.Slider("Damping", m_Component.Damping, 0, 1);
            m_Component.BackAndSideDampen = EditorGUILayout.Slider("Back and Side Dampen", m_Component.BackAndSideDampen, 0, 1);
//			m_Component.JumpForce         = EditorGUILayout.Slider("Jump Force",            m_Component.JumpForce,        0, 10);
            m_Component.RotationAmount = EditorGUILayout.Slider("Rotation Amount", m_Component.RotationAmount, 0, 5);
            m_Component.DirXform       = EditorGUILayout.ObjectField("Hip Direction", m_Component.DirXform, typeof(Transform), true) as Transform;
            OVREditorGUIUtility.Separator();

            m_Component.GravityModifier = EditorGUILayout.Slider("Gravity Modifier", m_Component.GravityModifier, 0, 1);

            OVREditorGUIUtility.Separator();
        }

        if (GUI.changed)
        {
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
            EditorUtility.SetDirty(m_Component);
        }

        Undo.ClearSnapshotTarget();
    }
    void DoAlign()
    {
        if (selcount == 0)
        {
            return;
        }
        List <UnityEngine.Transform> trans = new List <UnityEngine.Transform>(Selection.transforms);

        trans.Sort((a, b) => string.Compare(a.name, b.name));
        Undo.SetSnapshotTarget(Selection.transforms, "AlignToSpline");
        Undo.CreateSnapshot();
        Undo.RegisterSnapshot();

        for (int i = 0; i < selcount; i++)
        {
            if (SetPosition)
            {
                trans[i].position = pos[i];
            }
            if (SetOrientation)
            {
                switch (OrientationType)
                {
                case 0:
                    trans[i].rotation = UnityEngine.Quaternion.LookRotation(tan[i], up[i]);
                    break;

                case 1:
                    trans[i].rotation = UnityEngine.Quaternion.LookRotation(up[i], tan[i]);
                    break;
                }
            }
        }
    }
Beispiel #8
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        Undo.SetSnapshotTarget(target, "NGUI Manager Snapshot");
        Undo.CreateSnapshot();

        GUI.color = Color.white;

        GUILayout.Space(10);

        m_Component.Player = (vp_FPPlayerEventHandler)EditorGUILayout.ObjectField("Player", m_Component.Player, typeof(vp_FPPlayerEventHandler), true);
        if (m_Component.Player == null)
        {
            EditorGUILayout.HelpBox("You must provide a vp_FPPlayerEventHandler from your scene in order for the UI to be able to control the Player.", MessageType.Warning);
        }

        GUILayout.Space(5);

        m_Component.SimulateTouchWithMouse = EditorGUILayout.Toggle(new GUIContent("Simulate Touch w/ Mouse", "If this is checked, keyboard controls in the editor are disabled and the left mouse click will work like a touch. If it's not checked, normal keyboard controls will work."), m_Component.SimulateTouchWithMouse);

        GUILayout.Space(5);

        m_Component.DoubleTapTimeout = EditorGUILayout.FloatField("Double Tap Timeout", m_Component.DoubleTapTimeout);

        GUILayout.Space(5);

        GUILayout.Space(10);

        // update
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            Undo.RegisterSnapshot();
        }
    }
Beispiel #9
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        Undo.SetSnapshotTarget(target, "HUD Anchor Snapshot");
        Undo.CreateSnapshot();

        GUI.color = Color.white;

        GUILayout.Space(10);

        m_Component.Side = (vp_UIAnchor.vp_UIAnchorSide)EditorGUILayout.EnumPopup("Side", m_Component.Side);
        if (m_Component.Side != m_OldSide)
        {
            m_Component.RefreshUI();
            m_OldSide = m_Component.Side;
        }

        GUILayout.Space(10);

        // update
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            Undo.RegisterSnapshot();
        }
    }
 public void registerAtlasSnapshot()
 {
     //Register Undo for the previous state
     Undo.SetSnapshotTarget(uftAtlas, "atlas");
     Undo.CreateSnapshot();
     Undo.RegisterSnapshot();
 }
Beispiel #11
0
 /// <summary>
 /// Call this method BEFORE any undoable UnityGUI call.
 /// Manages undo for the given target, with the given name.
 /// </summary>
 /// <param name="target">
 /// The <see cref="Object"/> you want to save undo info for.
 /// </param>
 /// <param name="name">
 /// The name of the thing to undo (displayed as "Undo [name]" in the main menu).
 /// </param>
 public void CheckUndo(Object target, string name)
 {
     if (_waitingToRecordPrefab != null)
     {
         // Record eventual prefab instance modification.
         // TODO Avoid recording if nothing changed (no harm in doing so, but it would be nicer).
         switch (Event.current.type)
         {
         case EventType.MouseDown:
         case EventType.MouseUp:
         case EventType.KeyDown:
         case EventType.KeyUp:
             PrefabUtility.RecordPrefabInstancePropertyModifications(_waitingToRecordPrefab);
             break;
         }
     }
     if ((Event.current.type == EventType.MouseDown && Event.current.button == 0) || (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Tab))
     {
         // When the LMB is pressed or the TAB key is released,
         // store a snapshot, but don't register it as an undo
         // (so that if nothing changes we avoid storing a useless undo).
         Undo.SetSnapshotTarget(target, name);
         Undo.CreateSnapshot();
         Undo.ClearSnapshotTarget(); // Not sure if this is necessary.
         _listeningForGuiChanges = true;
     }
 }
    void registerSnapshotForEntry(UFTAtlasEntry uftAtlasEntry)
    {
        registerAtlasSnapshot();

        Undo.SetSnapshotTarget(uftAtlasEntry, "stop dragging uftAtlasEntry id=" + uftAtlasEntry.id);
        Undo.CreateSnapshot();
        Undo.RegisterSnapshot();
    }
Beispiel #13
0
 private void CreateSnapshot( )
 {
     if (Input.GetMouseButtonDown(0))
     {
         Undo.CreateSnapshot( );
         Undo.RegisterSnapshot( );
     }
 }
Beispiel #14
0
 protected void SetupUndo(string message)
 {
     Undo.SetSnapshotTarget(target, message);
     if (Input.GetMouseButtonDown(0))
     {
         Undo.CreateSnapshot();
         Undo.RegisterSnapshot();
     }
 }
    // OnInspectorGUI
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        Undo.SetSnapshotTarget(m_Component, "OVRCameraController");

        {
#if CUSTOM_LAYOUT
            OVREditorGUIUtility.Separator();

            m_Component.VerticalFOV = EditorGUILayout.FloatField("Vertical FOV", m_Component.VerticalFOV);
            m_Component.IPD         = EditorGUILayout.FloatField("IPD", m_Component.IPD);

            OVREditorGUIUtility.Separator();

            m_Component.CameraRootPosition = EditorGUILayout.Vector3Field("Camera Root Position", m_Component.CameraRootPosition);
            m_Component.NeckPosition       = EditorGUILayout.Vector3Field("Neck Position", m_Component.NeckPosition);
            m_Component.EyeCenterPosition  = EditorGUILayout.Vector3Field("Eye Center Position", m_Component.EyeCenterPosition);

            OVREditorGUIUtility.Separator();

            m_Component.UsePlayerEyeHeight = EditorGUILayout.Toggle("Use Player Eye Height", m_Component.UsePlayerEyeHeight);

            OVREditorGUIUtility.Separator();

            m_Component.FollowOrientation = EditorGUILayout.ObjectField("Follow Orientation",
                                                                        m_Component.FollowOrientation,
                                                                        typeof(Transform), true) as Transform;
            m_Component.TrackerRotatesY = EditorGUILayout.Toggle("Tracker Rotates Y", m_Component.TrackerRotatesY);

            OVREditorGUIUtility.Separator();

            // Remove Portrait Mode from Inspector window for now
            //m_Component.PortraitMode        = EditorGUILayout.Toggle ("Portrait Mode", m_Component.PortraitMode);
            m_Component.PredictionOn    = EditorGUILayout.Toggle("Prediction On", m_Component.PredictionOn);
            m_Component.CallInPreRender = EditorGUILayout.Toggle("Call in Pre-Render", m_Component.CallInPreRender);
            m_Component.WireMode        = EditorGUILayout.Toggle("Wire-Frame Mode", m_Component.WireMode);
            m_Component.LensCorrection  = EditorGUILayout.Toggle("Lens Correction", m_Component.LensCorrection);
            m_Component.Chromatic       = EditorGUILayout.Toggle("Chromatic", m_Component.Chromatic);

            OVREditorGUIUtility.Separator();
#else
            DrawDefaultInspector();
#endif
        }

        if (GUI.changed)
        {
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
            EditorUtility.SetDirty(m_Component);
        }

        Undo.ClearSnapshotTarget();
    }
    static void checkMouse(AudioBus bus)
    {
        Event e = Event.current;

        if (e.button == 0 && e.isMouse)
        {
            Undo.SetSnapshotTarget(bus, "Changed Slider");
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
        }
    }
Beispiel #17
0
 /// <summary>
 /// Call this method AFTER any undoable UnityGUI call.
 /// Forces undo for the given target, with the given name.
 /// Used to undo operations that are performed by pressing a button,
 /// which doesn't set the GUI to a changed state.
 /// </summary>
 /// <param name="target">
 /// The <see cref="Object"/> you want to save undo info for.
 /// </param>
 /// <param name="name">
 /// The name of the thing to undo (displayed as "Undo [name]" in the main menu).
 /// </param>
 public void ForceDirty(Object target, string name)
 {
     if (!_listeningForGuiChanges)
     {
         // Create a new snapshot.
         Undo.SetSnapshotTarget(target, name);
         Undo.CreateSnapshot();
         Undo.ClearSnapshotTarget();
     }
     SetDirty(target, name, true);
 }
 public void ForceDirty(Object p_target, string p_name)
 {
     if (!listeningForGuiChanges)
     {
         // Create a new snapshot.
         Undo.SetSnapshotTarget(p_target, p_name);
         Undo.CreateSnapshot();
         Undo.ClearSnapshotTarget();
     }
     SetDirty(p_target, p_name);
 }
Beispiel #19
0
    private void OnSceneGUI()
    {
        Ferr2D_Path path      = (Ferr2D_Path)target;
        GUIStyle    iconStyle = new GUIStyle();

        iconStyle.alignment = TextAnchor.MiddleCenter;

        // setup undoing things
#if !(UNITY_4_2 || UNITY_4_1 || UNITY_4_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_1 || UNITY_3_0)
        Undo.RecordObject(target, "Modified Path");
#else
        Undo.SetSnapshotTarget(target, "Modified Path");
        Undo.CreateSnapshot();
#endif

        // draw the path line
        if (Event.current.type == EventType.repaint)
        {
            DoPath(path);
        }

        // Check for drag-selecting multiple points
        DragSelect(path);

        // do adding verts in when the shift key is down!
        if (Event.current.shift && !Event.current.control)
        {
            DoShiftAdd(path, iconStyle);
        }

        // draw and interact with all the path handles
        DoHandles(path, iconStyle);

        // update everything that relies on this path, if the GUI changed
        if (GUI.changed)
        {
#if (UNITY_4_2 || UNITY_4_1 || UNITY_4_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_1 || UNITY_3_0)
            Undo.RegisterSnapshot();
#endif
            UpdateDependentsSmart(path, false, false);
            EditorUtility.SetDirty(target);
            prevChanged = true;
        }
        else if (Event.current.type == EventType.used)
        {
            if (prevChanged == true)
            {
                UpdateDependentsSmart(path, false, true);
            }
            prevChanged = false;
        }
    }
        private void OnGUI()
        {
            ValidateGUIStyles();

            if (_inputManager == null && !_tryedToFindInputManagerInScene)
            {
                TryToFindInputManagerInScene();
            }

            if (_inputManager == null)
            {
                DisplayMissingInputManagerWarning();
                return;
            }

#if UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2
            Undo.SetSnapshotTarget(_inputManager, "InputManager");
            Undo.CreateSnapshot();
#else
            Undo.RecordObject(_inputManager, "InputManager");
#endif
            UpdateHierarchyPanelWidth();
            if (_searchString.Length > 0)
            {
                DisplaySearchResults();
            }
            else
            {
                DisplayHierarchyPanel();
            }
            if (_selectionPath.Count >= 1)
            {
                DisplayMainPanel();
            }
            DisplayMainToolbar();
#if UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2
            if (GUI.changed)
            {
                Undo.RegisterSnapshot();
                EditorUtility.SetDirty(_inputManager);
            }
            Undo.ClearSnapshotTarget();
#else
            if (GUI.changed)
            {
                EditorUtility.SetDirty(_inputManager);
            }
#endif
        }
        /// <summary>
        /// Call this method BEFORE any undoable UnityGUI call.
        /// Manages undo for the given target, with the given name.
        /// </summary>
        /// <param name="p_target">
        /// The <see cref="Object"/> you want to save undo info for.
        /// </param>
        /// <param name="p_name">
        /// The name of the thing to undo (displayed as "Undo [name]" in the main menu).
        /// </param>
        public void CheckUndo(Object p_target, string p_name)
        {
            Event e = Event.current;

            if ((e.type == EventType.MouseDown && e.button == 0) || (e.type == EventType.KeyUp && e.keyCode == KeyCode.Tab))
            {
                // When the LMB is pressed or the TAB key is released,
                // store a snapshot, but don't register it as an undo
                // (so that if nothing changes we avoid storing a useless undo).
                Undo.SetSnapshotTarget(p_target, p_name);
                Undo.CreateSnapshot();
                Undo.ClearSnapshotTarget();     // Not sure if this is necessary.
                listeningForGuiChanges = true;
            }
        }
Beispiel #22
0
    void                 OnSceneGUI()
    {
        Ferr2D_Path path      = (Ferr2D_Path)target;
        GUIStyle    iconStyle = new GUIStyle();

        iconStyle.alignment = TextAnchor.MiddleCenter;

        // if this was an undo, refresh stuff too
        if (Event.current.type == EventType.ValidateCommand)
        {
            switch (Event.current.commandName)
            {
            case "UndoRedoPerformed":
                path.UpdateDependants();
                return;
            }
        }

        // setup undoing things
                #if !(UNITY_4_2 || UNITY_4_1 || UNITY_4_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_1 || UNITY_3_0)
        Undo.RecordObject(target, "Modified Path");
                #else
        Undo.SetSnapshotTarget(target, "Modified Path");
        Undo.CreateSnapshot();
                #endif

        // draw and interact with all the path handles
        DoHandles(path, iconStyle);

        // draw the path line
        DoPath(path);

        // do adding verts in when the shift key is down!
        if (Event.current.shift)
        {
            DoShiftAdd(path, iconStyle);
        }

        // update everything that relies on this path, if the GUI changed
        if (GUI.changed)
        {
                        #if (UNITY_4_2 || UNITY_4_1 || UNITY_4_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_1 || UNITY_3_0)
            Undo.RegisterSnapshot();
                        #endif
            path.UpdateDependants();
            EditorUtility.SetDirty(target);
        }
    }
Beispiel #23
0
    public override void OnInspectorGUI()
    {
        Undo.SetSnapshotTarget(rm, "ResourceManager");

        GUI.changed = false;

        EditorGUILayout.Space();
        //num=EditorGUILayout.IntField("Total ResourceType: ", num);
        //if(num<=0) num=1;
        //EditorGUILayout.Space();

        //if(num!=rm.resources.Length) UpdateResourceSize(num);
        if (foldList.Count != rm.resources.Length)
        {
            UpdateFoldListSize();
        }

        for (int i = 0; i < rm.resources.Length; i++)
        {
            if (rm.resources[i] != null)
            {
                foldList[i] = EditorGUILayout.Foldout(foldList[i], rm.resources[i].name + ": " + rm.resources[i].value);

                if (foldList[i])
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(rm.resources[i].icon, GUILayout.Width(43), GUILayout.Height(43));

                    GUILayout.BeginVertical();
                    GUILayout.Label(rm.resources[i].name);
                    rm.resources[i].value = EditorGUILayout.IntField("Start Value: ", rm.resources[i].value);
                    GUILayout.EndVertical();

                    GUILayout.EndHorizontal();
                }
            }
        }



        if (GUI.changed)
        {
            EditorUtility.SetDirty(rm);
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
        }
        Undo.ClearSnapshotTarget();
    }
Beispiel #24
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        Undo.SetSnapshotTarget(m_Component, "AIAreaSpawnerTriggerEditor Snapshot");
        Undo.CreateSnapshot();

        GUI.color = Color.white;

        Main();

        // update
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            Undo.RegisterSnapshot();
        }
    }
Beispiel #25
0
 protected void SetupUndo(string message)
 {
             #if IS_UNITY_3
     Undo.SetSnapshotTarget(target, message);
     if (Input.GetMouseButtonDown(0))
     {
         Undo.CreateSnapshot();
         Undo.RegisterSnapshot();
     }
             #else
     if (Input.GetMouseButtonDown(0))
     {
         Undo.RecordObject(target, message);
     }
             #endif
 }
Beispiel #26
0
    public void VerifyingList()
    {
        Undo.SetSnapshotTarget(pm, "PerkManager");

        List <Perk> list = PerkEditorWindow.Load();

        int n = 0;

        foreach (Perk perk in pm.allPerkList)
        {
            if (perk.enableInlvl)
            {
                n += 1;
            }
        }
        int m = 0;

        foreach (Perk perk in list)
        {
            if (perk.enableInlvl)
            {
                m += 1;
            }
        }

        for (int i = 0; i < list.Count; i++)
        {
            Perk perk = list[i];
            foreach (Perk p in pm.allPerkList)
            {
                if (perk.ID == p.ID)
                {
                    //~ if(perk.name=="CanonTower") Debug.Log(perk.name+"   "+p.unlocked);
                    //~ Debug.Log(p.ID+"  "+p.name+"    "+p.enableInlvl);
                    perk.enableInlvl = p.enableInlvl;
                    perk.unlocked    = p.unlocked;
                }
            }
        }

        pm.allPerkList = list;
        EditorUtility.SetDirty(pm);

        Undo.CreateSnapshot();
        Undo.RegisterSnapshot();
        Undo.ClearSnapshotTarget();
    }
Beispiel #27
0
    // OnInspectorGUI
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        Undo.SetSnapshotTarget(m_Component, "OVRCameraController");

        {
#if CUSTOM_LAYOUT
            m_Component.NeckPosition      = EditorGUILayout.Vector3Field("Neck Position", m_Component.NeckPosition);
            m_Component.EyeCenterPosition = EditorGUILayout.Vector3Field("Eye Center Position", m_Component.EyeCenterPosition);

            OVREditorGUIUtility.Separator();

            m_Component.FollowOrientation = EditorGUILayout.ObjectField("Follow Orientation",
                                                                        m_Component.FollowOrientation,
                                                                        typeof(Transform), true) as Transform;
            m_Component.TrackerRotatesY = EditorGUILayout.Toggle("Tracker Rotates Y", m_Component.TrackerRotatesY);

            OVREditorGUIUtility.Separator();

            m_Component.PredictionOn    = EditorGUILayout.Toggle("Prediction On", m_Component.PredictionOn);
            m_Component.CallInPreRender = EditorGUILayout.Toggle("Call in Pre-Render", m_Component.CallInPreRender);
            m_Component.WireMode        = EditorGUILayout.Toggle("Wire-Frame Mode", m_Component.WireMode);
            m_Component.LensCorrection  = EditorGUILayout.Toggle("Lens Correction", m_Component.LensCorrection);
            m_Component.Chromatic       = EditorGUILayout.Toggle("Chromatic", m_Component.Chromatic);

            OVREditorGUIUtility.Separator();

            m_Component.BackgroundColor = EditorGUILayout.ColorField("Background Color", m_Component.BackgroundColor);
            m_Component.NearClipPlane   = EditorGUILayout.FloatField("Near Clip Plane", m_Component.NearClipPlane);
            m_Component.FarClipPlane    = EditorGUILayout.FloatField("Far Clip Plane", m_Component.FarClipPlane);

            OVREditorGUIUtility.Separator();
#else
            DrawDefaultInspector();
#endif
        }

        if (GUI.changed)
        {
            Undo.CreateSnapshot();
            Undo.RegisterSnapshot();
            EditorUtility.SetDirty(m_Component);
        }

        Undo.ClearSnapshotTarget();
    }
Beispiel #28
0
        private void OnGUI()
        {
            if (_inputManager == null)
            {
                return;
            }

            if (_configurationFoldouts.Count != _inputManager.inputConfigurations.Count)
            {
                UpdateFoldouts();
            }

#if UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2
            Undo.SetSnapshotTarget(_inputManager, "InputManager");
            Undo.CreateSnapshot();
#else
            Undo.RecordObject(_inputManager, "InputManager");
#endif
            UpdateHierarchyPanelWidth();
            if (_searchString.Length > 0)
            {
                DisplaySearchResults();
            }
            else
            {
                DisplayHierarchyPanel();
            }
            if (_selectionPath.Count >= 1)
            {
                DisplayMainPanel();
            }
            DisplayMainToolbar();
#if UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2
            if (GUI.changed)
            {
                Undo.RegisterSnapshot();
                EditorUtility.SetDirty(_inputManager);
            }
            Undo.ClearSnapshotTarget();
#else
            if (GUI.changed)
            {
                EditorUtility.SetDirty(_inputManager);
            }
#endif
            Repaint();
        }
Beispiel #29
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        Undo.SetSnapshotTarget(target, "NGUI Crosshair Snapshot");
        Undo.CreateSnapshot();

        GUI.color = Color.white;

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();
        m_Target.StartingTexture = (Texture)EditorGUILayout.ObjectField("Crosshair", m_Target.StartingTexture, typeof(Texture), false);
        m_Target.EnemyCrosshair  = (Texture)EditorGUILayout.ObjectField("Enemy Crosshair", m_Target.EnemyCrosshair, typeof(Texture), true);
        GUILayout.EndHorizontal();
        m_Target.EnemyMask           = vp_EditorGUIUtility.LayerMaskField("Enemy Mask", m_Target.EnemyMask, true);
        m_Target.EnemyColor          = EditorGUILayout.ColorField("Enemy Color", m_Target.EnemyColor);
        m_Target.ColorChangeDuration = EditorGUILayout.FloatField("Color Change Duration", m_Target.ColorChangeDuration);
        m_Target.InteractIconSize    = EditorGUILayout.Slider("Interact Icon Size", m_Target.InteractIconSize, 0, 10);
        GUILayout.BeginHorizontal();
        m_Target.ScaleOnRun = EditorGUILayout.Toggle("Scale on Run", m_Target.ScaleOnRun);
        if (m_Target.ScaleOnRun)
        {
            GUILayout.Space(10);
            GUILayout.Label("Multiplier");
            m_Target.ScaleMultiplier = EditorGUILayout.Slider(m_Target.ScaleMultiplier, 0, 10);
        }
        GUILayout.EndHorizontal();
        m_Target.AssistedTargetingFoldout = EditorGUILayout.Foldout(m_Target.AssistedTargetingFoldout, "Assisted Targeting");
        if (m_Target.AssistedTargetingFoldout)
        {
            EditorGUI.indentLevel++;
            m_Target.AssistedTargeting               = EditorGUILayout.Toggle("Enabled", m_Target.AssistedTargeting);
            m_Target.AssistedTargetingSpeed          = EditorGUILayout.Slider("Tracking Speed", m_Target.AssistedTargetingSpeed, 0, 100);
            m_Target.AssistedTargetingRadius         = EditorGUILayout.Slider("Lock On Radius", m_Target.AssistedTargetingRadius, 0, 10);
            m_Target.AssistedTargetingTrackingRadius = EditorGUILayout.Slider("Tracking Radius", m_Target.AssistedTargetingTrackingRadius, 0, 10);
            EditorGUI.indentLevel--;
        }

        GUILayout.Space(10);

        // update
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            Undo.RegisterSnapshot();
        }
    }
Beispiel #30
0
    static void MakeGroup()
    {
        Undo.CreateSnapshot();

        //cache selected objects in scene:
        Transform[] selectedObjects = Selection.transforms;

        //early exit if nothing is selected:
        if (selectedObjects.Length == 0)
        {
            return;
        }

        //parent construction and hierarchy structure decision:
        bool nestParent = false;

        Undo.RegisterSceneUndo("Create Group");
        Transform _parent    = new GameObject("Group " + groupCount++).transform;        //naming convention mirrors Photoshop's
        Transform coreParent = selectedObjects[0].parent;

        foreach (Transform item in selectedObjects)
        {
            if (item.parent != coreParent)
            {
                nestParent = false;
                break;
            }
            else
            {
                nestParent = true;
            }
        }
        if (nestParent)
        {
            _parent.parent = coreParent;
        }

        //place group's pivot on the active transform in the scene:
        _parent.position = Selection.activeTransform.position;

        //set selected objects as children of the group:
        foreach (Transform item in selectedObjects)
        {
            item.parent = _parent;
        }
    }