public unsafe void OnWebEvent(int type, int num, wi.wiKeyValue *kvps) { var entities = wiSystem.GetInstance().entities; Dictionary <String, String> dic = new Dictionary <String, String>(); wiComponent receiver = null; for (int i = 0; i < num; ++i) { string name = Marshal.PtrToStringAnsi((IntPtr)kvps[i].key); string value = Marshal.PtrToStringAnsi((IntPtr)kvps[i].value); dic.Add(name, value); switch (name) { case "entity": { int id = Convert.ToInt32(value); entities.TryGetValue(id, out receiver); } break; } } if (receiver) { receiver.OnWebEvent((wi.wiEventType)type, dic); } if (handler != null) { handler((wi.wiEventType)type, dic); } }
public int AddObject(wiComponent obj) { int id = ++IDSeed; entities.Add(id, obj); return(id); }
public int GetTypeID(wiComponent obj) { int typeId = 0; if (!types.TryGetValue(obj.name, out typeId)) { types.Add(obj.name, ++typeIDSeed); typeId = typeIDSeed; } return(typeId); }
// utilities public static wiComponent GetTargetEntity(Dictionary <String, String> dic) { wiComponent ret = null; try { String str; if (dic.TryGetValue("target", out str)) { wiSystem.GetInstance().entities.TryGetValue(Convert.ToInt32(str), out ret); } } catch (Exception) {} return(ret); }
public int GetTypeID(wiComponent obj) { int typeId = 0; if (!types.TryGetValue(obj.name, out typeId)) { types.Add(obj.name, ++typeIDSeed); typeId = typeIDSeed; } return typeId; }
public int AddObject(wiComponent obj) { int id = ++IDSeed; entities.Add(id, obj); return id; }