Beispiel #1
0
    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);
        }
    }