public void RevertToOriginal(RevertType revertType) { try { switch (revertType) { case RevertType.NameOnly: this.DriverFirstName = this.mDriverFirstName_Original; this.DriverLastName = this.mDriverLastName_Original; break; case RevertType.RatingsOnly: this.MappedToRealDriver = null; this.Ratings = (Ratings)this.mRatings_Original.Clone(); break; case RevertType.Completely: this.DriverFirstName = this.mDriverFirstName_Original; this.DriverLastName = this.mDriverLastName_Original; this.MappedToRealDriver = null; this.Ratings = (Ratings)this.mRatings_Original.Clone(); break; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private void Revert(RevertType revertType) { EditorGUI.BeginChangeCheck(); switch (revertType) { case RevertType.All: Undo.ClearUndo(SelectedPath); // Clear the current list SelectedPath.Nodes.Clear(); // Add each new node foreach (Path.Node node in SelectedPath.NodesBackup) { SelectedPath.Nodes.Add(new Path.Node(node.Position, node.TangentA, node.TangentB)); } SelectedPath.transform.position = SelectedPath.PositionBackup; SelectedPath.transform.rotation = SelectedPath.RotationBackup; SelectedPath.transform.localScale = SelectedPath.ScaleBackup; break; case RevertType.Path: SelectedPath.Nodes.Clear(); foreach (Path.Node node in SelectedPath.NodesBackup) { SelectedPath.Nodes.Add(new Path.Node(node.Position, node.TangentA, node.TangentB)); } break; case RevertType.Position: SelectedPath.transform.position = SelectedPath.PositionBackup; break; case RevertType.Rotation: SelectedPath.transform.rotation = SelectedPath.RotationBackup; break; case RevertType.Scale: SelectedPath.transform.localScale = SelectedPath.ScaleBackup; break; } EditorGUI.EndChangeCheck(); }
public RevertInfo(MonoBehaviour monoBehaviour, object actor, object value, RevertType type, RevertValueType valueType) { MonoBehaviour = monoBehaviour; _Actor = actor; _Value = value; _RevertType = type; _RevertValueType = valueType; string name; if (actor is UnityEngine.Object) { name = ((UnityEngine.Object)actor).name; } else { name = actor.ToString(); } Common.HobaDebuger.LogWarningFormat("Revert {0}, {1}, {2}, {3}", name, _RevertType, _RevertValueType, _Value); }