All checks were successful
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Successful in 5m17s
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Successful in 5m19s
Build project / Publish to itch.io (StandaloneLinux64) (push) Successful in 5s
Build project / Publish to itch.io (StandaloneWindows64) (push) Successful in 5s
46 lines
930 B
C#
46 lines
930 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
public class ActionMap<T> {
|
|
|
|
#region Fields
|
|
|
|
private Dictionary<T, Action> _dictionary;
|
|
#endregion
|
|
|
|
#region Properties
|
|
public ActionMap() {
|
|
_dictionary = new Dictionary<T, Action>();
|
|
}
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
// alternative of operator[]
|
|
public bool IsActive(T ID) {
|
|
return this[ID].IsActive();
|
|
}
|
|
#endregion
|
|
|
|
#region Operators
|
|
// operator[] to access dictionary
|
|
public Action this[T ID] {
|
|
get {
|
|
return _dictionary.ContainsKey(ID) ? _dictionary[ID] : null;
|
|
}
|
|
set {
|
|
if (!_dictionary.ContainsKey(ID))
|
|
_dictionary.Add(ID, value);
|
|
else
|
|
_dictionary[ID] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|