Exemplo n.º 1
0
        //-------------------------------------------------------------------------
        void _broadcastFriendNotify(PlayerFriendNotify friend_notify)
        {
            StreamData sd = new StreamData();

            sd.event_id = StreamEventId.FriendStreamEvent;
            sd.param1   = friend_notify;
            var grain = Entity.getUserData <GrainCellPlayer>();

            grain.AsyncStream.OnNextAsync(sd);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        // 好友通知
        void s2cPlayerFriendNotify(PlayerFriendNotify playerfriend_notify)
        {
            switch (playerfriend_notify.id)
            {
            case PlayerFriendNotifyId.RecommendPlayerList:    // 推荐好友列表
            {
                //EbLog.Note("ClientPlayerFriend.s2cPlayerFriendNotify() RecommendPlayerList");

                var list_recommend = EbTool.protobufDeserialize <List <PlayerInfo> >(playerfriend_notify.data);

                var e = EntityMgr.getDefaultEventPublisher().genEvent <EvEntityRecommendPlayerList>();
                e.list_recommend = list_recommend;
                e.send(null);
            }
            break;

            case PlayerFriendNotifyId.AddFriend:    // 通知添加好友
            {
                EbLog.Note("ClientPlayerFriend.s2cPlayerFriendNotify() AddFriend");

                var friend_item = EbTool.protobufDeserialize <PlayerInfo>(playerfriend_notify.data);

                Dictionary <string, PlayerInfo> map_friend = Def.mPropMapFriend.get();
                map_friend[friend_item.player_etguid] = friend_item;

                var e = EntityMgr.getDefaultEventPublisher().genEvent <EvEntityNotifyAddFriend>();
                e.friend_item = friend_item;
                e.send(null);
            }
            break;

            case PlayerFriendNotifyId.DeleteFriend:    // 通知删除好友
            {
                EbLog.Note("ClientPlayerFriend.s2cPlayerFriendNotify() DeleteFriend");

                var friend_etguid = EbTool.protobufDeserialize <string>(playerfriend_notify.data);

                PlayerInfo friend = null;
                Dictionary <string, PlayerInfo> map_friend = Def.mPropMapFriend.get();
                if (map_friend.TryGetValue(friend_etguid, out friend))
                {
                    map_friend.Remove(friend_etguid);
                }

                var e = EntityMgr.getDefaultEventPublisher().genEvent <EvEntityNotifyDeleteFriend>();
                e.friend_etguid = friend_etguid;
                e.send(null);
            }
            break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------
        void _onFriendNotify(PlayerFriendNotify friend_notify)
        {
            MethodData notify_data = new MethodData();

            notify_data.method_id = MethodType.s2cPlayerFriendNotify;
            notify_data.param1    = EbTool.protobufSerialize <PlayerFriendNotify>(friend_notify);
            var grain        = Entity.getUserData <GrainCellPlayer>();
            var grain_player = grain.GF.GetGrain <ICellPlayer>(new Guid(Entity.Guid));

            grain_player.s2sNotify(notify_data);
        }