コード例 #1
0
        /// <summary>
        /// 服务器时间
        /// </summary>
        private void OnServerTime(PacketBase packet)
        {
            c2ws.ServerTime msg = packet as c2ws.ServerTime;

            //告诉客户端当前服务器时间
            ws2c.ServerTime rep_msg = PacketPools.Get(ws2c.msg.SERVER_TIME) as ws2c.ServerTime;
            rep_msg.server_time = GameTimeManager.Instance.server_time;
            ServerNetManager.Instance.SendProxy(msg.client_uid, rep_msg);
        }
コード例 #2
0
 /// <summary>
 /// 服务器时间
 /// </summary>
 private void OnServerTime(PacketBase packet)
 {
     ws2c.ServerTime msg = packet as ws2c.ServerTime;
     Log.Debug("服务器时间:" + msg.server_time);
     if (timer_id != 0)
     {
         TimerManager.Instance.RemoveTimer(timer_id);
     }
     timer_id = TimerManager.Instance.AddLoop(1000 * 60 * 10, int.MaxValue, (id, param) => { ServerMsgSend.SendServerTime(); });
 }
コード例 #3
0
ファイル: Unit.cs プロジェクト: MartinRood/dc_c-_projectes
        /// <summary>
        /// 上线
        /// </summary>
        public void OnEnter()
        {
            m_last_active_time     = Time.timeSinceStartup;
            m_is_send_check_online = false;

            //告诉客户端当前服务器时间
            ws2c.ServerTime rep_msg = PacketPools.Get(ws2c.msg.SERVER_TIME) as ws2c.ServerTime;
            rep_msg.server_time = GameTimeManager.Instance.server_time;
            ServerNetManager.Instance.SendProxy(m_client_uid, rep_msg);

            EventController.TriggerEvent(EventID.PLAYER_ENTER_GAME, m_char_idx);
        }