static void SendPlayerSelectCharacter_c(SyncSession session, PlayerSelectCharacter_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("content", msg.content);
        session.SendMsg("playerselectcharacter", data);
    }
Пример #2
0
    static void SendPlayerBuyCharacter_c(SyncSession session, PlayerBuyCharacter_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("code", msg.code);
        session.SendMsg("playerbuycharacter", data);
    }
    static void SendDebugMsg(SyncSession session, Protocol.DebugMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        {
            List <object> list2 = new List <object>();
            for (int i2 = 0; i2 < msg.infos.Count; i2++)
            {
                Dictionary <string, object> data2 = new Dictionary <string, object>();
                data2.Add("id", msg.infos[i2].id);
                {
                    List <object> list4 = new List <object>();
                    for (int i4 = 0; i4 < msg.infos[i2].infos.Count; i4++)
                    {
                        Dictionary <string, object> data4 = new Dictionary <string, object>();
                        data4.Add("m_compname", msg.infos[i2].infos[i4].m_compName);
                        data4.Add("content", msg.infos[i2].infos[i4].content);
                        list4.Add(data4);
                    }
                    data2.Add("infos", list4);
                }
                list2.Add(data2);
            }
            data.Add("infos", list2);
        }
        session.SendMsg("debugmsg", data);
    }
    static void SendCommandComponent(SyncSession session, CommandComponent msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        {
            Dictionary <string, object> data2 = new Dictionary <string, object>();
            data2.Add("x", msg.moveDir.x);
            data2.Add("y", msg.moveDir.y);
            data2.Add("z", msg.moveDir.z);
            data.Add("movedir", data2);
        }
        {
            Dictionary <string, object> data2 = new Dictionary <string, object>();
            data2.Add("x", msg.skillDir.x);
            data2.Add("y", msg.skillDir.y);
            data2.Add("z", msg.skillDir.z);
            data.Add("skilldir", data2);
        }
        data.Add("element1", msg.element1);
        data.Add("element2", msg.element2);
        data.Add("isfire", msg.isFire);
        data.Add("id", msg.id);
        data.Add("frame", msg.frame);
        data.Add("time", msg.time);
        session.SendMsg("commandcomponent", data);
    }
Пример #5
0
    static void SendPlayerRename_c(SyncSession session, PlayerRename_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("code", msg.code);
        data.Add("newname", msg.newName);
        session.SendMsg("playerrename", data);
    }
Пример #6
0
    static void SendQueryCommand(SyncSession session, Protocol.QueryCommand msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("id", msg.id);
        session.SendMsg("querycommand", data);
    }
    static void SendAffirmMsg(SyncSession session, Protocol.AffirmMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("time", msg.time);
        session.SendMsg("affirmmsg", data);
    }
    public static void SendMsg(this SyncSession session, Protocol.StartSyncMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("intervaltime", msg.intervalTime);
        session.SendMsg("startsyncmsg", data);
    }
    static void SendPursueMsg(SyncSession session, Protocol.PursueMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("advancecount", msg.advanceCount);
        session.SendMsg("pursuemsg", data);
    }
    static void SendDestroyEntityMsg(SyncSession session, Protocol.DestroyEntityMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("id", msg.id);
        session.SendMsg("destroyentitymsg", data);
    }
    static void SendPlayerMatchMsg_c(SyncSession session, PlayerMatchMsg_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("predicttime", msg.predictTime);
        data.Add("ismatched", msg.isMatched);
        session.SendMsg("playermatchmsg", data);
    }
    static void SendPlayerLoginMsg_c(SyncSession session, PlayerLoginMsg_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("code0", msg.code0);
        data.Add("content", msg.content);
        data.Add("characterid", msg.characterID);
        session.SendMsg("playerloginmsg", data);
    }
Пример #13
0
    static void SendPlayerSettlement_c(SyncSession session, PlayerSettlement_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("rank", msg.rank);
        data.Add("score", msg.score);
        data.Add("historicalhighest", msg.historicalHighest);
        data.Add("diamond", msg.diamond);
        session.SendMsg("playersettlement", data);
    }
Пример #14
0
        public void PushStartSyncMsg(SyncSession session)
        {
            Debug.Log("PushStartSyncMsg");

            StartSyncMsg msg = new StartSyncMsg();

            msg.frame        = m_world.FrameCount + 1;
            msg.intervalTime = UpdateEngine.IntervalTime;

            session.SendMsg(msg);
        }
Пример #15
0
        public void PushSingletonComp(SyncSession session, string compName)
        {
            SingletonComponent          comp = m_world.GetSingletonComp(compName);
            ChangeSingletonComponentMsg msg  = new ChangeSingletonComponentMsg();

            msg.info.m_compName = compName;
            msg.info.content    = Serializer.Serialize(comp);
            msg.frame           = m_world.FrameCount;

            session.SendMsg(msg);
        }
Пример #16
0
        void PushDestroyEntity(SyncSession session, int entityID)
        {
            DestroyEntityMsg msg = new DestroyEntityMsg();

            msg.id    = entityID;
            msg.frame = m_world.FrameCount;

            session.SendMsg(msg);

            Debug.Log("PushDestroyEntity 3");
        }
    static void SendStartSyncMsg(SyncSession session, Protocol.StartSyncMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("advancecount", msg.advanceCount);
        data.Add("intervaltime", msg.intervalTime);
        data.Add("createentityindex", msg.createEntityIndex);
        data.Add("syncrule", (int)msg.SyncRule);
        session.SendMsg("startsyncmsg", data);
    }
Пример #18
0
    static void SendPursueMsg(SyncSession session, Protocol.PursueMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("id", msg.id);
        data.Add("recalcframe", msg.recalcFrame);
        data.Add("frame", msg.frame);
        data.Add("advancecount", msg.advanceCount);
        data.Add("servertime", msg.serverTime);
        data.Add("updatespeed", msg.updateSpeed);
        session.SendMsg("pursuemsg", data);
    }
        void PushDestroyEntity(SyncSession session, int entityID)
        {
            FrameCountComponent fc  = m_world.GetSingletonComp <FrameCountComponent>();
            DestroyEntityMsg    msg = new DestroyEntityMsg();

            msg.id    = entityID;
            msg.frame = fc.count;

            session.SendMsg(msg);

            Debug.Log("PushDestroyEntity 3");
        }
    static void SendChangeSingletonComponentMsg(SyncSession session, Protocol.ChangeSingletonComponentMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        {
            Dictionary <string, object> data2 = new Dictionary <string, object>();
            data2.Add("m_compname", msg.info.m_compName);
            data2.Add("content", msg.info.content);
            data.Add("info", data2);
        }
        session.SendMsg("changesingletoncomponentmsg", data);
    }
    public static void SendMsg(this SyncSession session, CommandComponent msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("isforward", msg.isForward);
        data.Add("isback", msg.isBack);
        data.Add("isright", msg.isRight);
        data.Add("isleft", msg.isLeft);
        data.Add("isfire", msg.isFire);
        data.Add("id", msg.id);
        data.Add("frame", msg.frame);
        session.SendMsg("commandcomponent", data);
    }
        public void PushSyncEnity(SyncSession session, EntityBase entity)
        {
            if (!session.Connected)
            {
                return;
            }

            FrameCountComponent fc = m_world.GetSingletonComp <FrameCountComponent>();

            SyncEntityMsg msg = new SyncEntityMsg();

            msg.frame = fc.count;
            msg.id    = entity.ID;
            msg.infos = new List <ComponentInfo>();

            foreach (var c in entity.m_compDict)
            {
                Type type = c.Value.GetType();

                if (!type.IsSubclassOf(typeof(ServiceComponent)))
                {
                    ComponentInfo info = new ComponentInfo();
                    info.m_compName = type.Name;
                    info.content    = Serializer.Serialize(c.Value);
                    msg.infos.Add(info);
                }
            }

            //给有连接组件的增加Self组件
            if (entity.GetExistComp <ConnectionComponent>())
            {
                ConnectionComponent comp = entity.GetComp <ConnectionComponent>();
                if (comp.m_session == session)
                {
                    ComponentInfo info = new ComponentInfo();
                    info.m_compName = "SelfComponent";
                    info.content    = "{}";
                    msg.infos.Add(info);
                }
                else
                {
                    ComponentInfo info = new ComponentInfo();
                    info.m_compName = "TheirComponent";
                    info.content    = "{}";
                    msg.infos.Add(info);
                }
            }

            session.SendMsg(msg);
        }
Пример #23
0
    static void SendPlayerLoginMsg_c(SyncSession session, PlayerLoginMsg_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("code", msg.code);
        data.Add("characterid", msg.characterID);
        {
            List <object> list = new List <object>();
            for (int i = 0; i < msg.ownCharacter.Count; i++)
            {
                list.Add(msg.ownCharacter[i]);
            }
            data.Add("owncharacter", list);
        }
        data.Add("coin", msg.coin);
        data.Add("diamond", msg.diamond);
        session.SendMsg("playerloginmsg", data);
    }
    public static void SendMsg(this SyncSession session, Protocol.SyncEntityMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("id", msg.id);
        {
            List <object> list2 = new List <object>();
            for (int i2 = 0; i2 < msg.infos.Count; i2++)
            {
                Dictionary <string, object> data2 = new Dictionary <string, object>();
                data2.Add("m_compname", msg.infos[i2].m_compName);
                data2.Add("content", msg.infos[i2].content);
                list2.Add(data2);
            }
            data.Add("infos", list2);
        }
        session.SendMsg("syncentitymsg", data);
    }
    static void SendCommandMsg(SyncSession session, Protocol.CommandMsg msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("frame", msg.frame);
        data.Add("servertime", msg.serverTime);
        {
            List <object> list2 = new List <object>();
            for (int i2 = 0; i2 < msg.msg.Count; i2++)
            {
                Dictionary <string, object> data2 = new Dictionary <string, object>();
                data2.Add("frame", msg.msg[i2].frame);
                data2.Add("id", msg.msg[i2].id);
                {
                    Dictionary <string, object> data4 = new Dictionary <string, object>();
                    data4.Add("x", msg.msg[i2].moveDir.x);
                    data4.Add("y", msg.msg[i2].moveDir.y);
                    data4.Add("z", msg.msg[i2].moveDir.z);
                    data2.Add("movedir", data4);
                }
                {
                    Dictionary <string, object> data4 = new Dictionary <string, object>();
                    data4.Add("x", msg.msg[i2].skillDir.x);
                    data4.Add("y", msg.msg[i2].skillDir.y);
                    data4.Add("z", msg.msg[i2].skillDir.z);
                    data2.Add("skilldir", data4);
                }
                data2.Add("element1", msg.msg[i2].element1);
                data2.Add("element2", msg.msg[i2].element2);
                data2.Add("isfire", msg.msg[i2].isFire);
                list2.Add(data2);
            }
            data.Add("msg", list2);
        }
        session.SendMsg("commandmsg", data);
    }
    static void SendPlayerResurgence_c(SyncSession session, PlayerResurgence_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        session.SendMsg("playerresurgence", data);
    }
    public static void SendMsg(this SyncSession session, LockStepDemo.GameLogic.Component.WaitSyncComponent msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        session.SendMsg("waitsynccomponent", data);
    }