Esempio n. 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));
        }
        //---------------------------------------------------------------------
        // 请求查询可以立即玩的桌子
        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 = await DbClientCouchbase.Instance.asyncExists(key);

            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);
        }