Beispiel #1
0
    private void OnActorMoveReply(byte[] bytes)
    {
        ActorMoveReply input = ActorMoveReply.Parser.ParseFrom(bytes);

        if (!input.Ret)
        {
            string msg = "移动Actor失败!";
            GameRoomManager.Instance.Log("MSG: OnActorMoveReply - " + msg);
            return;
        }

        GameRoomManager.Instance.HexmapHelper.DoMove(input.ActorId, input.CellIndexFrom, input.CellIndexTo);
    }
Beispiel #2
0
    private void OnActorMove(SocketAsyncEventArgs args, byte[] bytes)
    {
        ActorMove input = ActorMove.Parser.ParseFrom(bytes);

        if (input.RoomId != RoomId)
        {
            return; // 不是自己房间的消息,略过
        }
        if (input.CellIndexFrom == 0 || input.CellIndexTo == 0)
        {
            Debug.LogError("RoomLogic OnActorMove Error - Actor position is lost!");
        }
        ActorMoveReply output = new ActorMoveReply()
        {
            RoomId        = input.RoomId,
            OwnerId       = input.OwnerId,
            ActorId       = input.ActorId,
            CellIndexFrom = input.CellIndexFrom,
            CellIndexTo   = input.CellIndexTo,
            Ret           = true,
        };

        BroadcastMsg(ROOM_REPLY.ActorMoveReply, output.ToByteArray());
    }