Exemplo n.º 1
0
    //-------------------------------------------------------------------------
    public Entity getEtPlayerMirrorById(byte actorid_indesktop)
    {
        Entity et_playermirror = null;

        MapAllPlayer1.TryGetValue(actorid_indesktop, out et_playermirror);
        return(et_playermirror);
    }
Exemplo n.º 2
0
    //-------------------------------------------------------------------------
    // 玩家离开桌子
    public Task <DesktopPlayerLeaveInfo> s2sPlayerLeave(string player_etguid)
    {
        EbLog.Note("CellDesktop.s2sPlayerLeave() PlayerEtGuid=" + player_etguid);

        DesktopPlayerLeaveInfo leave_info = new DesktopPlayerLeaveInfo();

        // 玩家不在座位上
        SeatInfo seat_cur = getSeat(player_etguid);

        if (seat_cur == null)
        {
            goto End;
        }

End:
        CellActorMirror <DefActorMirror> co_playermirror = null;
        Entity et_playermirror = null;

        // 清空座位
        if (MapAllPlayer.TryGetValue(player_etguid, out et_playermirror))
        {
            co_playermirror  = et_playermirror.getComponent <CellActorMirror <DefActorMirror> >();
            leave_info.stack = co_playermirror.Def.PropGold.get();
            byte actorid_indesktop = co_playermirror.Def.PropActorIdInDesktop.get();
            _freePlayerId(actorid_indesktop);

            et_playermirror.close();
            MapAllPlayer.Remove(player_etguid);
            MapAllPlayer1.Remove(actorid_indesktop);
        }

        foreach (var i in AllSeat)
        {
            if (i.et_playermirror != null && i.et_playermirror.Guid == player_etguid)
            {
                et_playermirror   = i.et_playermirror;
                i.et_playermirror = null;
            }
        }

        // 更新DesktopInfo
        refreshDesktopInfo();

        // 广播玩家离开桌子
        {
            DesktopNotify desktop_notify;
            desktop_notify.id   = DesktopNotifyId.PlayerLeave;
            desktop_notify.data = EbTool.protobufSerialize <string>(player_etguid);

            StreamData sd = new StreamData();
            sd.event_id = StreamEventId.DesktopStreamEvent;
            sd.param1   = desktop_notify;
            var grain_desktop = Entity.getUserData <GrainCellDesktop>();
            grain_desktop.AsyncStream.OnNextAsync(sd);
        }

        return(Task.FromResult(leave_info));
    }
Exemplo n.º 3
0
    //-------------------------------------------------------------------------
    public void logicScene2Render(uint et_player_rpcid, List <string> vec_param)
    {
        Entity et_actormirror = null;

        MapAllPlayer1.TryGetValue(1, out et_actormirror);
        if (et_actormirror == null)
        {
            return;
        }

        var grain_desktop = Entity.getUserData <GrainCellDesktop>();
        var grain_player  = grain_desktop.GF.GetGrain <ICellPlayer>(new Guid(et_actormirror.Guid));

        grain_player.s2sDesktop2Player(vec_param);
    }