Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UndoManager Class Reference

Classes

class  Item
 

Public Member Functions

void Validate ()
 
void NewItem ()
 
void Add (Task t)
 
string GetText ()
 
void WriteNote (UINote n)
 
void Perform ()
 

Public Attributes

List< Itemitems = new List<Item>()
 

Properties

Item lastItem [get]
 

Detailed Description

Definition at line 4 of file UndoManager.cs.

Member Function Documentation

◆ Add()

void UndoManager.Add ( Task  t)
inline

Definition at line 60 of file UndoManager.cs.

61 {
62 lastItem.list.Add(t);
63 }
List< Task > list
Definition: UndoManager.cs:8
Item lastItem
Definition: UndoManager.cs:38

References lastItem, and UndoManager.Item.list.

Referenced by AM_Designation< T >.OnProcessTiles().

◆ GetText()

string UndoManager.GetText ( )
inline

Definition at line 65 of file UndoManager.cs.

66 {
67 string text = "";
68 text = "tUndo".lang() + Environment.NewLine;
69 if (items.Count == 0)
70 {
71 return text + "tUndoNone".lang();
72 }
73 return text + "tUndoNote".lang(lastItem.Count().ToString() ?? "", lastItem.name ?? "");
74 }
List< Item > items
Definition: UndoManager.cs:36

References UndoManager.Item.Count(), items, lastItem, and UndoManager.Item.name.

◆ NewItem()

void UndoManager.NewItem ( )
inline

Definition at line 51 of file UndoManager.cs.

52 {
53 items.Add(new Item());
54 if (items.Count > 10)
55 {
56 items.RemoveAt(0);
57 }
58 }

References items.

Referenced by AM_Designation< T >.OnBeforeProcessTiles().

◆ Perform()

void UndoManager.Perform ( )
inline

Definition at line 93 of file UndoManager.cs.

94 {
95 Validate();
96 if (items.Count == 0)
97 {
98 SE.Beep();
99 return;
100 }
101 foreach (Task item in lastItem.list)
102 {
103 item.Destroy();
104 }
105 items.Remove(lastItem);
106 SE.Play("trash");
107 }
Definition: Task.cs:4
void Validate()
Definition: UndoManager.cs:40

References item, items, lastItem, UndoManager.Item.list, and Validate().

Referenced by BuildMenu.OnActivate().

◆ Validate()

void UndoManager.Validate ( )
inline

Definition at line 40 of file UndoManager.cs.

41 {
42 for (int num = items.Count - 1; num >= 0; num--)
43 {
44 if (items[num].Count() == 0)
45 {
46 items.RemoveAt(num);
47 }
48 }
49 }

References items.

Referenced by Perform(), and WriteNote().

◆ WriteNote()

void UndoManager.WriteNote ( UINote  n)
inline

Definition at line 76 of file UndoManager.cs.

77 {
78 Validate();
79 n.Clear();
80 n.Space(10);
81 n.AddText("NoteText_topic", "tUndo".lang());
82 if (items.Count == 0)
83 {
84 n.AddText("tUndoNone".lang());
85 }
86 else
87 {
88 n.AddText("tUndoNote".lang(lastItem.Count().ToString() ?? "", lastItem.name ?? ""));
89 }
90 n.Build();
91 }
void Clear()
Definition: UINote.cs:35
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49

References UINote.AddText(), UINote.Build(), UINote.Clear(), UndoManager.Item.Count(), items, lastItem, UndoManager.Item.name, UINote.Space(), and Validate().

Referenced by BuildMenu.OnActivate().

Member Data Documentation

◆ items

List<Item> UndoManager.items = new List<Item>()

Definition at line 36 of file UndoManager.cs.

Referenced by GetText(), NewItem(), Perform(), Validate(), and WriteNote().

Property Documentation

◆ lastItem

Item UndoManager.lastItem
get

Definition at line 38 of file UndoManager.cs.

Referenced by Add(), GetText(), Perform(), and WriteNote().


The documentation for this class was generated from the following file: