public void RegisterDelegate(ENPCType type, NPCHandle handle) { if (eventMap.ContainsKey(type)) { eventMap[type] += handle; } else { eventMap[type] = handle; } }
public bool TryNpcResponse(int id) { NPCDefine define = null; if (!Managers.DataManager.Instance.NPCs.TryGetValue(id, out define)) { return(false); } NPCHandle handle = null; if (!eventMap.TryGetValue(define.Type, out handle)) { return(false); } if (handle == null) { return(false); } return(handle(define)); }