示例#1
0
文件: Hook.cs 项目: qipa/Unity-2
		public static void Create(HOOKS hook, string identifier) {
			int index = HookToIndex(hook);
			if (System.Diagnostics.Debugger.IsAttached){
				if (index < hooks.Length ? hooks[index] != null : false)
					throw new Exception(String.Format("Error: Hook index '{0}' already exists.", index));
				if (hookStrings.ContainsKey(identifier))
					throw new Exception(String.Format("Error: Hook indentifier '{0}' already exists.", identifier));
			}
			
			if (index >= hooks.Length)
				Array.Resize(ref hooks, index + 1); //As we're using primitive arrays, resize if the id is larger than the allocated size
			
			hooks[index] = new List<Item>(){};
			hookStrings.Add(identifier, index);
		}
示例#2
0
文件: Hook.cs 项目: qipa/Unity-2
		public static void Add(HOOKS hook, Action funct) {
			AddFunct(GetActionList(HookToIndex(hook)), new ItemNoPara(funct));
		}
示例#3
0
文件: Hook.cs 项目: qipa/Unity-2
		public static void Add(HOOKS hook, Action<System.Object[]> funct) {
			AddFunct(GetActionList(HookToIndex(hook)), new Item(funct));
		}
示例#4
0
文件: Hook.cs 项目: qipa/Unity-2
		private static int HookToIndex(HOOKS hook) {
			return (int) hook;
		}
示例#5
0
文件: Hook.cs 项目: qipa/Unity-2
		public static void Call(HOOKS hook, params System.Object[] para) {
			Item.para = para;
			Call(hook);
		}
示例#6
0
文件: Hook.cs 项目: qipa/Unity-2
		public static void Call(HOOKS hook) {
			GetActionList(HookToIndex(hook)).ForEach(Invoke);
		}