BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
BrawlLib.Wii.Models.InfluenceManager Class Reference

Managed collection of influences. Only influences with references should be used. It is up to the implementation to properly manage this collection. More...

Public Member Functions

Influence FindOrCreate (Influence inf)
 
void Remove (Influence inf, IMatrixNodeUser user)
 
Influence[] GetWeighted ()
 
void Clean ()
 
void Sort ()
 

Properties

List< InfluenceInfluences [get]
 
int Count [get]
 

Detailed Description

Managed collection of influences. Only influences with references should be used. It is up to the implementation to properly manage this collection.

Member Function Documentation

◆ Clean()

void BrawlLib.Wii.Models.InfluenceManager.Clean ( )
inline
73 {
74 int i = 0;
75 while (i < Count)
76 {
77 if (_influences[i].Users.Count <= 0)
78 {
79 _influences.RemoveAt(i);
80 }
81 else
82 {
83 i++;
84 }
85 }
86 }
int Count
Definition: InfluenceManager.cs:37

◆ FindOrCreate()

Influence BrawlLib.Wii.Models.InfluenceManager.FindOrCreate ( Influence  inf)
inline
21 {
22 //Search for influence in list. If it exists, return it.
23 foreach (Influence i in _influences)
24 {
25 if (i.Equals(inf))
26 {
27 return i;
28 }
29 }
30
31 //Not found, add it to the list.
32 _influences.Add(inf);
33
34 return inf;
35 }

◆ GetWeighted()

Influence[] BrawlLib.Wii.Models.InfluenceManager.GetWeighted ( )
inline
58 {
59 List<Influence> list = new List<Influence>(_influences.Count);
60 foreach (Influence i in _influences)
61 {
62 if (i.IsWeighted)
63 {
64 list.Add(i);
65 }
66 }
67
68 return list.ToArray();
69 }

◆ Remove()

void BrawlLib.Wii.Models.InfluenceManager.Remove ( Influence  inf,
IMatrixNodeUser  user 
)
inline
40 {
41 for (int i = 0; i < Count; i++)
42 {
43 if (ReferenceEquals(_influences[i], inf) && inf.Users.Contains(user))
44 {
45 inf.Users.Remove(user);
46 if (inf.Users.Count <= 0)
47 {
48 _influences.RemoveAt(i);
49 }
50
51 break;
52 }
53 }
54 }

◆ Sort()

void BrawlLib.Wii.Models.InfluenceManager.Sort ( )
inline
90 {
91 _influences.Sort(Influence.Compare);
92 }

Property Documentation

◆ Count

int BrawlLib.Wii.Models.InfluenceManager.Count
get

◆ Influences

List<Influence> BrawlLib.Wii.Models.InfluenceManager.Influences
get

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