Пример #1
0
        //---------------------------------------------------------------------
        public async Task enterDesktopPrivate(PrivateDesktopCreateInfo desktop_createinfo)
        {
            if (IsEntering)
            {
                EbLog.Note("CellPlayerDesktop.enterDesktopPrivate() 错误:正在进入中");
                return;
            }
            IsEntering = true;

            if (!string.IsNullOrEmpty(DesktopEtGuid))
            {
                await leaveDesktop();
            }

            var grain = Entity.getUserData <GrainCellPlayer>();
            var grain_desktopservice = grain.GF.GetGrain <ICellDesktopService>(0);
            var desktop_info         = await grain_desktopservice.createPrivateDesktop(desktop_createinfo);

            // Step1:监听桌子广播
            await _createDesktopStreamConsumer(desktop_info.desktop_etguid);

            // 自动下注
            int bet_chip  = 2000;
            int left_chip = CoActor.Def.PropGold.get();

            if (left_chip < bet_chip)
            {
                bet_chip = left_chip;
            }
            left_chip -= bet_chip;
            CoPlayer.CoActor.Def.PropGold.set(left_chip);

            DesktopRequestPlayerEnter request_enter;

            request_enter.desktop_etguid = desktop_info.desktop_etguid;
            request_enter.seat_index     = 0;
            request_enter.player_clip    = 0;
            request_enter.player_gold    = CoActor.Def.PropGold.get();
            request_enter.is_vip         = CoActor.Def.mPropIsVIP.get();

            // Step2:进入桌子并获取桌子初始化信息
            var         grain_desktop = grain.GF.GetGrain <ICellDesktop>(new Guid(desktop_info.desktop_etguid));
            DesktopData desktop_data  = await grain_desktop.s2sPlayerEnter(request_enter, CoPlayer.exportEtPlayerMirror());

            IsEntering    = false;
            DesktopEtGuid = desktop_data.desktop_cfg_data.desktop_etguid;

            DesktopNotify desktop_notify;

            desktop_notify.id   = DesktopNotifyId.DesktopInit;
            desktop_notify.data = EbTool.protobufSerialize <DesktopData>(desktop_data);

            MethodData notify_data = new MethodData();

            notify_data.method_id = MethodType.s2cPlayerDesktopNotify;
            notify_data.param1    = EbTool.protobufSerialize <DesktopNotify>(desktop_notify);
            var grain_player = grain.GF.GetGrain <ICellPlayer>(new Guid(Entity.Guid));

            grain_player.s2sNotify(notify_data);
        }
Пример #2
0
        //-------------------------------------------------------------------------
        // 请求创建私人牌桌
        public void requestCreatePrivateDesktop(PrivateDesktopCreateInfo desktop_createinfo)
        {
            PlayerRequest player_request;

            player_request.id   = PlayerRequestId.CreatePrivateDesktop;
            player_request.data = EbTool.protobufSerialize(desktop_createinfo);
            DefaultRpcSession.rpc((ushort)MethodType.c2sPlayerRequest, player_request);
        }
Пример #3
0
        //-------------------------------------------------------------------------
        // 请求创建私人牌桌
        Task <DesktopInfo> ICellDesktopService.createPrivateDesktop(PrivateDesktopCreateInfo desktop_createinfo)
        {
            Logger.Info("createPrivateDesktop()");

            var    grain_desktop  = GrainFactory.GetGrain <ICellDesktop>(Guid.NewGuid());
            string desktop_etguid = grain_desktop.GetPrimaryKey().ToString();

            DesktopInfo desktop_info = new DesktopInfo();

            desktop_info.desktop_etguid   = desktop_etguid;
            desktop_info.seat_num         = desktop_createinfo.seat_num;
            desktop_info.is_vip           = desktop_createinfo.is_vip;
            desktop_info.desktop_tableid  = desktop_createinfo.desktop_tableid;
            desktop_info.all_player_num   = 0;
            desktop_info.seat_player_num  = 0;
            desktop_info.list_seat_player = new List <DesktopPlayerInfo>();

            grain_desktop.s2sSetupDesktop(desktop_info);

            return(Task.FromResult(desktop_info));
        }
Пример #4
0
        //-------------------------------------------------------------------------
        // 请求创建私人牌桌
        Task<DesktopInfo> ICellDesktopService.createPrivateDesktop(PrivateDesktopCreateInfo desktop_createinfo)
        {
            Logger.Info("createPrivateDesktop()");

            var grain_desktop = GrainFactory.GetGrain<ICellDesktop>(Guid.NewGuid());
            string desktop_etguid = grain_desktop.GetPrimaryKey().ToString();

            DesktopInfo desktop_info = new DesktopInfo();
            desktop_info.desktop_etguid = desktop_etguid;
            desktop_info.seat_num = desktop_createinfo.seat_num;
            desktop_info.is_vip = desktop_createinfo.is_vip;
            desktop_info.desktop_tableid = desktop_createinfo.desktop_tableid;
            desktop_info.all_player_num = 0;
            desktop_info.seat_player_num = 0;
            desktop_info.list_seat_player = new List<DesktopPlayerInfo>();

            grain_desktop.s2sSetupDesktop(desktop_info);

            return Task.FromResult(desktop_info);
        }