public static void TriggerEvent(ParameterizedGameEvent eventName, object objParameter) { ObjEvent thisEvent = null; if (instance.objEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(objParameter); } }
public static void TriggerEvent(string eventName, GameObject g) { ObjEvent thisEvent = null; if (instance.ObjEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(g); } }
public static void StopListeningObj(string eventName, UnityAction <GameObject> listener) { if (eventManager == null) { return; } ObjEvent thisEvent = null; if (instance.ObjEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void StopListening(ParameterizedGameEvent eventName, UnityAction <object> listener) { if (eventManager == null) { return; } ObjEvent thisEvent = null; if (instance.objEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void StartListeningObj(string eventName, UnityAction <GameObject> listener) { ObjEvent thisObjEvent = null; if (instance.ObjEventDictionary.TryGetValue(eventName, out thisObjEvent)) { thisObjEvent.AddListener(listener); } else { thisObjEvent = new ObjEvent(); thisObjEvent.AddListener(listener); instance.ObjEventDictionary.Add(eventName, thisObjEvent); } }
public static void StartListening(ParameterizedGameEvent eventName, UnityAction <object> listener) { ObjEvent thisEvent = null; if (instance.objEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new ObjEvent(); thisEvent.AddListener(listener); instance.objEventDictionary.Add(eventName, thisEvent); } }
public Events(EndianBinaryReader r) { ushort count = r.ReadUInt16(); Warps = new WarpEvent[count]; for (int i = 0; i < count; i++) { Warps[i] = new WarpEvent(r); } count = r.ReadUInt16(); Objs = new ObjEvent[count]; for (int i = 0; i < count; i++) { Objs[i] = new ObjEvent(r); } }
public Events(JToken j) { var arr = (JArray)j[nameof(Warps)]; int count = arr.Count; Warps = new WarpEvent[count]; for (int i = 0; i < count; i++) { Warps[i] = new WarpEvent(arr[i]); } arr = (JArray)j[nameof(Objs)]; count = arr.Count; Objs = new ObjEvent[count]; for (int i = 0; i < count; i++) { Objs[i] = new ObjEvent(arr[i]); } }
// 登記事件,提醒 MapManager 對他的綁定物件進行動作. public void RegisterEvent(ObjEvent eventName) { this.objEvents.Add(eventName); }