//--------------------------------------------------------------------- // 进入桌子 public async Task enterDesktop(string desktop_etguid) { if (IsEntering) { EbLog.Note("CellPlayerDesktop.enterDesktop() 错误:正在进入中"); return; } IsEntering = true; if (!string.IsNullOrEmpty(DesktopEtGuid)) { await leaveDesktop(); } DesktopRequestPlayerEnter request_enter; request_enter.desktop_etguid = desktop_etguid; request_enter.seat_index = 255; request_enter.player_clip = 0; request_enter.player_gold = CoActor.Def.PropGold.get(); request_enter.is_vip = CoActor.Def.mPropIsVIP.get(); var grain = Entity.getUserData <GrainCellPlayer>(); // Step1:监听桌子广播 await _createDesktopStreamConsumer(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); // Step2:进入桌子并获取桌子初始化信息 var grain_desktop = grain.GF.GetGrain <ICellDesktop>(new Guid(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); }