示例#1
0
文件: Session.cs 项目: lisg2016/ET
        public void Send(byte flag, IMessage message)
        {
            ushort opcode = Game.Scene.GetComponent <OpcodeTypeComponent>().GetOpcode(message.GetType());

            byte[] bytes = ProtobufHelper.ToBytes(message);
            session.Send(flag, opcode, bytes);
        }
示例#2
0
 public void Send(ushort opcode, IMessage message)
 {
     if (OpcodeHelper.IsNeedDebugLogMessage(opcode))
     {
         Log.Msg(message);
     }
     session.Send(opcode, message);
 }
示例#3
0
 public void Send(byte flag, ushort opcode, IMessage message)
 {
     session.Send(flag, opcode, message);
     if (OpcodeHelper.IsNeedDebugLogMessage(opcode))
     {
         ETModel.Log.Msg(message);
     }
 }
示例#4
0
        protected override void Run(ETModel.Session session, C2S_Exit msg)
        {
            Log.Info($"C2S_ExitHandler message: {msg.Name}  RpcId= {msg.RpcId}    ");

            session.Send(new S2C_Exit()
            {
                Name = "Server TestNetwork"
            });
        }
示例#5
0
        public async void Broadcast2Kad(int kIndex, IMessage message)
        {
            List <NodeData> result = GetkList(kIndex);

            for (int i = 0; i < result.Count; i++)
            {
                NodeData node    = result[i];
                Session  session = await networkInner.Get(NetworkHelper.ToIPEndPoint(node.ipEndPoint));

                if (session != null && session.IsConnect())
                {
                    session.Send(message);
                }
            }
        }
示例#6
0
        private async void SendMessage()
        {
            for (int i = 0; i < 100; i++)
            {
                await Game.Scene.GetComponent <TimerComponent>().WaitAsync(500);

                if (this.GateSession != null)
                {
                    GateSession.Send(new G2C_TestHotfixMessage()
                    {
                        Info = "recv hotfix message success" + i
                    });
                }
            }
        }
示例#7
0
        public async void Broadcast(P2P_NewBlock p2p_Block, Block block)
        {
            var myNodeId = GetMyNodeId();

            for (int i = 0; i < nodes.Count; i++)
            {
                NodeData node = nodes[i];
                if (node.nodeId != myNodeId)
                {
                    Session session = await networkInner.Get(NetworkHelper.ToIPEndPoint(node.ipEndPoint));

                    if (session != null && session.IsConnect())
                    {
                        session.Send(p2p_Block);
                    }
                }
            }
        }
示例#8
0
文件: Session.cs 项目: superzys/ET
        public void Send(byte flag, IMessage message)
        {
            ushort opcode = Game.Scene.GetComponent <OpcodeTypeComponent>().GetOpcode(message.GetType());

            session.Send(flag, opcode, message);
        }
示例#9
0
文件: Session.cs 项目: qn9663/ET
 public void Send(byte flag, ushort opcode, IMessage message)
 {
     session.Send(flag, opcode, message);
 }