Example #1
0
        //---------------------------------------------------------------------
        // 玩家进入桌子
        Task <DesktopData> ICellDesktop.s2sPlayerEnter(DesktopRequestPlayerEnter request_enter,
                                                       EntityData etdata_playermirror)
        {
            var co_desktop = EtDesktop.getComponent <CellDesktop <DefDesktop> >();

            return(co_desktop.s2sPlayerEnter(request_enter, etdata_playermirror));
        }
Example #2
0
        //---------------------------------------------------------------------
        // 请求查询可以立即玩的桌子
        async Task <DesktopInfo> ICellDesktopService.searchDesktopAuto(DesktopRequestPlayerEnter request_enter)
        {
            Logger.Info("searchDesktopAuto()");

            DesktopInfo desktop_info = null;

            // 根据玩家属性限定搜索条件
            DesktopSearchFilter desktop_search_filter = new DesktopSearchFilter();

            desktop_search_filter.is_vip          = request_enter.is_vip;
            desktop_search_filter.seat_num        = 6;
            desktop_search_filter.is_seat_full    = false;
            desktop_search_filter.desktop_tableid = 1;

            var grain_desktopservice        = GrainFactory.GetGrain <ICellDesktopService>(0);
            List <DesktopInfo> list_desktop = await grain_desktopservice.searchDesktop(desktop_search_filter);

            if (list_desktop == null || list_desktop.Count == 0)
            {
                goto End;
            }

            string desktop_etguid = list_desktop[0].desktop_etguid;

            // 进入桌子
            var grain_desktop = GrainFactory.GetGrain <ICellDesktop>(new Guid(desktop_etguid));

            desktop_info = await grain_desktop.s2sGetDesktopInfo();

End:
            if (desktop_info == null)
            {
                desktop_info = new DesktopInfo();
            }

            return(desktop_info);
        }
        //---------------------------------------------------------------------
        // 请求查询指定桌子
        async Task<DesktopInfo> ICellDesktopService.searchDesktop(string desktop_etguid, DesktopRequestPlayerEnter request_enter)
        {
            Logger.Info("searchDesktop()");

            DesktopInfo desktop_info = null;

            if (string.IsNullOrEmpty(desktop_etguid))
            {
                goto End;
            }

            // 首先查询桌子是否存在
            string key = "CacheDesktopData_" + desktop_etguid;
            bool exists = false;
            if (!exists)
            {
                goto End;
            }

            // 进入桌子
            var grain_desktop = GrainFactory.GetGrain<ICellDesktop>(new Guid(desktop_etguid));
            desktop_info = await grain_desktop.s2sGetDesktopInfo();

            End:
            if (desktop_info == null)
            {
                desktop_info = new DesktopInfo();
            }

            return desktop_info;
        }
        //---------------------------------------------------------------------
        // 请求查询可以立即玩的桌子
        async Task<DesktopInfo> ICellDesktopService.searchDesktopAuto(DesktopRequestPlayerEnter request_enter)
        {
            Logger.Info("searchDesktopAuto()");

            DesktopInfo desktop_info = null;

            // 根据玩家属性限定搜索条件
            DesktopSearchFilter desktop_search_filter = new DesktopSearchFilter();
            desktop_search_filter.is_vip = request_enter.is_vip;
            desktop_search_filter.seat_num = 6;
            desktop_search_filter.is_seat_full = false;
            desktop_search_filter.desktop_tableid = 1;

            var grain_desktopservice = GrainFactory.GetGrain<ICellDesktopService>(0);
            List<DesktopInfo> list_desktop = await grain_desktopservice.searchDesktop(desktop_search_filter);
            if (list_desktop == null || list_desktop.Count == 0)
            {
                goto End;
            }

            string desktop_etguid = list_desktop[0].desktop_etguid;

            // 进入桌子
            var grain_desktop = GrainFactory.GetGrain<ICellDesktop>(new Guid(desktop_etguid));
            desktop_info = await grain_desktop.s2sGetDesktopInfo();

            End:
            if (desktop_info == null)
            {
                desktop_info = new DesktopInfo();
            }

            return desktop_info;
        }
Example #5
0
        //---------------------------------------------------------------------
        // 请求查询指定桌子
        async Task <DesktopInfo> ICellDesktopService.searchDesktop(string desktop_etguid, DesktopRequestPlayerEnter request_enter)
        {
            Logger.Info("searchDesktop()");

            DesktopInfo desktop_info = null;

            if (string.IsNullOrEmpty(desktop_etguid))
            {
                goto End;
            }

            // 首先查询桌子是否存在
            string key    = "CacheDesktopData_" + desktop_etguid;
            bool   exists = false;

            if (!exists)
            {
                goto End;
            }

            // 进入桌子
            var grain_desktop = GrainFactory.GetGrain <ICellDesktop>(new Guid(desktop_etguid));

            desktop_info = await grain_desktop.s2sGetDesktopInfo();

End:
            if (desktop_info == null)
            {
                desktop_info = new DesktopInfo();
            }

            return(desktop_info);
        }
Example #6
0
        //-------------------------------------------------------------------------
        // 玩家进入桌子
        public Task <DesktopData> s2sPlayerEnter(DesktopRequestPlayerEnter request_enter, EntityData etdata_playermirror)
        {
            byte seat_index = request_enter.seat_index;

            if (getPlayerCountInSeat() >= DesktopConfigData.seat_num)
            {
                // 没有空座位了,观战
                seat_index = 255;
            }

            if (!isValidSeatIndex(seat_index))
            {
                // 座位索引范围不合法,重新分配空座位
                foreach (var i in AllSeat)
                {
                    if (i.et_playermirror == null)
                    {
                        seat_index = i.index;
                        break;
                    }
                }
            }

            if (isValidSeatIndex(seat_index) && AllSeat[seat_index].et_playermirror != null)
            {
                // 座位上已经有人坐了,重新分配空座位
                foreach (var i in AllSeat)
                {
                    if (i.et_playermirror == null)
                    {
                        seat_index = i.index;
                        break;
                    }
                }
            }

            var et_playermirror = EntityMgr.genEntity <EtPlayerMirror, Entity>(etdata_playermirror, Entity);
            var co_actormirror  = et_playermirror.getComponent <CellActorMirror <DefActorMirror> >();
            var co_ai           = et_playermirror.getComponent <CellActorMirrorAi <DefActorMirrorAi> >();

            byte actorid_indesktop = _genPlayerId();

            co_actormirror.Def.PropActorIdInDesktop.set(actorid_indesktop);

            EbLog.Note("CellDesktop.s2sPlayerEnter() PlayerEtGuid=" + et_playermirror.Guid);

            MapAllPlayer1[actorid_indesktop]   = et_playermirror;
            MapAllPlayer[et_playermirror.Guid] = et_playermirror;
            if (isValidSeatIndex(seat_index))
            {
                AllSeat[seat_index].et_playermirror = et_playermirror;
            }

            co_actormirror.onEnterDesktop(seat_index);

            // 更新DesktopInfo
            refreshDesktopInfo();

            // 广播玩家进入桌子
            DesktopNotify desktop_notify;

            desktop_notify.id   = DesktopNotifyId.PlayerEnter;
            desktop_notify.data = EbTool.protobufSerialize <EntityData>(et_playermirror.genEntityData4All());

            StreamData sd = new StreamData();

            sd.event_id = StreamEventId.DesktopStreamEvent;
            sd.param1   = desktop_notify;
            var grain_desktop = Entity.getUserData <GrainCellDesktop>();

            grain_desktop.AsyncStream.OnNextAsync(sd);

            // 通知场景玩家坐下
            LogicScene.scenePlayerEnter(actorid_indesktop, 1, "aabb", false, -1, TbDataTurret.TurretType.NormalTurret);
            float player_rate = 1.0f;// mEtDesktopPumping.getPlayerUpgradeRate();// 抽水率

            LogicScene.scenePlayerRateChanged(1, player_rate);

            DesktopData desktop_data = _getDesktopData();

            return(Task.FromResult(desktop_data));
        }