Ejemplo n.º 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);
        }
    }
Ejemplo n.º 2
0
    public int AddObject(wiComponent obj)
    {
        int id = ++IDSeed;

        entities.Add(id, obj);
        return(id);
    }
Ejemplo n.º 3
0
    public int GetTypeID(wiComponent obj)
    {
        int typeId = 0;

        if (!types.TryGetValue(obj.name, out typeId))
        {
            types.Add(obj.name, ++typeIDSeed);
            typeId = typeIDSeed;
        }
        return(typeId);
    }
Ejemplo n.º 4
0
    // 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);
    }
Ejemplo n.º 5
0
 public int GetTypeID(wiComponent obj)
 {
     int typeId = 0;
     if (!types.TryGetValue(obj.name, out typeId))
     {
         types.Add(obj.name, ++typeIDSeed);
         typeId = typeIDSeed;
     }
     return typeId;
 }
Ejemplo n.º 6
0
 public int AddObject(wiComponent obj)
 {
     int id = ++IDSeed;
     entities.Add(id, obj);
     return id;
 }