Beispiel #1
0
    private void OnHarvestStart(SocketAsyncEventArgs args, byte[] bytes)
    {
        HarvestStart input = HarvestStart.Parser.ParseFrom(bytes);

        if (input.RoomId != RoomId)
        {
            return; // 不是自己房间的消息,略过
        }
        if (input.CellIndex == 0)
        {
            Debug.LogError("RoomLogic OnHarvestStart Error - Actor position is lost!");
        }
        HarvestStartReply output = new HarvestStartReply()
        {
            RoomId       = input.RoomId,
            OwnerId      = input.OwnerId,
            ActorId      = input.ActorId,
            CellIndex    = input.CellIndex,
            ResType      = input.ResType,
            ResRemain    = input.ResRemain,
            DurationTime = input.DurationTime,
            Ret          = true,
        };

        BroadcastMsg(ROOM_REPLY.HarvestStartReply, output.ToByteArray());
    }
        private void OnHarvestStartReply(byte[] bytes)
        {
            HarvestStartReply input = HarvestStartReply.Parser.ParseFrom(bytes);

            if (input.ActorId != ActorId)
            {
                return; // 不是自己,略过
            }
            if (!input.Ret)
            {
                return;
            }
        }