コード例 #1
0
    private void SendHeartBeat(object param)
    {
        CG_CONNECTED_HEARTBEAT cgBeat = (CG_CONNECTED_HEARTBEAT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CONNECTED_HEARTBEAT);

        cgBeat.SetIsresponse(0);
        cgBeat.SendPacket();
    }
コード例 #2
0
 void Update()
 {
     if (m_bBeginHeartBeat)
     {
         m_HeartBeatTimer -= Time.deltaTime;
         if (m_HeartBeatTimer < 0)
         {
             CG_CONNECTED_HEARTBEAT cgBeat = (CG_CONNECTED_HEARTBEAT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CONNECTED_HEARTBEAT);
             cgBeat.SetIsresponse(0);
             cgBeat.SendPacket();
             m_HeartBeatTimer = 1.0f;
         }
     }
 }
コード例 #3
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_CONNECTED_HEARTBEAT packet = (GC_CONNECTED_HEARTBEAT)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            GlobalData.ServerAnsiTime = packet.Serveransitime;

            Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;

            if (null != mainPlayer)
            {
                mainPlayer.SynServerDateTime();
                mainPlayer.LastHeartBeatTime = UnityEngine.Time.time;
            }
            CG_CONNECTED_HEARTBEAT cgBeat = (CG_CONNECTED_HEARTBEAT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CONNECTED_HEARTBEAT);

            cgBeat.SetIsresponse(1);
            cgBeat.SendPacket();
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }