protected virtual void ReceviceMessage(InputNetworkMessageEvent e)
 {
     if (e.m_MessgaeType == "HB")
     {
         ResetReceviceTimer();
     }
 }
    // static Deserializer deserializer = new Deserializer();

    private static void MessageReceiveCallBack(InputNetworkMessageEvent inputEvent)
    {
        if (ApplicationManager.Instance.m_AppMode != AppMode.Release)
        {
            Debug.Log("MessageReceiveCallBack ;" + JsonUtils.ToJson(inputEvent));
        }

        Type type = Type.GetType(inputEvent.m_MessgaeType);

        if (type == null)
        {
            Debug.LogError("No MessgaeType :" + inputEvent.m_MessgaeType);
            return;
        }

        object dataObj = JsonUtils.FromJson(type, inputEvent.Data["Content"].ToString());// deserializer.Deserialize(type, inputEvent.Data["Content"].ToString());
        MessageClassInterface msgInterface = (MessageClassInterface)dataObj;

        msgInterface.DispatchMessage();

        if (msgInterface is CodeMessageBase)
        {
            CodeMessageBase codeMsg = (CodeMessageBase)msgInterface;

            GlobalEvent.DispatchEvent(ErrorCodeMessage, codeMsg);
        }
    }
    static void ReceviceDebugMsg(InputNetworkMessageEvent e)
    {
        Protocol.DebugMsg msg = new Protocol.DebugMsg();
        msg.frame = (int)e.Data["frame"];
        {
            List <Dictionary <string, object> > data2 = (List <Dictionary <string, object> >)e.Data["infos"];
            List <Protocol.EntityInfo>          list2 = new List <Protocol.EntityInfo>();
            for (int i2 = 0; i2 < data2.Count; i2++)
            {
                Protocol.EntityInfo tmp2 = new Protocol.EntityInfo();
                tmp2.id = (int)data2[i2]["id"];
                {
                    List <Dictionary <string, object> > data4 = (List <Dictionary <string, object> >)data2[i2]["infos"];
                    List <Protocol.ComponentInfo>       list4 = new List <Protocol.ComponentInfo>();
                    for (int i4 = 0; i4 < data4.Count; i4++)
                    {
                        Protocol.ComponentInfo tmp4 = new Protocol.ComponentInfo();
                        tmp4.m_compName = data4[i4]["m_compname"].ToString();
                        tmp4.content    = data4[i4]["content"].ToString();
                        list4.Add(tmp4);
                    }
                    tmp2.infos = list4;
                }
                list2.Add(tmp2);
            }
            msg.infos = list2;
        }

        GlobalEvent.DispatchTypeEvent(msg);
    }
Exemplo n.º 4
0
    private static void MessageReceiveCallBack(InputNetworkMessageEvent inputEvent)
    {
        if (msgs == null || msgs.Count == 0)
        {
            return;
        }
        foreach (ResendMessage m in msgs)
        {
            if (m.removeMT == inputEvent.m_MessgaeType)
            {
                Debug.Log("移除重发:" + m.removeMT);
                msgs.Remove(m);
                SaveRecord();
                if (m.callBack != null)
                {
                    MessageClassInterface msgInterface = null;
                    Type type = Type.GetType(inputEvent.m_MessgaeType);

                    if (type == null)
                    {
                        Debug.LogError("No MessgaeType :" + inputEvent.m_MessgaeType);
                    }
                    else
                    {
                        object dataObj = JsonUtils.FromJson(type, inputEvent.Data["Content"].ToString());
                        msgInterface = (MessageClassInterface)dataObj;
                    }

                    m.callBack(msgInterface);
                }
                break;
            }
        }
    }
Exemplo n.º 5
0
    static void ReceviceDestroyEntityMsg(InputNetworkMessageEvent e)
    {
        Protocol.DestroyEntityMsg msg = new Protocol.DestroyEntityMsg();
        msg.frame = (int)e.Data["frame"];
        msg.id    = (int)e.Data["id"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
    static void RecevicePursueMsg(InputNetworkMessageEvent e)
    {
        Protocol.PursueMsg msg = new Protocol.PursueMsg();
        msg.frame        = (int)e.Data["frame"];
        msg.advanceCount = (int)e.Data["advancecount"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
    static void ReceviceStartSyncMsg(InputNetworkMessageEvent e)
    {
        Protocol.StartSyncMsg msg = new Protocol.StartSyncMsg();
        msg.frame        = (int)e.Data["frame"];
        msg.intervalTime = (int)e.Data["intervaltime"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
    static void ReceviceStartSyncMsg(InputNetworkMessageEvent e)
    {
        Protocol.StartSyncMsg msg = new Protocol.StartSyncMsg();
        msg.frame             = (int)e.Data["frame"];
        msg.advanceCount      = (int)e.Data["advancecount"];
        msg.intervalTime      = (int)e.Data["intervaltime"];
        msg.createEntityIndex = (int)e.Data["createentityindex"];
        msg.SyncRule          = (SyncRule)e.Data["syncrule"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
Exemplo n.º 9
0
    public static void DispatchMessageEvent(string massageType, Dictionary <string, object> data)
    {
        //只有允许输入时才派发事件
        if (IsActive)
        {
            InitPool();
            InputNetworkMessageEvent e = GetMsgEvent();

            e.m_MessgaeType = massageType;
            e.Data          = data;
            InputManager.Dispatch <InputNetworkMessageEvent>(e);
        }
    }
    static void ReceviceCommandComponent(InputNetworkMessageEvent e)
    {
        CommandComponent msg = new CommandComponent();

        msg.isForward = (bool)e.Data["isforward"];
        msg.isBack    = (bool)e.Data["isback"];
        msg.isRight   = (bool)e.Data["isright"];
        msg.isLeft    = (bool)e.Data["isleft"];
        msg.isFire    = (bool)e.Data["isfire"];
        msg.id        = (int)e.Data["id"];
        msg.frame     = (int)e.Data["frame"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
Exemplo n.º 11
0
 static int Reset(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         InputNetworkMessageEvent obj = (InputNetworkMessageEvent)ToLua.CheckObject(L, 1, typeof(InputNetworkMessageEvent));
         obj.Reset();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 12
0
    static void ReceviceChangeSingletonComponentMsg(InputNetworkMessageEvent e)
    {
        Protocol.ChangeSingletonComponentMsg msg = new Protocol.ChangeSingletonComponentMsg();
        msg.frame = (int)e.Data["frame"];
        {
            Dictionary <string, object> data2 = (Dictionary <string, object>)e.Data["info"];
            Protocol.ComponentInfo      tmp2  = new Protocol.ComponentInfo();
            tmp2.m_compName = data2["m_compname"].ToString();
            tmp2.content    = data2["content"].ToString();
            msg.info        = tmp2;
        }

        GlobalEvent.DispatchTypeEvent(msg);
    }
Exemplo n.º 13
0
 static int Serialize(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         InputNetworkMessageEvent obj = (InputNetworkMessageEvent)ToLua.CheckObject(L, 1, typeof(InputNetworkMessageEvent));
         string o = obj.Serialize();
         LuaDLL.lua_pushstring(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 14
0
    static InputNetworkMessageEvent GetMsgEvent()
    {
        InputNetworkMessageEvent msg = m_msgPool[m_msgIndex];

        msg.Reset();

        m_msgIndex++;

        if (m_msgIndex >= m_msgPool.Length)
        {
            m_msgIndex = 0;
        }


        return(msg);
    }
Exemplo n.º 15
0
    static int get_Data(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            InputNetworkMessageEvent obj = (InputNetworkMessageEvent)o;
            System.Collections.Generic.Dictionary <string, object> ret = obj.Data;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Data on a nil value" : e.Message));
        }
    }
Exemplo n.º 16
0
    static int get_m_content(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            InputNetworkMessageEvent obj = (InputNetworkMessageEvent)o;
            string ret = obj.m_content;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_content on a nil value" : e.Message));
        }
    }
Exemplo n.º 17
0
    static int set_Data(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            InputNetworkMessageEvent obj = (InputNetworkMessageEvent)o;
            System.Collections.Generic.Dictionary <string, object> arg0 = (System.Collections.Generic.Dictionary <string, object>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Dictionary <string, object>));
            obj.Data = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Data on a nil value" : e.Message));
        }
    }
Exemplo n.º 18
0
    static int set_m_content(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            InputNetworkMessageEvent obj = (InputNetworkMessageEvent)o;
            string arg0 = ToLua.CheckString(L, 2);
            obj.m_content = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_content on a nil value" : e.Message));
        }
    }
Exemplo n.º 19
0
    static void InitPool()
    {
        if (!isInit)
        {
            isInit           = true;
            m_connectMsgPool = new InputNetworkConnectStatusEvent[c_connectMsgPool];
            for (int i = 0; i < c_connectMsgPool; i++)
            {
                m_connectMsgPool[i] = new InputNetworkConnectStatusEvent();
            }

            m_msgPool = new InputNetworkMessageEvent[c_msgPoolSize];
            for (int i = 0; i < c_msgPoolSize; i++)
            {
                m_msgPool[i] = new InputNetworkMessageEvent();
            }
        }
    }
Exemplo n.º 20
0
    // static Deserializer deserializer = new Deserializer();

    private static void MessageReceiveCallBack(InputNetworkMessageEvent inputEvent)
    {
        Debug.Log("MessageReceiveCallBack ;" + JsonUtils.ToJson(inputEvent));

        Type type = Type.GetType(inputEvent.m_MessgaeType);

        if (type == null)
        {
            Debug.LogError("No MessgaeType :" + inputEvent.m_MessgaeType);
            return;
        }

        object dataObj = JsonUtils.JsonToClassOrStruct(inputEvent.Data["Content"].ToString(), type);// deserializer.Deserialize(type, inputEvent.Data["Content"].ToString());

        MethodInfo method = type.GetMethod("DispatchMessage");

        method.Invoke(dataObj, null);
    }
Exemplo n.º 21
0
    static int _CreateInputNetworkMessageEvent(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                InputNetworkMessageEvent obj = new InputNetworkMessageEvent();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: InputNetworkMessageEvent.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static void InitPool()
    {
        if (!isInit)
        {
            isInit = true;
            m_connectMsgPool = new InputNetworkConnectStatusEvent[c_connectMsgPool];
            for (int i = 0; i < c_connectMsgPool; i++)
            {
                m_connectMsgPool[i] = new InputNetworkConnectStatusEvent();
            }

            m_msgPool = new InputNetworkMessageEvent[c_msgPoolSize];
            for (int i = 0; i < c_msgPoolSize; i++)
            {
                m_msgPool[i] = new InputNetworkMessageEvent();
            }
        }
    }
Exemplo n.º 23
0
    static void ReceviceWaitSyncComponent(InputNetworkMessageEvent e)
    {
        LockStepDemo.GameLogic.Component.WaitSyncComponent msg = new LockStepDemo.GameLogic.Component.WaitSyncComponent();

        GlobalEvent.DispatchTypeEvent(msg);
    }