Tanoda
UndoReflection.cs
Go to the documentation of this file.
1using UnityEngine;
2using System.Reflection;
3using System.Collections;
4
5namespace GILES
6{
10 public class UndoReflection : IUndo
11 {
12 public object target;
13 public string memberName;
14
15 public UndoReflection(object target, string member)
16 {
17 this.target = target;
18 this.memberName = member;
19 }
20
21 public UndoReflection(object target, MemberInfo info)
22 {
23 this.target = target;
24 this.memberName = info.Name;
25 }
26
27 public Hashtable RecordState()
28 {
29 Hashtable hash = new Hashtable();
30
31 hash.Add("value", pb_Reflection.GetValue<object>(target, memberName));
32
33 HttpCookie.SetCookie("unsavedChanges", "true", "", "/", "", "");
34 return hash;
35 }
36
37 public void ApplyState(Hashtable hash)
38 {
39 pb_Reflection.SetValue(target, memberName, hash["value"]);
40 }
41
42 public void OnExitScope() {}
43 }
44}
Hashtable RecordState()
void ApplyState(Hashtable hash)
UndoReflection(object target, MemberInfo info)
UndoReflection(object target, string member)