コード例 #1
0
        /// <summary>
        /// 移动
        /// </summary>
        public static void SendUnitMove(int x, int y)
        {
            if (!CheckLogin())
            {
                return;
            }

            c2ss.UnitMove msg = PacketPools.Get(c2ss.msg.UNIT_MOVE) as c2ss.UnitMove;
            msg.pos.Set(x, y);
            ClientNetManager.Instance.Send(msg);
        }
コード例 #2
0
        /// <summary>
        /// 移动
        /// </summary>
        private void OnUnitMove(PacketBase packet)
        {
            c2ss.UnitMove msg = packet as c2ss.UnitMove;

            Player player = UnitManager.Instance.GetPlayerByClientUID(msg.client_uid);

            if (player == null)
            {
                Log.Debug("OnUnitMove 未找到unit:" + msg.client_uid.srv_uid + ", " + msg.client_uid.conn_idx);
                return;
            }
            player.ModifyPos(msg.pos.x, msg.pos.y);

            //广播
            AOIManager.Instance.UpdatePosition(player.char_idx, msg.pos.y, msg.pos.x, false);
        }