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

        entities.Add(id, obj);
        return(id);
    }
Esempio 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);
    }
Esempio 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);
    }
Esempio 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;
 }
Esempio n. 6
0
 public int AddObject(wiComponent obj)
 {
     int id = ++IDSeed;
     entities.Add(id, obj);
     return id;
 }